Sunday, 29 June 2014

Re-align VMDK with Netapp's MBR tools

Misaligned VMDK can be a real burden on your filer and you can bet your bottom dollar that your Netapp support engineer will ask about this first when you are experiencing issues! VMFS misalignment should not be an issue as you should always create your VMFS via vCenter and this will ensure that its aligned correctly. The alignment you need to worry about is that of the partitions in your guest OS. This is not an issue with modern operating systems such as Windows 2008 and above but in my experience there is still a fair chunk of older OS around such as Windows 2003 and their partitions are misaligned by default. So if you did not bother aligning the partitions after you consolidated your old physical fleet you will now likely have a lot of misaligned I\O.

In my workplace we make extensive use of Netapp and IBM N-Series filers and they have a neat piece of software available called VSC which allows you to re-align your VMDK. It does a lot more but we might save this for another post. I will assume you have already installed the VSC software and its plugin in vCenter.


  • Go to the VSC tab in vCenter and go to the tools menu. Download the mbrtools.tar.gz file to your workstation


  • SCP the file to your ESXi host /tmp directory
  • Extract the file and copy mbralign and mbrscan to the /usr/bin directory
  • Set the permissions for both files to 555: chmod 555 mbralign
Now that we have the software in place we will need to check which of the vmdk are misaligned. This is done by making use of the mbrscan tool.

  • Change into the directory holding your VM files
  •  Check the file sizes (ls –lah). Make sure you have at least double the size of vmdk file available on the volume.
  • Run /usr/bin/mbrscan against flat.vmdk file(s). This will indicate that your VMDK is aligned or not.


Now you can continue with the alignment process itself. This is done with the mbralign tool.

  • Make sure the VM is shut down and you have removed existing snapshots. This is to avoid corruption.
  • Run /usr/bin/mbralign vmname.vmdk
  • Confirm with y
  • You will see this message indicating that the process is complete.
  • ls -la to see contents of your directory. You will notice the backup files created during this process. 
  • Remove these files: rm -rf *backup
  • Repeat this for every misaligned disk
  • Power on VM
VSC has another method for doing a batch scan for alignments. I will cover these in another post.

No comments:

Post a Comment