Print this page

Move linux system drive from one server to another

 

How to move a linux system drive from one physical server

to another without
reinstalling the operating system

A situation arose where it was necessary to move hard drives from one server to another in hope it would prevent the rebuilding and reconfiguration of a new OS. The reason for the move was to upgrade to "bigger and better" hardware. The scenario was Fedora Core1 (FC1) was installed on one 18GB scsi drive in a Gateway 935c rackmount server. A second drive was used in this server but only for backup purposes. The second drive really has no bearing on the overall process. The goal was to move the FC1 install to a Gateway 955c rackmount server.

Initially, the system drive from the 935c was used as the sole drive on the 955c. Comparison of hardware differences was ignored as it was of interest to see how FC1 would handle the hardware change. After inserting the system drive from the 935c into the 955c and booting, it was quickly learned that the process wasn't just a simple drive replacement. A kernel panic occurred that indicated the / partion couldn't be mounted. The 955c was then booted into rescue mode from boot disks, and the FC1 install could be successfully mounted. This indicated that the problem was most likely with drivers that are required to access the hard drives at boot time.

The Fix

The fix is rather simple. With the FC1 system drive inserted into the 955c, boot into rescue mode from boot disks. Once booted, the FC1 install being mounted under /mnt/sysimage, chroot to /mnt/sysimage by running the following command:

Server>chroot /mnt/sysimage

Now, run kudzu. Kudzu is the hardware detection component in FC1 and will do the magic for this process.

Server>kudzu

Kudzu should detect the hardware differences and will prompt to remove old hardware configurations and it will promt to add new hardware configurations. In the case of the 935c and 955c, the most crucial difference was the scsi controllers...they were different.

After kudzu is finished, the last thing that needs to be done is to recreate the initrd file. The initrd file is where necessary drivers are bundled and made available to the kernel at boot time before the hard drive and its partitions can be mounted. The kernel in use on the current FC1 install was 2.4.22-1.2174.nptl. To recreate the initrd file (you may have to remove or rename any pre-existing initrd file of the same name), cd to /boot and run the following command:

Server>mkinitrd initrd-2.4.22-1.2174.nptl.img 2.4.22-1.2174.nptl

If all goes well, reboot and the system will boot like usual.