Align Vmware Partitions on Live Windows Virtual Machines Using Ubuntu Without Deletion.
Windows 2003/XP P2V conversions and hastily created virtual machines have an issue with hard drive performance within VMware and some SANs. The issue is that 2003/XP, by default, organizes drive clusters around a 32k size but offsets them at the start of a drive. Vmware’s VMFS and SANs usually use large disk sectors, although, the smaller VMDK sectors are not easily divisible because of that offset at the start of the disk. This means VMware may have to read multiple chunks of data for a single cluster of data, slowing things down. To fix this, you can move the partitions on your VMDK disks over a few bits to start at a standard 64k or 128k point.
Before:
After:
Step 1 – You can check your disks with a FREE tool to see if which ones need alignment: http://read.virtualizeplanet.com/?p=366
Step 2 – Prep the virtual machine. Defrag the drive(s). Upload a copy of Ubuntu or Gparted ISO and set the host to boot off of it. NOTE: Even though this method doesn’t delete data, its a good idea to make a snapshot or backup for protection.
Step 3 – Prep a second drive to make changes to. Add a 2nd VMDK disk to the machine and make it slightly larger.
Step 4 – Boot into Ubuntu on the virtual machine.
- Run Gparted and Select the new disk and create a partition table.
- Exit Gparted and start the terminal. In the command window type
sudo parted /dev/sda(substitute your actual device) to start the command line parted editor - Create a new partition at the start of the new disk to fill in the gap to to align your partition. For example, if you want your system partition to start at sector 128, create a very small partition that takes up space from sectors 63-127. The command would be something like this:
mkpart primary 63s 127s - Quit out of parted and back into Gparted
- Highlight the partition from the old disk and choose COPY.
- PASTE the partition into the empty space on the second drive and Apply. This will take a while depending on the size of the drive
- Delete the tiny offset partition at the front of the drive and make sure the disk is set to boot.
Step 5 – Remove original drive in VMware and boot up the machine. It may run a chkdisk at boot, but you’ll see the change in drive size and double check work with step 1.
Step 6 - Remove and delete old drives only after you are sure you need them.
Thanks to: Aligning Windows Partitions Without Losing Data – From the Recliner…. for providing the initial starting point for this post.



Leave a Reply