I found that I needed to clone some legacy SuSE 8 Linux servers recently whilst they are scheduled for application updates,etc. So in the short term needed to reclaim the hardware they were on as it was nearly 10 years old!
I followed the standard practice of using the VMware coldclone CD and booted from it, selected the destination ESXi host and proceeded with the clone.
This all worked great, but I found that once the clone was complete the machine refused to boot and would kernel panic, even after taking the usual steps of changing the device.map, menu.lst and fstab as detailed in one of my previous blog posts, which you can find here:Virtualizing a host containing a Smart Array adapter
If you are seeing similar messages to “Kernel panic: VFS: Unable to mount root fs…. no such device /dev/sdaX” then you need to take the following steps, the reason for the error is possibly that the original initrd of the now virtual machine doesnt contain the necessary kernel module drivers for BusLogic and or LSI Logic.
To do this you need to build a new initrd on the filesystem, but you’ve got a problem here as you cant boot the filesystem, and if you boot the filesystem using the CD you still get the VFS errors.
Heres what I did:
First of all I booted into the rescue mode using the Installation CD/ISO.
This brings you to the Initial Installation boot menu. – Note: To boot from CD will probably mean changing the boot order under ‘Edit Settings’ in ESXi for the guest.
Hit ‘return’ and wait for the rescue system to load. Once it has you will see a screen like this:
The login for this is just ‘root’ with no password. After this point you will need to mount the disk containing the real filesystem using “mount /dev/sdaX /mnt “
Change directory into /mnt and edit the /mnt/boot/grub/device.map,/mnt/boot/grub/menu.lst and /mnt/etc/fstab as I mentioned earlier.
You will also need to change the /etc/sysconfig/kernel file to contain the new kernel modules that you want to include in the new initrd,so for me I changed the following line:
INITRD_MODULES=”cciss scsi_mod sd_mod cdrom ide-cd reiserfs” to
INITRD_MODULES=”BusLogic scsi_mod sd_mod cdrom ide-cd reiserfs”
If you cant see anything under /boot your partitioning layout may have been different from mine, if so use “fdisk -l /dev/sda” to give you a list of all the partitions on the virtual disk, this will help you determine what changes to make to the mount command to access the boot volume (which traditional default installs tend to make very small).
Once these changes have been made reboot the Virtual machine and wait again for the default Installation Boot CD menu to appear and choose the following.
Choose Installation (dont worry it wont do anything to the data on your cloned Vdisk) and wait for the Installation program to load.
You will see a few screens which you need to pass through to get to the next stage of the process.
Accept the EULA and then you will see the following screen:
You need to select “Boot Installed System” and click OK. Once you have done this the original system that you cloned will boot successfully, but there are a few more steps to do before you no longer need the install CD.
I should also point out the Choosing “Boot Installed System” using this approach is not the same as doing it from the initial CD system boot method. – The reason for this is that at that early stage in the boot process using the CD, it still doesnt contain the kernel drivers you need in order to boot.
Once the original filesystem has booted you have access to the mkinitrd program and all the kernel drivers you need in order to make a new initrd. Now you’ve got this far, login to the system using your original root login and password and change directory into /boot (if thats the location that you kept your initrd and vmlinuz).
next run the following command: “mkinitrd -i initrd-version -k vmlinuz-version” (where version is the full name of initrd and vmlinuz, eg:initrd-2.0.9-SMP-xxx)
This will now make a new initrd and make use of the /etc/sysconfig/kernel changes that we made earlier.
Next, you can eject the Installation CD and reboot the Virtual machine, you should now see that the Virtual machine boots with no problems!
23 September 2011