Technically Speaking

Chris Haaker is Geeking Microsoft
posts - 563, comments - 643, trackbacks - 213

My Links

News

Tag Cloud

Archives

Post Categories

Personal

Tech

Why You Should Use Diskpar

From the You Had Me At EHLO Exchange blog (who knew?):

Why should you use Diskpar (Diskpart in W2003 SP1)?

Exchange Server can benefit from having basic disk partitions track-aligned.  Diskpar.exe is used for aligning a partition at the storage level, which, if used to create the partition, can have a significant positive performance impact on the storage and is highly recommended.   Before I go into the details of how to do this, I’ll give some basic definitions.  A partition is the container you create on an initialized disk to format and then use. Multiple partitions can be created on a single physical disk, and each partition will function as a separate disk (even though the partition will appear to be a separate disk, the total throughput of the physical disk is unchanged – so if you make two partitions on each disk and use them equally, they will each effectively only have half the available i/o rate.  This is important to keep in mind for capacity planning).   A sector is the smallest accessible unit on a physical disk, with multiple sectors comprising a track.  A partition that is track misaligned will occasionally cause 2 I/O operations instead of one depending on the actual drive geometry.

 

Even though some storage obfuscates sectors & tracks, using diskpar will still help by preventing misalignment in cache, or wasted cache.  If the disk is not aligned, every Nth (usually 8th) read or write crosses a boundary, and the physical disk must perform two operations.  At the beginning of all disks is a section reserved for the master boot record (MBR) consuming 63 sectors.  This means that your partition will start on the 64th sector, misaligning the entire partition.  Most vendors suggest a 64-sector starting offset, meaning that your partition starts on the 65th sector vs the standard 64th.  Check with your particular vendor before standardizing this setting on a particular storage array.  The key is to have it aligned on a 4 KB boundary from the start of the disk, of which choosing 64 sectors is 32 KB, and aligned.  (64 * 512 bytes per sector = 32,768 bytes)

 

It is important to differentiate the sector alignment, with file level fragmentation and allocation unit size.  Most Exchange Server I/O is random 4 KB read & write to the database .edb file.  We don’t notice a huge statistical difference in normal file fragmentation on a database LUN.  Since Exchange best practice is to place all database files in a storage group on the same LUN, as they grow, they will fragment each other pretty severely.  I have only heard of one case where serious file-level fragmentation impacted Exchange, and that was when a customer ran a 3rd party application on the same partition as the database files, and it created/deleted millions of very small files in a day.  If you dismount the databases, and perform an offline defrag, one database at a time, you will eradicate the file level fragmentation, but the performance win would be nearly immeasurable.  It is not recommended to have any other files on the exchange database or log partitions (it is especially important not to share the log partitions with other programs, since log access to the drive is sequential, and random access to the drives hosting the drive will significantly reduce the performance.)

 

Exchange accesses the database file (edb) in random 4 KB read/write, which is, by default, the allocation unit size on the partition.  The default allocation unit size of 4 KB, which can be set at partition format, is the best practice.  If you use the default allocation unit size of 4096 bytes and have a starting offset that is a multiple of 4096 bytes, then your partition will always align on a 4 KB boundary. Setting the allocation size to be larger than 4 KB will disable NTFS compression [Exchange log and database files should always be uncompressed], and is useful in rare streaming backup solutions of extremely large databases where a larger allocation unit size will increase backup speed.

 

Diskpar:

 

You have 2 switches, (i)nfo, and (s)et, and a parameter.  The parameter which you must add is the disk number.  This is discernable in disk manager (diskmgmt.msc)

 

1) First I query the disk and notice that the starting offset is 32256 bytes, which is not aligned.

C:\>diskpar -i 2

 

---- Drive 2 Geometry Infomation ----

 

Cylinders = 13056

TracksPerCylinder = 255

SectorsPerTrack = 63

BytesPerSector = 512

DiskSize = 107389255680 (Bytes) = 102414 (MB)

 

---- Drive Partition 0 Infomation ----

 

StatringOffset = 32256

PartitionLength = 107380998144

HiddenSectors = 63

PartitionNumber = 1

PartitionType = 7

2) Notice 32256 / 4096 = 7.875 , which is not an integer.   We want to change this to improve performance.

3) Now I set it to 64 sectors, and select the full available partition size.

C:\>diskpar –s 2            (yes, it’s really this easy)

 

---- New Partition information ----

StatringOffset = 32768

PartitionLength = 107388862464

HiddenSectors = 64

PartitionNumber = 1

PartitionType = 7

4) Now we get 32768 / 4096 = 8. Yeah!

5) Now open up disk manager and format the drive.

 

Diskpart:

 

In Windows 2003 SP1, diskpart.exe has included diskpar.exe functionality.  The main difference is that diskpar creates a partition in sectors (512byte), and diskpart uses kilobytes.  In the example below we take a disk w/o any partitions and create it with the same starting offset of 32768 as the above diskpar.exe example.

C:\>diskpart

Microsoft DiskPart version 5.2.3790.1830

Copyright (C) 1999-2001 Microsoft Corporation.

On computer: Exchange2003

 

DISKPART> select disk 1

 

Disk 1 is now the selected disk.

 

DISKPART> create partition primary align=32

 

DiskPart succeeded in creating the specified partition.

Resources:

 

Microsoft:

 

http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/server/reskit/en-us/prork/pree_exa_oori.asp

 

http://www.microsoft.com/resources/documentation/windows/2000/professional/reskit/en-us/part6/proch30.mspx

 

3rd Party:

http://h71019.www7.hp.com/ActiveAnswers/downloads/Exchange2003EVA5000PerformanceWhitePaper.doc

http://www.emc.com/pdf/techlib/exchange_2000_symmetrix.pdf

 

- Robert Quimbey

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Thursday, August 11, 2005 5:43 PM |

Feedback

Gravatar

# re: Why You Should Use Diskpar

Hi Robert,

I'm in the process of adding iSCSI storage to a Windows 2000 Server. I'm trying to align the disk sectors but diskparT will not allow me to do so on a 2000 box. I am unable to find DISKPAR anywhere. MS insists it's on their website but their 2000 Resource Kit includes diskparT and not diskpar... any ideas?
3/11/2008 10:12 AM | Chris
Gravatar

# re: Why You Should Use Diskpar

try this link..
4/28/2008 10:37 AM | teo
Gravatar

# re: Why You Should Use Diskpar


Would help if I wrote the link on the right place :D http://kb.wisc.edu/images/4556/diskpar.exe
4/28/2008 10:39 AM | teo
Gravatar

# re: Why You Should Use Diskpar

This is a very well written article.
Easy to follow.
I am happy that I came across this.
Thank you.
3/14/2009 10:44 AM | dll
Gravatar

# re: Why You Should Use Diskpar

second partition ? any idea how to create a second aligned partition ?

winxp2sp2->diskpart appears unable to align partitions on 32kb / 64sector boundaries.

thanks
3/18/2009 4:45 AM | brian the snail
Gravatar

# seo agency

A Leading & Strategic (SEO) Agency Providing SEO Marketing Search Engine Optimization, Internet Marketing Services, Website Promotion, Pay Per Click (PPC) Management Services.
4/27/2010 7:30 PM | Alex
Gravatar

#  Airport Transportation Seattle

Des A Plus Town Car provides luxury SeaTac airport town car service to & from Seattle, Bellevue, Redmond, Kirkland, and Tacoma at affordable rates.
4/27/2010 11:41 PM | aplustowncar
Gravatar

# Airport Transportation Seattle

A Plus Town Car provides luxury SeaTac airport town car service to & from Seattle, Bellevue, Redmond, Kirkland, and Tacoma at affordable rates.
5/5/2010 7:31 PM | aplustowncar
Gravatar

# Taxation

Trade IN EU is an independent India-EU consulting firm to help your company to develop a sustainable logistics schema and to recognize tangible eco-efficient supply chain measures.
5/20/2010 6:30 PM | Axtion
Gravatar

# re: Why You Should Use Diskpar

It appears that you've put a good amount of effort into your article and I want a lot more of these on the World Wide Web these days. I sincerely got a kick out of your post. I do not have a bunch to to say in response, I only wanted to register to say remarkable work.
5/23/2011 10:40 PM | Lasik Surgery
Gravatar

# re: Why You Should Use Diskpar

Today Speed Kings brings you a News for our fellow car lovers and a guide to hit the Road with these extreme mean machines but they are the best so keep looking for new posts.
5/23/2011 10:41 PM | Kia Motors
Gravatar

# re: Why You Should Use Diskpar

Давайте будем оптимистами - продвижение неизбежно наступит.
7/5/2011 11:25 PM | Loo
Gravatar

# Seattle town car services

Allstate Towncar Services provides top-notch sedans and Limousines and is committed to passenger safety, customer satisfaction and personalized service.
7/30/2011 7:29 AM | Sachin
Gravatar

# ranger

where a larger allocation unit size will increase backup speed.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: