You are hereBlogs / Kurt's blog / Using Mondorescue to P2V old versions of Linux - Part 8 P2V Fedora Core 6
Using Mondorescue to P2V old versions of Linux - Part 8 P2V Fedora Core 6
Below is the eighth part of our articles on Mondo being used to P2V various versions of Linux. This is the final part of this series
The details of the P2V process for newer operating systems are well documented here;
http://www.mondorescue.org/docs/p2v.pdf
Read that first. It goes through in a lot of detail the process. Our articles focus on OS specific issues.
The basic process for all of these P2V's is in the above. OS Specific issues and a high level process are below. NB these were specific to the hardware and installation configuration that we had to work with, it will not necessarily cover all situations.
We are assuming the following
Mondo used for backups as per
http://www.mondorescue.org/docs/p2v.pdf
and
http://www.swarm-logic.com/content/using-mondorescue-p2v-old-versions-li...
Source OS = FC6
Selinux is in permissive mode
LVM is in use
Swap is via LVM
Hard disk labelling (e2label) is used
Hardware is dell GX 240
Modify /usr/sbin/mindi to ensure the MPT (LSI Logic) drivers are included in the mindi boot disks
Locate the force_mods line and change it to include;
FORCE_MODS=”mptsas mptspi”
Confirm if mptscsi drive is in initrd
zcat /boot/initrd-`uname -r`.img | cpio -itv | grep mpt
if missing
mkinitrd --with=mptspi /boot/initrd-`uname –r`-virt.img `uname –r`
vi /etc/grub.conf
Copy the default entry (usually 4 or 5 lines) and change the initrd line to use the image you created above (basically kernel version-virt.img)
Run a mondo backup
mondoarchive -OV -n nfs://IPADDRESS:vol/VOLUME -d testhost/mondo/2011-08-22 -N -0 -s 4480m –p testhost_2011-08-22
This is derived from the mondobackup.sh script backing up to an NFS store
Copy /var/cache/mindi/mondorescue.iso to a location you can mount the ISO into vmware
Confirm if the OS is 32 or 64 bit.
uname –r
uname –m
If it contains i386, i586 or i686 its likely to be 32 bit, if it contains 64 mentioned anywhere its likely to be 64 bit
Grab the output of the following commands
fdisk -l
mount
df -h
swapon -s
pvscan
e2label /dev/hda1 and for each other partition
ifconfig
The output of these should be saved to a text file somewhere accessible during the restore
Create the VM
We are using Vmware ESX4i managed via VCentre for our virtualisation platform.
Login to virtual centre with appropriate privileges
Locate the data centre/cluster to create the new VM
Right click and select new VM
Select custom
Click next
Enter the name as appropriate (testhost in this case)
Select the appropriate datastore and click next
Leave the VM version at 7 and click next
Set the operating system to be linux
Set the version to be other 2.6x Linux (32 bit), click next
Set the number of virtual processors as appropriate
Set the RAM as appropriate
Set the NIC as appropriate and the network VLAN as appropriate. Leave the adaptor type as e1000, click next
Leave the SCSI controller as LSI logic Parallel
Select create a new virtual disk
Configure the disk as appropriate, click next. NB this need’s to have about 5GB free to allow mondo to continue working
Leave the advanced options as default, click next
Confirm the hardware layout is as expected and click finish
Once the VM is created edit the VM properties
Select the options tab
Select boot options and tick the force BIOS setup option (this is to allow us to attach to the mondo rescue iso
Click OK
Open a console for the VM and then power on the machine, is should boot straight into BIOS
Attach the CD rom to the mondorescue.iso that you have copied over earlier
Select exit discarding changes in the BIOS screen
The iso should then boot to a boot: prompt
Commence mondo restore
At the boot: prompt enter the following;
expert ipconf=eth0:dhcp
This will start the restore process using DHCP for address allocation (otherwise pass the IP parameters as appropriate). If you don’t pass the ipconf parameters it will boot on the IP address of the host you backed up. If the physical host is online this will cause issues
Allow to boot to the mondorestore menu
If for some reason the boot hangs on adding usb devices for storage you can use the nousb boot option as well
expert ipconf=eth0:dhcp nousb
This should boot to a # prompt
Restore disk partitions
To commence the recovery we first need to create the basic hard drive partitions, in this case our physical host was a dell box with a few extra partitions. We create a dummy entry for these extra partitions so the device numbers in the restore line up
For reference here is the original (physical) disk layout
Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 4865 38973690 8e Linux LVM
Disk /dev/dm-0 doesn't contain a valid partition table
Disk /dev/dm-1: 5536 MB, 5536481280 bytes
255 heads, 63 sectors/track, 673 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
We need to re create a similar layout
fdisk /dev/sda
select n
primary
partition 1
first cylinder is 1
last cylinder is +100M
select n
primary
partition 2
first cylinder is default
last cylinder is default
set the active partition
a
1
Configure the partition types
t
1
de
t
2
8e
w to save the configuration
Restore LVM configuration
cat /tmp/i-want-my-lvm to obtain the commands to restore the LVM configuration
These are generally pretty close to what is required, you may need to resize the partitions if you are changing your disk layout. In this case swap is also managed by LVM so we format using mkswap
lvm vgchange –an
lvm pvcreate –ff /dev/sda2
y
lvm vgscan
lvm vgcreate VolGroup00–l 0 –p 0 –s 32m /dev/sda2
lvm vgchan ge -a y VolGroup00
lvm lvcreate -L 18000m –r auto –n LogVol00 VolGroup00
lvm lvcreate –L 2048m –r auto –n LogVol01 VolGroup00
mkfs –t ext3 /dev/VolGroup00/LogVol00
mkswap –c /dev/VolGroup00/LogVol01
mkfs –t ext3 /dev/sda1
e2label /dev/sda1 /boot
Commence the Mondorestore
As we are going from ide to scsi edit /tmp/mountlist.txt and change all instances of /dev/hd* to /dev/sd*.
This will allow the mondorestore to mount the correct (new) partitions
Enter mondorestore at the command prompt
Select interactively
Net mount
Leave the network protocol as default
Leave the network share as default
Leave the directory as default
Leave the prefix as default
Leave the mountlist as default and click OK
Select yes on the warning the mountlist might not work
Select no on erase and partition hard drives
Select no to formatting hard drives
Select yes to restore all data
Allow the restore to complete
You are then prompted to edit multipath.conf
Save the file
You are then prompted to initialize the boot loader, select yes
Select n to initialise initrd , this is not required
Select yes to modify/clone system
Leave the boot device as /dev/sda
You are then prompted to edit fstab and a few other files
modify fstab
remove the line that mention lvm as a mountpoint
Leave mtab as default
For gub.conf you need to make a couple of changes
Change the default from 0 to 1
Adjust the timeout parameter to 5 or 10 seconds (our example it was set to 0)
For our boot setup remove the rhgb option as it masks our service startup messages
Save and quit
Leave device.map as default
Select n to label partitions this is done via command line
Type reboot to restart the server
Post recovery changes
Due to the change from IDE to SCSI controllers the boot block (MBR) requires some tweaking to allow a successful boot.
In this case we resolved it by the following;
1) Boot Mondorescue CD in expert mode
2) Vi /tmp/mountlist.txt and change all occurrences of /dev/hdX to /dev/sdX
3) Remove the line that is attempting to mount to the lvm directory
4) Save the file
5) mount-me (this will mount all of the disk partitions
6) chroot /mnt/RESTORING
7) /sbin/grub
8) root (hd0,0)
9) setup (hd0)
10) quit
The above steps should recreate the MBR and allow the server to boot to the grub boot screen
Allow the server to boot, you will see a few error messages and may not be able to login due to selinux however you should boot successfully to a login prompt
Ctrl-alt-insert to restart
Once the server displays the grub boot screen press any key to stop the boot process, it should be attempting to boot the –virt image you created earlier
Select e to edit the commands
Arrow down the line starting with kernel
e to edit
Add autorelabel at the end of the command line to boot single user mode
Press enter
Press b to boot
It should then start auto relabelling the file system
Allow it to finish, reboot and log back in
Check the output of swapon –s , df –h, mount and fdisk match what you are expecting
cd /etc/sysconfig/network-scripts
in our case the correct ifcfg-eth0 was copied to ifcfg-eth0.bak and the ifcfg-eth0 set to use DHCP. We fix this by copying ifcfg-eth0.bak to eth0.cfg and overwriting the existing file
vi ifcfg-eth0 and remove the line with HWADDR, this removes the hard coding of the MAC address and will fix itself on reboot
Reboot the server and all should be OK