You are hereBlogs / Kurt's blog / Using Mondorescue to P2V old versions of Linux - Part 5 P2V Fedora Core 9

Using Mondorescue to P2V old versions of Linux - Part 5 P2V Fedora Core 9


Below is the fifth part of our articles on Mondo being used to P2V various versions of Linux.

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 = FC9
Selinux is in enforcing mode
LVM is in use
Swap is via LVM
Hardware is Dell PE1950
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 for each partition (e2label /dev/sda1, /dev/sda2, etc)
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
In our example we had some issues with /etc/udev/rules.d/70-persistent-net.rules forcing eth0 to be renumbered as eth2 due to change in MAC address and driver. So we had to use the following boot string
expert ipconf=eth2:dhcp
we did get some inconsistent results with this so you may have to rm /etc/udev/rules.d/70-persistent-net.rules and reboot to get it to boot successfully. I am not sure why this works as the file is located on the CD which does retain changes

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/sda: 146.1 GB, 146163105792 bytes
255 heads, 63 sectors/track, 17769 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

Device Boot Start End Blocks Id System
/dev/sda1 * 1 21 168651 de Dell Utility
/dev/sda2 22 283 2104515 c W95 FAT32 (LBA)
/dev/sda3 284 308 200812+ 83 Linux
/dev/sda4 309 17769 140255482+ 5 Extended
/dev/sda5 309 17769 140255451 8e Linux LVM

Disk /dev/dm-0: 141.4 GB, 141499039744 bytes
255 heads, 63 sectors/track, 17202 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2080 MB, 2080374784 bytes
255 heads, 63 sectors/track, 252 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x30307800

Disk /dev/dm-1 doesn't contain a valid partition table
We need to re create a similar layout
fdisk /dev/sda
select n
primary
partition 1
first cylinder is 1
last cylinder is 2
select n
primary
partition 2
first cylinder is 3
last cylinder is 4
select n
primary
partition 3
first cylinder is 5
last cylinder is +2G
select n
extended
first cylinder is 267 (default)
last cylinder 1566 (default)
select n
first cylinder is 267 (default)
last cylinder 1566 (default)
set the active partition
a
3
Configure the partition types
t
1
de
t
2
b
t
5
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/sda5
y
lvm vgscan
lvm vgcreate vg_testhost –l 0 –p 0 –s 32m /dev/sda5
lvm vgchange -a y VolGroup00
lvm lvcreate -L 10240m –r auto –n LogVol00 VolGroup00
lvm lvcreate –L 1800m –r auto –n LogVol00 VolGroup00
mkfs –t ext3 /dev/VolGroup00/LogVol00
mkswap –c /dev/VolGroup00/LogVol01
mkfs –t ext3 /dev/sda3

Commence the Mondorestore

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 initiliaze 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
change the line referencing /boot from using a UUID to /dev/sda3 (The UUID mapping did not work correctly in our test server) wq to exit
remove the lines 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 3 (in this case)
Adjust the timeout parameter to 5 or 10 seconds (our example it was set to 0)
Save and quit
Leave device.map as default
Select n to label partitions (this setup did not use disk labels)
e2label /dev/sda3 /boot
Type reboot to restart the server
Post recovery changes

Allow the server to boot, you will see a few error messages and will 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
vi /etc/udev/rules.d/70-persistent-net.rules
rem out all the lines that are active as these are persistent mappings based on MAC address
cd /etc/sysconfig/network-scripts
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

Call Us Today

Logo

Icon - Phone 1300 760 452
Icon - Online On Line Enquiry
Icon - Email Info At Swarm-logic.com
Icon - Home 12/1 Elizabeth Plaza, North Sydney