|
How to get better I/O performance with RAID
Would you like to know how to increase your servers I/O performance by up to 40%!? Well if so, then read on my friend! Disk alignment is one of Windows best kept secrets (or worse depending on how you see it.) If you’re running Windows Server 2000, 2003 or Windows XP with RAID, you are probably not getting the throughput you could if you had correctly aligned disks.
We’ve discussed this topic at length in our VMware Disk Alignment KB, but I felt it necessary to extend the discussion specifically for Windows. If you’re not familiar with the term disk alignment or sector alignment, in layman’s terms it goes like this. Windows like to write data to disk in 64k chucks. However Windows Server 2000, 2003 and Windows XP all incorrectly begin writing data at the 63rd sector. This means the first 1k of the chuck is written into one sector, and the remaining 63k in the next, and so on. The consequence of this behavior means that for every read and write, two sectors must be accessed from disk instead of one. This basically doubles your disk I/O.


You might be wondering if your victim to sector alignment issues? Unfortunately, for most, this answer is yes. Microsoft Windows Server 2000, Windows Server 2003 and Windows XP are all plagued with this problem. Any new volumes created on these operating systems (if not set correctly with diskpart - more on that in a minute) will be aligned incorrectly. Microsoft has addressed this issue in Windows Server 2008 and Window Vista, but upgrading an existing installation will not correct a disk that was originally formatted on one of the affected platforms.
- Note: Although a non-RAID disk can also be effected, this is usually only a problem for RAID and/or LUN volumes.
Linux and UNIX distributions can also suffer from disk alignment issues with RAID. There are far too many flavors and distributions to discuss, but I will tell you that most of the major distributions if not installed through some sort of expert mode (allowing you to specify the sector alignment) will by default format your drives starting on the 63rd sector.
Checking Windows Disk Alignment
Unfortunately, Windows doesn’t offer an easy way to check disk alignment. We have created a script to help you analyze your servers WMI partition data for any Windows platform (physical or virtual). You can find this script in our downloads area labeled Disk Alignment Check Utility. The script will check all your computer’s volumes and report back if they are aligned.
- Download the Disk Alignment check Utility from our Downloads Area
- Extract the contents to your hard drive
- Double click run.bat

- The script will produce some diagnostic information on your disk. Take note of the “Starting Offset” and “Disk Alignment” fields.

After running this utility, most will find a starting offset of 32256 (or 31.5 KB.) This is the default offset for Windows Server 2000, 2003 and Windows XP. But, it’s not the end of the world. So long as the affected volume is not running RAID, although not ideal, you’ll be ok. Having a boot volume that is not aligned is also not uncommon; just make sure that your data or I/O intensive volumes are. But if you find your exchange or SQL volumes are not aligned, well, then you have some work ahead of you.
Creating new Aligned Volumes
Most RAID configurations will write data in 64KB chucks (64KB = 128 sectors). However, per Microsoft KB 929491 you should consider using an offset of at least 2048 sectors (1024 KB) to cover SAN configurations. You're actual RAID/LUN configuration might dictate something else altogether so additional research should be made to ensure your starting sector aligns with your RAID/LUN configuration.
For most though, the 2048 sector offset is a safe bet. We’ll use the diskpart utility to create a new partition aligned at 2048 (1024 KB) but you should double check with your SAN administrator and/or server administrator to verify the offset of your configuration.
- Note: You must be running Service Pack 1 or later (diskpart was not included in earlier distributions)
- Run diskpart from the command line (start -> run -> cmd)
C:\>diskpart
Microsoft DiskPart version 5.2.3790.3959 Copyright (C) 1999-2001 Microsoft Corporation. On computer: Server01
DISKPART>
|
- List the disks available on your system
DISKPART> list disk
|
| Disk ### |
Status |
Size |
Free |
Dyn |
Gpt |
| ------------- |
---------- |
------------ |
------------ |
------ |
------ |
| Disk 0 |
Online |
10 GB |
8033 KB |
|
|
| Disk 1 |
Online |
2047 MB |
2047 MB |
|
|
|
| DISKPART> |
|
- Select the number of the disk you wish aligned
DISKPART> select disk 1
Disk 1 is now the selected disk.
DISKPART>
|
- Create a new partition aligned at 1024KB (sector 2048)
DISKPART> create partition primary align=1024
DiskPart succeeded in creating the specified partition.
DISKPART>
|
- Assign the drive a letter
DISKPART> assign letter=e
DiskPart successfully assigned the drive letter or mount point.
DISKPART>
|
- Exit diskpart and format the disk using disk management. Run compmgmnt.msc

- From Disk Management, right click the new volume and select format

- Enter your desired formatting defaults and click ok

- Confirm the format

- Run the Disk Alignment Check Utility to verify the alignment of your new partition
Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Device ID: Disk #0, Partition #0 ============================================= Number Of Blocks: 20948697 Block Size: 512 KB Total Volume Size: 10 GB Type: Installable File System Starting Offset: 32256 (31.5 KB) Disk Alignment: NOT ALIGNED!!
Device ID: Disk #1, Partition #0 ============================================= Number Of Blocks: 4174852 Block Size: 512 KB Total Volume Size: 2 GB Type: Installable File System Starting Offset: 1048576 (1024 KB) Disk Alignment: Aligned
|
Congratulations, you've now aligned your new volume! Just make sure you follow this guide for any new volumes that are created with RAID and LUN volumes and you'll be able to rest easy knowing that your getting the best possible I/O performance within Windows.
Add this page to your favorite website
|