Good Things To Know When Imaging Linux To Different Hardware

Your rating: None Average: 3.2 (25 votes)

An old post, but still useful when cloning / imaging, so I tough I'd just post it here also.

Note: This should work with (open)SUSE 10 and later (as also other distro versions with slight modification).

A couple of months ago I came across a situation where I wanted to P2V a relay server from a small desktop to a VMWare ESX server. Making and restoring the image was no problem but after restoring and editing the relevant files, I thought I was on a roll until at boot up I got the message :
' waiting for /dev/sda3 to appear ...'.
Until now I had apparently been lucky enough to have a similar chipset when imaging from one system to another.

For those that might hit the same issue, here's my two cents for ya..
This can also be of use when swapping out vital components in your existing system.

After some searching I gathered the configuration files where fine but I was missing the driver for the VMWare's LSI scsi device, thus the drive was there but could not be accessed.
After more searching I found some good info on what needed modifying; the initrd file. This site was a great help. So my thanks go to the author.

Plainly said the initrd is one of the first things to get loaded , before anything else is mounted, and contains your basic drivers and file system support to get things started.

(I'm also thinking this could also be a way to include the needed drivers to deploy one image to multiple systems with different hardware - a little in the lines of sysprep. So any useful comments and suggestions are very welcome!)

~

To cut to the case, what we need:
The installation CD with the same version installed on the imaged system (in this case the openSUSE 10.2 cd or DVD)
If you don't have this, you can try with another CD that has a similar kernel version.

Files to keep in mind:
/boot/initrd (symbolic link) & /boot/initrd-[kernel version]-default
/boot/grub/menu.1st
/boot/grub/device.map
/etc/fstab
/etc/mtab
/etc/sysconfig/kernel

--Preparation--

Make an image of the original system & restore the image to the new disk/system, I would recommend keeping the same partition layout as on the original system, but it's not a must if you know how to handle that.

Now that you have your image on the new machine it's time to boot with the openSUSE install CD using the rescue mode.

--Making your new initrd--

1) Boot with the rescue mode selected on the install CD and log in with root.

2) At the command line use ' fdisk -l' to determen your partition layout
In my situation there are 3 partitions , sda1=/boot sda2=swap sda3=/

3) Now mount the partitions into /mnt

mount /dev/sda3 /mnt (this is my root / mount point)
mount /dev/sda1 /mnt/boot (this is my boot mount, and not needed if you root partition is also the boot partition)

(the next mount points are recommended to include)

mount -t proc none /mnt/proc
mount -t sysfs none /mnt/sys

Under /mnt you now have your imaged system availible

4) Change the apparent disk root directory for the current running process to /mnt. /mnt is now the /

chroot /mnt

5) Edit the files fstab, mtab, menu.1st & device.map to reflect the correct mount points and boot partitions.

6) Include the necessary drivers in /etc/sysconfig/kernel
to do this edit the section ' INITRD_MODULES="..." '

In my case I added mptspi to add support for VMWare lsi scsi. The entry then looks like this: INITRD_MODULES="processor thermal ata_piix fan reiserfs edd mptspi"

7) Now change to the boot directory, do this before running mkinitrd

cd /boot

8) Rename the current initrd file for safekeeping

mv initrd- initrd-.old

9) Run the make process to create your new initrd

mkinitrd -d /dev/sda3 (sda3 points to /)

extra modules can also be added with the -m switch (e.g: mkinitrd -d /dev/sda3 -m mptspi )
more help on options : mkinitrd -h

10) Make sure the name of the created initrd is the same as stated in the menu.1st or that the initrd link points to the new initrd file.

You can now reboot the system and if all went as planned the system now boots up and you can modify other needed components like networking and so on.

Hope you find it useful..

Network card

Any ideas on how to get the network card installed when moving to a VMWare guest?

The new nic VMWare is

The new nic VMWare is offering to your guest should automatically get detected.

Which distro and version are you using?

If you are using openSUSE, have you looked in YaST > Network Settings to see if the nic is listed?

You can also remove your old nic entry (the nic used in the previous machine) by editing /etc/udev/rules.d/70-persistent-net.rules and reboot. That should bring the new nic back as eth0.

Note for VMWare tools:

If you are using openSUSE 10.3 or earlier, install the VMWare guest tools to get a more optimal result.

openSUSE 11.0 and 11.1 contain the openVM(Ware) tools. Before installing the VMWare tools package offered by ESX, VMServer of Workstation, de-install the open vm packages.