Skip to content

            Lost ?  |  Need an account:
 
VMware Disk Alignment PDF Print E-mail
(18 votes, average 4.22 out of 5)
Written by Tom Hirt   
Thursday, 09 April 2009 14:13
Article Index
VMware Disk Alignment
Checking VMFS Disk Alignment
Aligning VMFS and Linux using fdisk
Preparing VMDK for Windows Installation
All Pages

 

Importance of Disk Alignment in VMware


Some of you might already be familiar with the tremendous I/O improvements that come from a RAID disk set that has the correct alignment.  But how does this translate into the virtual world and virtual disks?  Well, as with many things in the virtual world, what is good practice in the physical world also makes for good practice in the virtual world.

For anyone who is not familiar with the term disk alignment, it’s an issue that has traditionally plagued physical machines (both Linux and Windows) using RAID volumes (software and hardware.)  The effects are staggering, a correctly aligned disks can yield anywhere between a 10% - 40% increase in performance over a non aligned RAID volume.  Just in case you missed that, I said 10% - 40% - wow!

So you might be wondering if this holds true within a virtual machine also.  Well, this is a complicated question to answer because most virtual machines running on an ESX server, whether using raw disk mappings (RDM) or more traditional virtual machine disk files (VMDK) don’t use RAID.  Most people create one or two VMDK’s, one for the boot and one for the data volumes, for each of their virtual machines.  At first glance, you may think disk alignment within a virtual machine is not necessary, but guess again.  Even though most virtual machines do not use RAID within the guest operating system, the VMDK files used by the virtual machines sit on LUNs which do use RAID.  Therefore, disk alignment within your virtual machine is critical.

There is a lot of incorrect information surrounding this topic because most people fail to realize the VMDK is running from a RAID blackened LUN.  So whether you’re talking about the boot or data volume, (in a virtual machine running from a LUN) you should always align the disk.

I've borrowed some text from VMware's partition alignment guide to help illustrate the point further.

"In a SAN environment, the smallest hardware unit used by a SAN storage array to build a LUN out of multiple physical disks is a called a chunk or a stripe. To optimize I/O, chunks are usually much larger than sectors. Thus a SCSI I/O request that intends to read a sector in reality reads one chunk.

On top of this, in a Windows environment NTFS is formatted in blocks ranging from 1MB to 8MB. The file system used by the guest operating system optimizes I/O by grouping sectors into so-called clusters (allocation units).

Figure 1 shows that an unaligned structure may cause many additional I/O operations when only one cluster is ready by the guest operating system."

VMDK without alignment

VMDK Aligned

So as you can see, alignment within the VMDK can lead to a performance hit if its not aligned.

I also want to dispel the notion that aligning the boot volume within a virtual machine is pointless.  True, most good system administrators will move I/O intensive applications to a data drive, but if the application is truly I/O intensive, should it even be virtualized in the first place?  Working under that assumption, for the applications and systems you have virtualized, why not give them the best possible performance?  Deploying a virtual machine from a template that has already been aligned requires no additional work and that virtual machine will forever more benefit from the affects of a correctly aligned volume.

I should however point out that the 10% - 40% performance increase in the physical world doesn’t translate verbatim to the virtual world.  If you’ve been running virtual machines for any length of time, you have probably noticed less I/O throughput on your virtual machine as compared to that of a physical machine.  Therefore it’s safe to assume the same for the virtual machine, but don’t think for a moment that your time is wasted aligning your volumes within a virtual machine.  VMware reports throughput can increase by as much as 62% (averaging about 12%) with a latency decreases of up to 33% (averaging about 10%) with proper disk alignement.  That’s a nice little performance boost and one that most of us could use.

 

 



Comments
Add New Search
Andre  - Nice step-by-step guide... |15/01/2010 14:12:22
I already read various articles about disk alignment. Your's is the one I bookmarked. Nice job.
BTW, it seems someone changed a setting in step 8 and did not replace the picture in step 9. (2048 blocks should really not result in a 128 blocks offset;-)))
Travis  - Nice write up |27/01/2010 11:02:46
Very nice write on disk alignment. I followed all the steps and when I went to install Windows I pressed enter in step 13 of your guide and the next screen asked me if I wanted to format the partition. Should this happen?
Anonymous |03/02/2010 15:36:41
In step 11, command
Code:
# vmkfstools –C –createfs vmfs3 –b 4m /dev/disks/vmhba32\:0\:0\:0\:1

should looks like
Code:
# vmkfstools –C vmfs3 –b 4m /dev/disks/vmhba32\:0\:0\:0\:1

One should use "-C" or "--createfs".
admin |03/02/2010 20:20:40
Nice catch! I've updated step #11 to reflect the change.

Thanks!
-Tom
ericgc |18/02/2010 10:28:51
how come that command is not in step 11 anymore?
Anonymous |26/02/2010 03:19:52
Hello,

Does this apply to windows 2008 as well?

/Nick
thirt |03/03/2010 12:08:48
Hi Nick,

No, Microsoft finally got around to fixing this in Windows 2008. I guess they received enough fan mail on the topic to address it. :D

Best
-Tom
amikolajczyk  - IT Manager |08/10/2010 07:53:16
Hi, could you explain this a little more? What was the "this" that got fixed in 2008? Is it no longer necessary to do this in Windows 2008? I just followed your steps for a 2008 R2 VM and it failed to get past POST.

I checked a recently deployed 2008 R2 server with your alignment check script and it reported everything was aligned A-OK even though I didn't manually do any manual steps at all.

Thanks for this guide, I read a lot of them and this was hands-down the best explanation along with the best step-by-step guide.

Regards,
AJM
Berni |28/08/2010 08:39:56
Great article about disk aligment. Thanks!

But how can I extend an existing volume with the right aligment? When I extend the volume in VIC, the second disk is not aligned :(
victor |02/01/2011 18:18:56
If I were to clone the aligned VM does the alignment follow or not?
Denis |15/02/2011 14:00:06
Hi, Tom! Thanks.

But i don't understand, why we align a windows partition of virtual machine, if vmdk-flat-files already aligned, because they are consist of 1MB clusters of VMFS file system.
Anthony Vandewerdt |06/04/2011 23:11:02
Hi.

Great pictures.
You make the statement:
NTFS is formatted in blocks ranging from 1MB to 8MB

Do you mean VMFS?
If I check here, NTFS uses clusters that are nowhere near that big:
http://support.microsoft.com/kb/140365
erski  - Partition 1 has different physical/logical beginni |19/11/2011 01:46:22
I've made changes to disk step by step and I got this error:

Disk /dev/sda: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders, total 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 224909 111431 83 Linux
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 1, 1) logical=(0, 32, 33)

/dev/sda2 224910 2329424 1052257+ 82 Linux swap / Solaris
/dev/sda3 2329425 8385929 3028252+ 83 Linux

Any idea how to resolve the problem?
Mark W |12/02/2012 19:26:15
Hi, you mention in the article that once a windows partition is created and windows installed, you cannot change the offset. This is incorrect. You can boot off a gparted live cd, add a 2MB offset, then once its done that, change it to 1MB offset and then it aligns correctly. The two step process is necessary due to the way Gparted calculates the space.
Magik  - Sr Systems Engineer |22/02/2012 11:57:45
If you can get your hands on a tool called MBRALIGN from NetApp Host Utilities for ESX then you can use this to run against VMDK files to fix the offset of existing virtual disks. It takes advantage of the fact that your partition is a VMDK and simply fixes the VMDK.

Rick
C. Beerse  - re: |25/04/2012 08:30:05
victor wrote:
If I were to clone the aligned VM does the alignment follow or not?

Depends on the clone tool: Most (older) tools just do a block copy of the guest disks. Hence, the allignment does not change.
From vmware-converter 5.x (and workstation 8?) there is an option that optimizes the disk allignment. That updates the allignment to the conversion target. Current versions of other (vmware based) converters do the same.
C. Beerse  - re: IT Manager |25/04/2012 08:33:36
amikolajczyk wrote:
Hi, could you explain this a little more? What was the "this" that got fixed in 2008? Is it no longer necessary to do this in Windows 2008? I just followed your steps for a 2008 R2 VM and it failed to get past POST.

As far as I know, msW2k8 and newer installations start with an 1 MByte offset for this allignment by default. That is with disks over a (relative small) size. If you create a realy small filesystem (less than 1 GB) it is reported the 63KByte first block missallignment is still there.

I can imagine microsoft has done this because as a result of its own virtualisation business. I donnot have the impression this allignment is some active optimum.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:D:):(:0:shock::confused:8):lol::x:P:oops::cry::evil::twisted::roll::wink::!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

Last Updated on Wednesday, 03 February 2010 20:19
 

Forum Activity

Author: Cogterrit
May.18.12
Author: Cogterrit
May.18.12
Author: Cogterrit
May.18.12
Author: Cogterrit
May.17.12

Online Stats

Guests Online: 124
Members Online: 2



We thank you for visiting TcpDump and hope you find our knowledge base articles helpful. However, we need your support!!

If you found the content on our site useful, please help support us and visit one of our sponsors sites. Your support pays for the electric, servers and bandwidth required to run TcpDump and we can’t do it without your help!

Thank you again for all your support!

Best Regards,
-Tom Hirt