windows2003实现分区与Raid条带对齐
参考链接:
《Disk Partition Alignment Best Practices for SQL Server》http://msdn.microsoft.com/zh-cn/library/dd758814(v=sql.100).aspx
《磁盘性能可能比预期在 Windows Server 2003 中、 Windows XP 中和在 Windows 2000 中使用多个磁盘时,速度较慢》http://support.microsoft.com/kb/929491/zh-cn
Windows判断分区是否与Raid条带对齐的方法
- 使用wmic partition get BlockSize, StartingOffset, Name, Index 命令查看分区偏移
- 使用StartingOffset/(raid Strip Size*1024)公式计算结构
- 如果结果为整数,则分区对齐
获得Strip Size的命令
MegaCli -adpallinfo -a0 -nolog | findstr /B /I "Strip Size"
使用系统工具默认分区
C:\Documents and Settings\Administrator>wmic partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #0, Partition #0 32256
512 1 Disk #0, Partition #1 32218421760 ===>> 491614.1015625
使用diskpart分区同时设置对齐位
C:\Documents and Settings\Administrator>wmic partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #0, Partition #0 32256 ===>> 31.5K
512 1 Disk #0, Partition #1 32210223104 ===>>491489
测试服务器Raid条带大小为64K,由以上结构可以看出两种分区结果差别。
C:\Documents and Settings\Administrator>wmic partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #0, Partition #0 32256
512 1 Disk #0, Partition #1 32218421760 ===>> 491614.1015625
使用diskpart分区同时设置对齐位
C:\Documents and Settings\Administrator>wmic partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #0, Partition #0 32256 ===>> 31.5K
512 1 Disk #0, Partition #1 32210223104 ===>>491489
测试服务器Raid条带大小为64K,由以上结构可以看出两种分区结果差别。
同时,Partition #0 为系统盘分区,windows 2003默认偏移31.5K,是不对齐,这个分区不能调整;这个情况在windows2008得到解决,改为默认偏移1024K。这也是windows2008系统比2003系统性能高的其中一个原因。
对齐后可以发挥Raid磁盘性能。如果使用不对齐磁盘,将降低5%~30%Raid性能。
那么如何在windows中配置分区对齐呢?使用windows自带命令行工具diskpart即可完成。
Diskpart操作方法:
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 272 GB 242 GB
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> create partition primary align=64 ==>>SQL server推荐使用64K
DiskPart succeeded in creating the specified partition.
DISKPART> assign letter=d
Disk ### Status Size Free Dyn Gpt
-------- ---------- ------- ------- --- ---
Disk 0 Online 272 GB 242 GB
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> create partition primary align=64 ==>>SQL server推荐使用64K
DiskPart succeeded in creating the specified partition.
DISKPART> assign letter=d
DiskPart successfully assigned the drive letter or mount point.
DISKPART>exit
格式化配置
使用“磁盘管理”管理单元或 Windows Format 命令来将分区格式化为 NTFS 格式分区,SQL server服务器推荐簇大小64K
Diskpart脚本使用
脚本名:davinci_dp.txt
list disk
select disk 0
create partition primary align=64 size=102400
assign letter=d
create partition primary align=64 size=102400
assign letter=e
create partition primary align=64
assign letter=f
select disk 0
create partition primary align=64 size=102400
assign letter=d
create partition primary align=64 size=102400
assign letter=e
create partition primary align=64
assign letter=f
调用脚本命令:diskpart /S davinci_dp.txt > dplog.txt
格式化磁盘:簇大小指定为64K
format d: /FS:ntfs /A:64K /V:Data
format e: /FS:ntfs /A:64K /V:Log
format f: /FS:ntfs /A:64K /V:Swap