Offline disk alignment using NetApp toll called mbralignment tool
In most cases offline alignment would be performed on old Linux or Solaris versions.
- make sure VM is powered of and has no snapshots
- SSH to ESX(i) box
- change patch to datastore where misaligned virtual machine is located
- alignment tools are located on /opt/ontap/santools/
- do scan of the virtual machine VMDK FLAT file to make sure is misaligned, as you can see, first disk is not aligned. Offset is 32256 /4096 = 7.875 – as you may already know, offset should be dividable by 4096
[root@server01 suse01]# /opt/ontap/santools/mbrscan suse01_1-flat.vmdk -------------------- suse01_1-flat.vmdk p1 (LLVM) lba:2048 offset:1048576 aligned:Yes -------------------- [root@server01 suse01]# /opt/ontap/santools/mbrscan suse01-flat.vmdk -------------------- suse01-flat.vmdk p1 (Linux) lba:63 offset:32256 aligned:No suse01-flat.vmdk p2 (LLVM) lba:10474380 offset:5362882560 aligned:No -------------------- [root@server01 suse01]#
- Time to align virtual machine disk, it will be SUSE 11.
[root@server01 suse01]# /opt/ontap/santools/mbralign suse01-flat.vmdk Part Type old LBA New Start LBA New End LBA Length in KB P1 83 63 64 10474381 5237158 P2 8e 10474380 10474392 178257252 83891430 NOTICE: This tool does not check for the existence of Virtual Machine snapshots or linked clones. The use of this tool on a vmdk file that has a snapshot or linked clone associated with it can result in unrecoverable data loss and/or data corruption. Are you sure that no snapshots/linked clones exist for this vmdk? (y/n)y Creating a backup of suse01.vmdk Creating a backup of ./suse01-flat.vmdk Creating a copy the Master Boot Record Working on partition P1 (2): Starting to migrate blocks from 32256 to 32768. 12801 read ops in 5 sec. 5.86% read (17.95 mB/s). 5.86% written (17.95 mB/s) Working on P2 (3): Starting to migrate blocks from 5362882560 to 5362888704. 12801 read ops in 4 sec. 99.96% read (20.01 mB/s). 99.96% written (20.01 mB/s) Working on space not in any partition: Starting to migrate blocks. 100.00 percent complete. 100.00 percent written. . Making adjustments to ./suse01-flat.vmdk. Adjusting the descriptor file. [root@server01 suse01]#
It might take a longer while, depending how fast is the storage and how big is the machine. Start VM – but it will not boot 🙂 because mbr tool change block for root partition from 63 to 64.
Recover GRUB boot loader on Linux VM – in my case SUSE 11
- Boot from ISO with SUSE 11 OS
- From boot menu choose Rescue System
- Login to rescue console as a root – without password
- Type commands as below:
grub root (hd0,0) #is comma not dot setup (hd0)
- Reboot VM
- DONE
VM should boot correctly like on the figure below. Perform scan and aligned VM shouldn’t reported any more.
In case of problem with recovering VM after alignment, you can reconfigure VM to use virtual machine backup files
[root@server01 suse01]# ll total 222977536 -rw------- 1 root root 6554112 Jul 4 00:30 suse01_1-ctk.vmdk -rw------- 1 root root 107374182400 Jul 3 11:11 suse01_1-flat.vmdk -rw------- 1 root root 582 Jul 4 00:30 suse01_1.vmdk -rw------- 1 root root 13 Jun 28 14:00 suse01-aux.xml -rw------- 1 root root 5571072 Jul 4 00:30 suse01-ctk.vmdk -rw-r--r-- 1 root root 91268061184 Jul 4 15:40 suse01-flat.vmdk -rw------- 1 root root 91268055040 Jul 3 16:19 suse01-flat.vmdk-mbralign-backup -rw------- 1 root root 8684 Jul 3 16:19 suse01.nvram -rw------- 1 root root 704 Jul 4 15:40 suse01.vmdk -rw-r--r-- 1 root root 704 Jul 4 13:38 suse01.vmdk-mbralign-backup -rw-r--r-- 1 root root 44 Jul 4 00:30 suse01.vmsd -rwxr-xr-x 1 root root 4464 Jul 4 00:30 suse01.vmx -rw-r--r-- 1 root root 262 Jun 28 16:25 suse01.vmxf -rw-r--r-- 1 root root 677857 Jun 28 15:11 vmware-0.log -rw------- 1 root root 241141 Jun 28 14:00 vmware-10.log -rw------- 1 root root 277633 Jun 28 14:00 vmware-11.log -rw------- 1 root root 171203 Jun 28 14:00 vmware-12.log -rw------- 1 root root 247059 Jun 28 14:00 vmware-13.log -rw------- 1 root root 770982 Jun 28 14:00 vmware-14.log -rw------- 1 root root 658082 Jun 28 14:00 vmware-15.log -rw-r--r-- 1 root root 1016018 Jul 3 16:19 vmware.log