UPDATE - mbralign is available from the now.netapp.com website

by forgette Former NetApp Employee on ‎2009-03-23 11:00 AM

Several people have recently inquired about the location of the mbrscan and mbralign tools.  The purpose of this document is to provide a link to each tool.

The mbrscan tool (version 1.2) is part of the VMware ESX Host Utilities version 5.0.

http://now.netapp.com/download/software/sanhost_esx/5.0R2/

The mbrscan tool (version 1.5) and the mbralign tool is part of the VMware  ESX Host Utilities version 5.1.

http://now.netapp.com/download/software/sanhost_esx/5.1/

Please take a look at the Frequently Asked Questions page for the mbralign tool for more information.

Technical Report (TR-3747) covers guest filesystem alignment and the use of these tools.  Abhinav Joshi links to a blog entry about this a in his his post.

Regards,

-Eric

----
Eric Forgette
Software Engineer
MFIT - Virtualization & Enterprise Applications BU
NetApp

Comments

Thanks for the direct link to the tool, I couldn't find it the other day.

On checking, I've just noticed that it's not actually on the main toolchest page? Or atleast I can't find it!

Cheers! A life saver of a tool!

amiller_1

Wonderful tool -- thanks for your work on this Eric.

amiller_1

For what it's worth, it's still not on the main ToolChest page (I went looking there first for it).

https://now.netapp.com/eservice/toolchest

We have tested it on a Windows VM, and it does as advertised.

Findings - a 20Gb windows partition took 22 minutes to re-align. This was using NFS storage over 1Gb network.

Things to know

  1. the VM must be off while this is run
  2. a thin provisioned VMDK becomes thick in the process.

Down time is difficult to schedule, but if you are on SIS enabled volumes, you will get your space back.

forgette Former NetApp Employee

Hi Andrew,

     Thanks for your post.  There are a few things you can do to increase your performance.  The first thing will address the thin to thick conversion as well.  There is a --sparse option that instructs the tool to create a 'thin provisioned VMDK' (regardless of source type).  This obviously results in fewer blocks being consumed, but it also increases the speed becuase the tool doesn't have to write all the zero filled blocks.  The other option you might explore is the --bs option.  This allows you to specify the size of the block that the tool works with.  You can get a list of all the options by running the tool with --help.

Hope this helps.

Thanks will give it a go next week.

Bren

Hello,

With Windows2000 and windows 2003, mbalign doesn't support "Logical partition"

Result off mbralign :
"P1 is an extedned boot record.  This is not supported"

are there a workaround ?

Thanks. Christophe

forgette Former NetApp Employee

Hi Christophe,
    There have been two versions of mbralign posted to the toolchest.  The first version is 1.2, which doesn't support EBR.  The 1.4 version was posted to the toolchest last week, however the documentation has not been updated yet.  The new version (1.40090416) will handle EBR (Logical partition).  You can tell which version you are running using the help option.

The following output is from mbralign 1.40090416:

[root@esx16 root]# mbralign --help

mbralign version 1.40090416.
Copyright 2009 NetApp

mbralign - Align MBR partition table based vmdk files to NetApp storage systems

Usage: mbralign [OPTION]... SOURCE
   or: mbralign [OPTION]... SOURCE DEST
   or: mbralign [OPTION]... SOURCE DIRECTORY
Options:
   --sparse          The resulting file will be sparse.  This option is
                      designed for NetApp NFS based datastores.
   --force           The default behavior is to skip properly aligned disks.
                      The --force option can be used to
                      override this. (Useful for migrating and making sparse).
   --bs=n            Use n as the block size (specified in kB).  n must be one
                      of (8, 16, 32, 64, 128, 1024).  The default is 8.
   --preview         Show what would be done, then exit.  No changes are made
                      to the file.
   --quiet           Only print warnings and errors (no other status is
                      printed to screen).
   --debug           Print debug comments.
   --help            Print usage.
   --thereAreNoVmSnapshots  Suppress the warning message about snapshots and

                             answer YES to the question of whether to continue.

Hope this helps,
-Eric

Eric - First off, thank you for the tool!  It has saved me a lot of time and headaches!

Since you can not use the mbralign tool on Windows Dynamic Disks and Linux LVM's, what is the best way to correct them?  I have a customer that has a bunch of both types.  I can't seem to find anything on what to do when you CAN'T use mbralign.

amiller_1

Create an aligned vmdk, copy the data into it, flip drive letters/mount points, remove old drive. Not ideal but doable with some down time....

Vizioncore's vOptimizer Pro does also handle this to a certain degree...

http://www.vizioncore.com/products/vOptimizerPro/

forgette Former NetApp Employee

Hi Aaron,

I'm glad the tool has been helpful.

Andrew is spot on.  To get the OS data, you may have to attach the misaligned vmdk file (source) and the new aligned vmdk (destination) file to a separate VM, then perform the copy.  This is because the running OS may have locked files that aren't accessible until the OS is shutdown.

I have heard that vOptimizerPro will deal with Windows Dynamic Disks, but I'm not sure about LVM.  Linux has some wonderful tools for data migration though (cp, rsync, cpio, dump/restore, dd).  The simplest to used is probably dd.  You can create a new properly aligned volume (or partition) and dd the old to the new (after umounting the old).  Then as Andrew described, you simply mount the filesystem from the new aligned  volume (or partition) onto the previous mount point.

Hope this helps,
-Eric

Thank you Eric and Andrew for your comments!  I did some testing this morning on Windows 2003 Server and I found something a little different for Dynamic disks.  No matter what I did, once it was a dynamic disk, mbrscan show it as not aligned.  Looks like the only way around this is to stand up a basic disk and then copy the data from the dynamic disk to an aligned basic disk.

I tried creating a basic disk and aligning it first.  I then converted to to a dynamic disk.  mbrscan shows it as no aligned.  Looks like vOptimizerPro (I haven't dealt withit) is the only way to align a dynamic disk.

Any thoughts?

Thank you!

I had the same issues with creating an MBR aligned disk with Dynamic disks.

It seems to be a Win2k3 issue, that when you convert a disk to Dynamic, Win2k3 automatically changes the partition.  Even if you pre-partition the device, it resets it.

Given that this is a Win2k3 behaviour, I am not sure even vOptimizerPro will fix this.  You will have to test.

forgette Former NetApp Employee

Ah, yes.  Sorry, I should have commented on this earlier.  The small amount of testing I did resulted in what you discovered.  It looks like the volume manager (Dynamic disk manager) is modifying the partition table in the MBR in both aligned and misaligned cases (probably to maintain compatibility).  In any case both msinfo32 and mbrscan are correct with regard to what the partition table says.  The mbrscan tool does not go the next step, which would be to read the dynamic disk metadata and determine the actual starting offset of the volume (Dynamic disk) and therefore the filesystem.  I'm guessing that msinfo32 is doing the same thing that mbrscan does, which is to simply report what is in the partition table.

One of our super Systems Engineers, Jason Pierson, pointed me to the dmdiag.exe tool.  This seems to be the best way to detect the alignment of a Dynamic disk.  It is a Windows executable, so you'll have to execute if from the guest operating system.  The starting sector is reported as "Rel Sec" in the "Dynamic Disk Information" section of the output.  Because this value describes disk sectors (512 bytes), any value divisible by 8 (without remainder) indicates a properly aligned volume.  If you use this tool, you should see the disk you created and aligned (durning the test you mentioned) is actually aligned even after you convert it to a Dynamic disk.

The dmdiag.exe  tool is in the Windows 2000 Resource Kit, but seems to work on win2k3 as well.  A link to the installation is provided in Microsoft knowledge base article 927229.

Good Afternoon Eric - A little more information and one or two questions for you.  I created two 2 GB partitions.  I made them both basic and then aligned one of the two.  I then converted them to dynamic.

The dmdiag tool you provided above doesn't show the information you need that I could tell.  But, the dmdiag from the XP Support Tools does provide the information.  Here is a post from a section of it:

---------- Dynamic Disk Information -----------
DiskGroup: Win2k-test2Dg1
  Group-ID: 945ac856-ebce-4108-a29e-dd3c3cd2d32d

   Sub Disk       Rel Sec  Tot Sec     Tot Size      Plex             Vol Type  Col/Ord  DevName    State 
   ========  =======  =======  ========  ====             ========  =======  =========  ======
   Disk1-01       63            4176837   4194304     Volume1-01    Simple    1/1      Harddisk1  ONLINE
   LDM-DATA  4192256  2048                                                              

   Disk2-01       64       4176837  4194305  Volume2-01  Simple    1/1  Harddisk2  ONLINE
   LDM-DATA  4192257  2048

Are you talking about dividing the Rel Sec value under the LDM-DATA line by 8 (4192256 for the first one and 4192257 for the second one)?  If so, then yes, my first volume was aligned prior to conversion and the second one was not so that would make sense.  Can you confirm that for me?

I was also wondering for Windows 2008 Server.  I hear that none of this matter anymore.  Is that correct?  Does it depend on the disk type at all?

Thanks again!!

forgette Former NetApp Employee

Sorry for the confusion.  The "Rel Sec" I was referring to is 63 for Disk1-01 and 64 for Disk2-01.

It looks like Disk1 was a default MBR starting at 31.5KB (63 * 512 = 32256 bytes) which is misaligned.  Disk2 looks like it was aligned prior to becoming "Dynamic" since it starts at 32KB (64 * 512 = 32768 bytes).

I took a short cut and suggested that if this value is divisible by 8, the alignment was correct.  The full explanation is;
Each sector is 512 bytes.
Data ONTAP/WAFL works in 4KB blocks.

So, the divide by 8 rule is based on: (4096/512 = 8).

Disk 1 is misaligned (63/8 = 7.875), while Disk 2 is properly aligned (64/8 = 8).

With regard to Windows 2008, the default offsets (depends on size) for new partitions is evenly divisible by 8.  Therefore, manual alignment is no longer required.  I'm not sure what the impact is to Dynamic disks to be honest.  In my humble opinion, once you've virtualized your server and your storage, volume managers become a lot less interesting. 

BTW:  Something to keep an eye out for; If you're using a NetApp LUN as an RDM, connected to a  Windows 2008 VM, the lun type should be Windows_2008.

Eric - Thank you!  Of course, you are correct, I was looking at the wrong ones!  Because I know one of my customers will ask, if you have a win2k3 server and upgrade it to 2k8, the partitions will still not be aligned.  Makes sense, but I wanted to test it.  It didn't matter if they were basic or dynamic.

Also, both basic and windows disks in w2k8 are aligned by default and the XP mmdiag runs on 2k8 fine.  The moral of the story is to start fresh with w2k8 if at all possible and then there is no need to worry about alignment.

Thanks again!

forgette Former NetApp Employee

Aaron,
    I'm glad to have helped.  Also, thank you!  I think this set of comments will help others as well.  I appreciate your time and effort getting to the bottom of this.
Cheers!

amiller_1

And...just a side note, what are the main reasons you've seen that people use dynamic disks inside Windows VMs?

I've generally recommended people stick with Basic Disks if at all possible.

Hey Eric - Another mbrscan question for you.  What will Linux LVM partitions look like with the tool?   I have a customer that will be doing scans on a bunch of LInux vm's and some will be standard and some may be LVM.  I know what a standard Linux output looks like.

Thank you!

forgette Former NetApp Employee

Hi Aaron - The logical volumes are likely contained in a MBR partition.  mbrscan will only report on partitions, not the individual volumes contained within it.

Hey Eric - but what will mbrscan report?  For instance, windows will do somthing like this:

win2k3-test-flat.vmdk p1 (NTFS)    lba:64    offset:32768    aligned:Yes

A Windows Dynamic Disk (which you can't align):

win2k3-upgrade_2-flat.vmdk p1 (unknown - 0x42)    lba:63    offset:32256    aligned:No

A Linux Disk:

000063-Ubuntu-Tools-flat.vmdk p1 (Linux)    lba:63    offset:32256    aligned:No
000063-Ubuntu-Tools-flat.vmdk p2 (EBR )    lba:19984860    offset:10232248320    aligned:No
000063-Ubuntu-Tools-flat.vmdk e1 (swap)    lba:19984923    offset:10232280576    aligned:No

Since you can't use mbralign on Linux LVM's, what will mbrscan report as the type?  Is there anyway to tell LVM volumes from regular volumes like you can with Windows Basic and Dynamic disks?  I want to make sure our customer isn't trying to align LVM volumes but I don't know what they will look like to warn them.

Thank you!!

forgette Former NetApp Employee

Unfortunately, it depends.  The mbrscan tool only reports what is in the partition table, it does not interrogate the partition itself.  For example : If the administrator assigned an ext3 label at the time the partition was created, then added the partition to a volume group, mbrscan will still report it as Linux (because the partition information would contain 0x83).  If the administrator created the partition durning the installation process, there is a higher likely hood that the partition would have the correct label (0x8e) and mbrscan would therefore report 'LLVM' for Linux Logical Volume Manager. 

Found a VM with a 40Gb flat vmdk file reported as GPT format by mbrscan - what is the procedure for interrogating and aligning these?

thanks

[root@esx-01 v3]# /opt/netapp/santools/mbrscan vm/*flat*
--------------------

vm/vm_2-flat.vmdk - GPT format, skipping...

Hey Eric - Are there any known issues with mbralign and Cirtix Presentation Servers?  We had a customer that wasn't able to align 3 servers this weekend.  A bunch of other servers worked great but they managed to make 3 servers non-bootable after alignment.

The error presented states that login interface DLL's can not be loaded and the servers will not boot.  I can provide screenshots if needed.  Is this because Cirtix does some funky things with the drive letters (M:\ and N:\ in this case)

Also, mbrscan reported that the partitions were basic disks and looked fine, nothing different than any of the other servers (non-Cirtix) that worked great.

Thanks!

Avoid wildcard with mbralign

I am running 1.4 (latest from HUK 5.1) and have noticed when you run:

mbralign vm123/*flat*vmdk

It will run but leave bad filenames of the form

vm123/*flat-flat.vmdk (adds a -flat)

Then the VM will not boot due to filename not found

I've been able to recover from all but one of these by manually sorting out what the tool should have done with filenames

But maybe this could be addressed in the next version of the tool

Oh, and integration with storage vmotion for zero downtime alignment too

thanks!

forgette Former NetApp Employee

Hi Aaron,

     Yes, this is a known issue.  There is mention of it on the download page for the individual tool, but I don't know if it is mentioned in the ESX Host Utilities Kit documentation.  Here is the statement:

"It has been reported that there are issues when the OS drive has been mapped to something other than C (Windows). The report explains that Citrix pro...

Cheers

forgette Former NetApp Employee

Hi Fletcher,

Good point! 
We didn't design mbralign to use wildcards, so you will get some strange results.  We have had reports of customers writing scripts that use a simple 'for loop' or the find command (with -exec) to run mbralign on all vmdk files in a directory to address this.
This is the primary reason we added the --thereAreNoVmSnapshots flag.  Of course, you'll want to verify that there are no snapshots before you use that flag. 
Thanks for the feedback!
Cheers

Eric - I never say that one before!  Thank you for the heads up!  Now I know...

Hey Eric - I have another one for you.  Have you ever seen a windows vm that loses the d: (or any drive other than c:\)?  We have a customer running a bunch of alingments and every once and awhile a d:\ will be aligned but the system will come back up without the d:\.  They will then have to go into the disk manager and reassign the d:\.  It is there, just the mapping to the drive letter is gone.

Seen this?

Thanks!

forgette Former NetApp Employee

Hi Aaron,

Yes.  Windows (I haven't tested all versions) stores the 'drive letter to filesystem' mapping in the registry.  This information takes into account the offset of the filesystem from the beginning of the drive.  So, when mbralign moves the filesystem, the mapping is lost.  The good news is that no data is lost, the filesystem is intact and simply needs to be remapped to the drive letter.  The better news is, well, stay tuned for the better news (its coming)!

Thank you Eric!!

Eric - I put together an article with everything we have discussed here and some best practices around the tool.  I wanted to get it all down somewhere before the new tools come out.  Please check it out when you can and let me know what you think:

http://blog.aarondelp.com/2009/10/netapp-mbrscan-and-mbralign-for-virtual.html

Thank you!

forgette Former NetApp Employee

Hi Aaron,

Thanks for putting that post together.  I think its a great resource.  While I can't comment on specifics, 'shortly' is probably overly optimistic with regard to a plugin.  You can however use mbralign and mbrscan on ESX 4.0.  In fact the NetApp VMware Host Utilities Kit is fully supported on ESX 4.0.
Thanks again for all your work on this!
Cheers,
-Eric

Hey Eric!  Now that VSC is out, can you tell me if the alignment tools has the same caveats that the previous tool did?  I know I need to RTFM and I will in the next few days but just wondering if there is anything you wanted to add.

Did you help with the VSC tool?

Thanks!

forgette Former NetApp Employee

The VSC has a slick way to get the binaries to the host, but they are the same binaries. 

I didn't work on the VSC directly, however our teams work very closely.

Cheers!

Should mbralign be run against the boot drive? I have read elsewhere that aligning the boot drive is not recommended and the only thing that should be aligned are data drives. Most of my VMs only have one drive the boot drive and on a few of them it is quite active so I would like to align them. The articles I have read talk about aligning the boot drive somehow screws up vss service.

forgette Former NetApp Employee

>Should mbralign be run against the boot drive?

Absolutely!  The mbralign tool was originally written to deal specifically with boot drives.  It has shown to be useful on data drives as well, however data drives can be migrated using guest based tools as well.

>I have read elsewhere that aligning the boot drive is not recommended...

IMHO, this is a poor (perhaps dated) recommendation.  The boot drive tends to have the guest virtual memory files (swap/pagefile.sys), temp directories, binaries and common libraries.  The result is that the boot drive is very likely to do enough IO (even is you split out the guest virtual memory files) to warrant alignment.

>The articles I have read talk about aligning the boot drive somehow screws up vss service.

I haven't come across anything that documents this, nor can I think of a reason the filesystem starting offset would effect vss usage.  You do want to release any snapshots (VM or VSS) before aligning, perhaps thats the issue?

Eric,

Take a look at page 3 of this document:

http://www.vmware.com/pdf/esx3_partition_align.pdf

It states "Note: aligning the boot drive in the virtual machine is neither recommended nor required. Align only the data disks in the virtual machine"

Here are a few spots where problems with aligning the boot drive are talked about. Nobody can give any first hand accounts of any problems so I am skeptical that a problem with aligning the boot drive actually exists.

http://communities.vmware.com/thread/67462;jsessionid=2911F5E66DEED87D3796BB31638ADDE4?start=30&tstart=0

http://www.mikes.eu/index.php?option=com_content&view=article&id=84:disk-alignment&catid=42:how-to&Itemid=62

Dave

Hey Dave - I have seen that in the old ESX 3 docs and I can only say that it used to be REALLY hard to align a boot drive pre-mbrscan/mbralign and this was early on when the problem was coming to light.

Take a look at my post up a few and take a look at all the known caveats.  As long as you don't run into any of them (Dynamic Disks on the boot drive being the biggest one), you will be fine.  I have personally done dozens and I my customers have done in the hundreds by now with no issues.

The really nice thing about the latest mbralign is that it takes a backup of the file so the risk is minimal.  You can always delete the aligned vmdk and go back to the unaligned vmdk if you have issues.

I likewise have never heard of an issue with the VSS services.  I'm not saying it may not happen, just that I have never seen it.

Aaron

Ok, first hand account.

The mbralign tool is good for what it was designed for, but is not a good tool for Linux systems.  It handles Windows boxes fine. Linux boxes need extra steps to re-acquire the correct disk offsets, and boot properly.  For Linix systems and Windows 2003, it is a good practice to create a 'Gold' master disk, and clone it for your boot drive.  There are good documents for various ways to handle setting the partition offset.

There is a noticable reduction in disk IO, increasing performance when using aligned disks.  Not huge, but noticable.  Like 15%, in my experience, and that can make a difference.

NOTE: Windows 2008 now starts at a 'proper' offset of 64k, which means you don't have to worry about the aligning.  That is also in the documentation in various places.  So, once users migrate off of the Windows 2003 VM, you won't have to worry as much about it.

astueve-neo - I agree with everything you are saying.  One thing I want to check, you state there is a 15% reduction in performance on aligned disks.  You mean unaligned don't you?  You should see better performance with aligned than misalgined, correct?

I did my first alignmnet with mbralign and it worked great, thanks for all who provided their expertise. I do have one other question. We have Exchange 2007 running under VMWare. We present to this server two luns from my filer via the Microsoft iSCSI initiator. These luns store the Exchange database and logs. The luns are aligned since they were created with Snapdrive but the Guest OS (which is in essence the C drive) is not. Can I just shutdown Exchange off hours and use mbralign like I would any other VM or are there special considerations? I have a SQL server that is setup in a similar fashion.

Dave

Dave - I'll defer to Eric on this one but I can't think of any reason why you would have any problems.  I have done alignments on machines that have iSCSI software LUNs, I just can't remember if any of them have been Exchange or SQL specifically.

I was typing faster than my brain there.  Let me restate that - a "15% reduction in IO" - which improved performance.

forgette Former NetApp Employee

Hi Dave,

I think you implied this, but just to be sure (and for those reading along)...  You do not need to manually align drives created using SnapDrive.  SnapDrive for Windows handles the alignment automatically.

Your plan for aligning the guest OS looks sound.  I don't know of any special considerations for either of those applications.  Keep in mind that mbralign leaves the original vmdk in the directory (just renamed).  So, if you run into anything, you can simply rename the original back.

Hope this helps,

-Eric

That is correct, I used SnapDrive to make my Luns so they should already be alligned. I used mbralign to align all of my VMs and it worked great. In the process I noticed that for a few of my VMs, the C drive was much bigger than it needed to be and in one case the C drive was too small and almost out of space. The easiest way I found to resize the C drive is to shut down the VM and use VMWare Converter. VMWare Converter has as an option to size the C drive to whatever you want. I did that work but was surprised by one thing. I had my 24 VMs aligned and then proceeded to run VMWare Converter against 5 of them. Once complete, the new VM created by VMWare Converter was not aligned. I thought that VMWare Converter would take an aligned VM and during the conversion process generate a VM that is still aligned. I ended up have to run mbralign again after the conversion process.

That is good to know!  I always wondered what would happen on a V2V of an aligned vm, now we know!  Thank you!

upgkeller

@aarondelp: You wrote: "if you have a win2k3 server and upgrade it to 2k8, the partitions will still not be aligned.". Did you found a solution for that problem?

Occasional Contributor

The solution to mis-aligned VMDK's is to use mbralign to align them.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.