Fixing misalignment without moving data

Fixing misaligned partitions

It’s quite an old topic, but I recently found a great tool which allows you to re-align partitions without the need to manually move data from the misaligned disk to a new aligned disk.

First of all I must add that all the credits go to Nicholas Weaver, since he wrote the original blog and the actual tool!

The following text is copied straight from Nicks blog:

For those they don’t know, alignment with Virtual Machine disks on top of Storage Arrays has been a performance issue for a long time. I won’t go into long detail explaining the problem or the benefits to alignment. There are great posts by Duncan (http://www.yellow-bricks.com/2010/04/08/aligning-your-vms-virtual-harddisks/) and Kevin(http://www.blueshiftblog.com/?p=300) on what the issues are and some of the tools available.

Features:

  • Allows for fast alignment checking of virtual machines with detailed logging.
  • Can perform alignment to any offset you want. Even the crazy ones that you shouldn’t choose.
  • Works with both Windows 2000/XP/2003/2008 (NTFS) and Linux Distros (EXT2/EXT3/EXT4).
  • Is able to work on NTFS boot drives perfectly. It does this by rewriting NTFS Metadata (the right way).
  • Auto detects Windows 2008 and Windows 7 native installs (alignment not needed). Will not touch a System Reserved Partition (important for Windows 2008).
  • Preserves all Windows drive mapping (AFAIK only one to do so). This means no having to remap drive letters and complete support for non “C:”  system drives with some Windows builds (some Citrix stuff).
  • Doesn’t trash the NTFS and Boot mirrors like other tools.
  • Handles Primary and Extended partitions like it is no big deal on both Windows and Linux.
  • Has the ability to handle multiple disks for a VM.
  • Multiple disks + Multiple Partitions + Multiple types (primary, logical) + Multiple file systems (NTFS, EXT#) =  no problem
  • Also allows for optional Space Reclamation on both NTFS and Ext! That’s right: you can choose to do space reclamation at the same time as an alignment or as a option to itself. This means you can retrieve space no longer used on Thin VM’s using UBERAlign.
  • Operational model allows for completely CONCURRENCY with processing VMs. You can run up to 6 simultaneous jobs per Console and as many Consoles as your VCenter can handle. This was designed to allow people with big environments to process through a large set of VM’s.
  • Options to check, align, or reclaim any choice of disks in a VM.
  • Powerful very simple to use graphic console and easy to deploy OVA’s.
  • Orchestration for batch operations allowing you to process groups of VM’s with just a couple clicks.
  • Getting started is simple with just entering VCenter credentials/IP and pointing at a vAligner.
  • Space Reclamation should also help with possibly speeding up defragmentation of some NTFS file systems after. Your mileage may vary.
  • Space Reclamation can help you turn a thick VM into a thin one and actually get the space back!
  • Does all operations IN-PLACE! My first big goal was this. No more having to copy disks using the ESX command line(especially since ESX is going away). This will process a VM’s disks in-place.
  • Automatically makes a snapshot before running for failback. If you turn on your VM to check it and see anything you don’t like you can simply revert to the UBERAlign snapshot and be right back. (You should always have a backup and test also, see prereqs)
  • Automatically rolls the snapshots back if it sees an error. UBERAlign has the ability to do health check throughout the jobs and if it sees something wrong it will roll back it’s own snapshots for you.
  • Automatically enables CHKDSK scanning on each NTFS volume on the next boot.
  • Completely Storage Array agnostic. That’s right: if it connects to vSphere and host storage UBERAlign will work with it. This includes local disks (see prereqs below) and arrays other than EMC. Don’t say that the EMC vSpecialists don’t love all VMware users.
  • Completed tested against vSphere 4.1 / 5 environments.

So as you can see UBERAlign got to be a bit of a beast along the way.

2UBERAlign comes in two pieces. The UBERAlign Console which is a graphical interface meant to be run on a Windows XP/7/Server system with .Net 4.0 or greater. And the UBERAlign vAligner vAppliance which is deployed from OVA into a vSphere environment. The console connect to the vSphere via SOAP and to up to 6 vAligners via REST interface. The way it works is: each vAligner can process VM’s on the storage the vSphere Host it lives on has access to. So you should spread vAligners across clusters and make sure one is on any vSphere Host that has local storage you want to access.

These features are meant to make the life of a VMware admin much easier when taking on this kind of task. But, let me cover some prereqs and how-to information.

Prerequisites/Tips/Caveats:

  • All VM’s must be turned off to run any operation on.
  • Console has been tested on Windows 7 SP1 and Windows 2008 R2. You need the very latest .Net 4.0 updates also.
  • As said above: only VM’s powered off and residing on storage visible to an attached vAligner will be selectable. You don’t have to restart the console but it may take up to 60 seconds for you to see a newly turned off VM.
  • Only vAligners managed by the VCenter you connected will be useable. One VCenter per console.
  • Concurrency is based on the VM level. Which means each vAligner can handle and process through different VMs. But, a single VM with multiple disks will not be split across multiple vAligners. They will process in a linear fashion one at a time.
  • If UBERAlign detects an error on a VM disk when a previous disk was processed it will revert the previous jobs also. This is because snapshots are handled at a VM-level.
  • When doing multi-disk Windows VM’s it is recommended to align them all and to use the same offset. When the System disk is processed it assumes all the disks will be done and at the same offset. You don’t HAVE to do this but you may have to remap drive letters otherwise (not a huge deal, just annoying).
  • In order for Space Reclamation to work you must boot VM (check that it is healthy), delete all snapshots, svMotion to a different datastore while specifying that you want it thin (important). Another option is to clone the existing VM from a power off state to a new VM on another datastore while 1specifying Thin for the disk format.
  • By default *Natively* installed Windows 2008 and Windows 7 installs don’t need alignment. Upgrades from Windows 2003 do. But Space Reclamation works on all of them.
  • Space Reclamation does make alignment jobs take about 15-20% longer. It all depends on the speed of the storage underneath.
  • You need to have at least 20% free space on any NTFS volume to safely align/reclaim. This can be less on a very large volume but is a safe rule to follow. If you have to, expand a drive to make a little extra room. The alignment check reports information you can use to check.
  • vAligners currently pick up a DHCP address. You can view what the address has become by looking at the info pane in VCenter. Or you can set an IP manually. The vAligners are running Ubuntu and the login is root/UBERAlign.
  • I have tested the console over WAN (Texas –> North Carolina) and it works very well.
  • LVM’s are NOT supported. Long story but #1 the test cases for this are crazy and difficult to QA and #2 technically LVM gives you its own options.
  • UBERAlign is aware of how much storage space is used/available within a datastore. It keeps track and will not start jobs if there is a possibility it could cause an out of space error.

*DISCLAIMER*
Ok, before I go any further I want to mention one important thing. UBERAlign is an experimental tool and carries no support from EMC Corporation or myself (Nicholas Weaver). It is being released in beta state and while it does have functions that allow for failback you should only perform operations on Virtual Machines for which you have a solid backup. Also, I recommend you test in your lab thoroughly to make sure you understand it fully. You accept full responsibility when you use this tool.
*DISCLAIMER*

And now for the downloads:
(New links are HTTP, no more FTP issues)

UBERAlign Console 1.1 – FTP

UBERAlign vAligner OVA (~500 MB) – FTP

Nick took some time to finish this project, but I think he did a great job.

Would you like to comment on this post?

This site uses Akismet to reduce spam. Learn how your comment data is processed.