Friday, August 03, 2012

lab in the lap adventures

To help me with practicing for a Red Hat certification exam I set up RHEL 5.6 on my laptop.  I configured up xen and was using a bunch of virtual machines, each with multiple network interfaces connected to isolated networks.  For convenience all the interfaces were configured using DHCP, this way I could build one VM and just clone it to make the other machines - during the clone the network interfaces were given different mac addresses and DHCP just handed out the static allocations for those MAC addresses.  This all worked quite smoothly, though it did take a lot of work and searching to put all the bits together and it did help me a lot in going over all the lab exercises before my exam.

I am going to do another course and exam soon but the course will be using RHEL 6.2 for the OS so I thought it would be good to update my install.  Red Hat's recommendation is that you do a clean install between major versions but I really didn't want to lose my xen configuration so I attempted to perform an upgrade instead which you can do by hitting escape within the first 60 seconds of the cdrom boot and then adding:

linux upgradeany

to the boot command line.  This forces the upgrade regardless of the version.  The upgrade seemed to work ok but the first hurdle was the process had not written a new entry in grub.conf to boot the upgraded system.  This was easy to fix, just boot up the cd in rescue mode and fix.  I then tried to get X working properly but no matter what I did I would either get a black screen or X would come up and just hang.  In the end I decided that it probably was going to take me more time to figure out what was wrong with X than it would to do a clean install and redo my VM setups.  After a clean install X worked fine, I had some problems initially with the synaptics touchpad but that was just a matter of configuring it in xorg.conf.

I had a USB stick with what I thought was a copy of the old /etc directory plus my VM build scripts and the like.  On closer inspection I found these files were a bit out of date.  I did do a dd of the entire linux disk to a file on a NetBSD machine so I knew I could get the files back... the trick was how.  I could have just put the image back onto my laptop disk but that would have been tedious, having to copy the data over, boot up the old OS, get what I wanted and then reinstall 6.2 again.  Fortunately, the NetBSD machine with the dd image on it had enough room to have rhel image uncompressed.  I though that what I could do is us vnconfig to create a virtual drive from the file like this:

vnconfig -c vnd0 ./dd_image_file

and then use lvm on NetBSD to access the logical volumes.  Unfortunately it looks like the version of the NetBSD kernel I have on that machine is too old and it had issues with lvm.  I knew that NetBSD on my laptop worked fine with lvm so what I ended up doing was NFS mounting the file system from the machine with the image (I didn't have enough room on the laptop to hold the disk image locally), then use vnconfig as above to create the virtual disk.  I then did:

lvm vgscan

which found the lvm volgroups on vnd0, I then did:

lvm vgchange -a y
mount -t ext2fs /dev/mapper/volgroup-lvol00 /mnt

an there we have it.  A disk image on one machine, nfs mounted to another, through a virtual disk driver into lvm.  It is a bit tortuous (and a bit slow due to the NFS mount going over wireless) but I can access the files and pull off what I want without having to reinstall.

When I get organised I will do a write up about the lab in the lap.

No comments: