Sometimes it is pertinent to take a mondo backup from a running physical system and do a restore to a virtual machine. The virtual machine could be vmware, virtualbox etc. The test unit in this case was an IBM x3650M4 physical server (Running Redhat 6.4 64-bit Enterprise Edition). The mondo software is available here.
In my case, an install of mondo was performed using RPM’s (should be available via YUM as well). Once installed, a backup was performed (utilizing exclude’s to NOT backup certain directory structures) which saved everything into one ISO file.
Mondo Restore Prep steps
Note: The VM is setup with a SCSI disk controller
- transfer ISO file to the Windows box
- Associate the ISO with the esxi VM
- Boot from the ISO…. at main mondo boot screen, type:
expert [ENTER]
Create PVs, VGs, LVs
- fdisk /dev/sda
- Create Primary sda1 Linux starting from block 1025, and make it 512MB.
- Create primary sda2 from 1088 to end of disk. Change type to of partition 2 to 8e (Linux LVM).
- Hit a, primary 1, to make SDA1 have the bootable flag set.
Next create the PV, VG and LVs:
pvcreate /dev/sda2
vgcreate rootvg /dev/sda2
lvcreate -L 7G -n lvroot rootvg
lvcreate -L 1G -n lvtmp rootvg
lvcreate -L 5G -n lvswap rootvg
lvcreate -L 30G -n lvvar rootvg
Now you need to format them:
for i in lvroot lvtmp lvvar ; do mkfs.ext3 /dev/mapper/rootvg-$i ; done
mkfs.ext3 /dev/sda1
Next, start ‘mondorestore’ by typing it at the command-line, then choose “Interactive”, and choose “CD-R disks” as where to read from.
Editing montlist:
- remove all entries except ones for root, boot, var, tmp and swap.
- edit boot so device points to /dev/sda1 then click OK
- Are you sure you want to save your mountlist and Continue ? Yes
- Do you want to erase and partition your hard drives ? No
- Do you want to format your hard drives ? No
- Do you want me to restore all of your data ? Yes
After a few minutes the data will be restored, and the large files will be re-assembled.
- You will now edit multipath.conf (Just exit out of that screen, w/o making any changes)
- Initialize the boot loader ? yes (because we are going from Physical to Virtual, or hardware is changing)
- You will now be able to re-generate your initrd… Do you need to do it ? Yes
mkinitrd -f -v --with=mptspi /boot/initrd-`uname -r`.img `uname -r`
exit
The –with=mptspi is the name of the LSI Logic Disk controller. W/O that, the system won’t boot and will go into a “Kernel Panic”.
- Did you change the mountlist or cloned the system ? Yes
- Boot device: Please confirm/enter the boot device. if in doubt, try /dev/hda — change it to /dev/sda1 and click OK
- The mountlist was changed. You will now edit fstab, mtab, device.map and menu.lst/grub.cfg in order to fix grub install. Click OK.
- in /etc/fstab … remove all ir-relevant entries (leaving / /boot /tmp /var and swap)… ensure /boot is pointing to /dev/sda1. Also, update it from LABEL=/boot to /dev/sda1
- Do similar for /etc/mtab
- For /boot/grub/menu.lst –> ensure boot device is hd0,0
- For /boot/grub/device.map –> update (hd0) to /dev/sda1
- Grub is now installed correctly, click OK
- Label/Identify your ext2/ext3/ext4 partitions if necessary ? No
At the VM window, unload the ISO, then type: reboot [enter]