Alignment of VMware virtual machines has been an issue for quite some time. This issue exists no matter who is the storage vendor is but I will use NetApp because it is what I know. Here are some links to get you up to speed in case you don't fully understand the situation:
Link to VMWare document on alignment
Link to NetApp document on alignment
What has NetApp done about the situation? I hear that NetApp will be releasing a tool that plugs into vCenter specifically for vSphere 4.0 and vSpherei (ESXi) 4.0 shortly. In the meantime, if you are still on ESX 3.5 (or vSphere with a Service Console) there is another answer that you can use today. This will not work on ESXi since you need a service console for the tools.
Eric Forgette at NetApp created a set of tools about a year ago that has matured and found its way into the NetApp VMware Host Utilities Kit version 5.1. If you do not have this loaded on your ESX/vSphere servers and you are connecting to NetApp, go load it NOW! (A reboot is required for the settings to take affect) Most of the following is research I have conducted in conjunction with conversations directly with
Eric over at this thread on NetApp Communities.
Included in this tool are two executables, mbrscan (scans a vmdk for alignment) and mbralign (performs the alignment). The default installation location is /opt/netapp/santools.
While the readme does a good job of going over the basics, there are a number of caveats to run the tools correctly. I will go into each executable in depth but before I go down into the weeds, you need to know when NOT to run it!
You can not or do not want to use the alignment tool for the following:
- Windows 2008 Server is aligned if the machine was created as a Windows 2008 server. If the machine is upgraded from Windows Server 20003, it will not be aligned.
- Citrix Servers are not supported because they remap the c:\
- Windows Dynamic Disks are not supported and will be corrupted if an alignment is performed (but mbrscan will detect them - see below)
- Linux LVM volumes are not supported (mbrscan may NOT detect all LVM partitions)
- Windows Server 2003 non-boot disks that have been added (d:, e:, etc) will need to be remapped in Computer Management. The drive letter will be lost on alignment.
- GRUB booted Linux and Solaris will need to have GRUB reinstalled after alignment
With all that out of the way, it is a basic two step process: 1. run mbrscan, 2. run mbralign on machines as needed.
Step #1 - mbrscan
- In order for the mbrscan to give reliable results, the machine must either be powered off or have a VMware snapshot!
- I have a simple script that I put together that just takes a VMware snapshot on all machines on an ESX/vSphere host.
- I then execute mbrscan using the scan all virtual machines parameter: mbrscan --all
- After I have the scan results I need I execute another script to remove the VMware snapshots I just created for all machines on the host
- NOTE: Windows Dynamic Disks will report a partition type of: unknown - 0x42. Do Not Align These Partitions!
Step #2 - mbralign
- In order to perform an alignment, ALL VMware snapshots MUST be removed!
- In order to perform the alignment, you NEED an amount of free space equal to the size of the vmdk. mbralign will make a backup of the file as the first step. This file have an extension: -mbralign-backup.
- In order to perform the alignment, the virtual machine MUST be powered off!
- If the virtual machine has multiple vmdk's, only one can be aligned at a time!
- Execute mbralign against the vmdk - I usually get about 1-2GB per minute speed
- Boot up the virtual machine. If it works, delete the -mbralign-backup file
- On Windows systems it will ask you to reboot one more time because it detects the hard disks as new hard disks
- If it doesn't work, run mbralign again and it will detect the -mbralign-backup and ask you if you would like to restore the file. Very Nice!