Linux RedHat Bare Metal Restore on diffrent Server

When doing a system recovery often the things that can break your recovery procedures is having a new system that is new and completely dissimilar from the old system. This recovery procedure will walk you thru the process of  creating the backup image and image restoration. Describe the recovery problem and its fixes.

Assumptions:

I will be using RedHat ES 4 in this exercise. I will be using an NFS server to store the backup image and restore from it. You can also burn the backup image onto a CD or DVD but that this beyond the scope of this procedure. If you have a tape drive gathering dust, you can use it too.

Backup:

The first step is to prepare your server for backup.

cp /boot/grub/grub.conf /boot/grub/grub.conf.backup
cp /etc/modprobe.conf /etc/modprobe.conf.backup

These two files is the main problem is restoring linux system images to a dissimilar systems. We don’t want them to be included in our backup image.

Mount the nfs file server under the /mnt directory.

mount nfsserver:/backups /mnt

Then finally we make the backup image with the tar command.

tar –create –verbose –preserve –ignore-failed-read –gzip –exclude=/proc –exclude=/sys –exclude=/var/run –exclude=/boot/grub/grub.conf –exclude=/etc/modprobe.conf –file=/mnt/backup.image.tgz /

It’s safe to ignore these warnings:

tar: Removing leading `/’ from member names
tar: /dev/gpmctl: socket ignored
tar: /dev/log: socket ignored
tar: Removing leading `/’ from hard link targets

Restore:

Once you got your new system, you need to install the RedHat on it. You only need to install the minimum package. You will need CD 1 & 2. When asked for the package installation, choose custom. The next menu will present with the minimum option on the very bottom, check on that. This will be a quick installation. Depending on your system, my test system took about 5 minutes.

After the installation, reboot the new system. The crucial part is to check that the newly installed OS can see all your devices (NIC, RAID & DRIVES). Once you have verfied that every devices drivers is installed and working you are now ready to do the system restoration.

Mount the nfs file server under the /mnt directory.

mount nfsserver:/backups /mnt

Make a copy of the file /etc/fstab.

cp /etc/fstab /etc/fstab.backup

You are now ready to do the actual system recovery using the tar command.

tar –gunzip –extract –verbose –preserve –file=/mnt/backup.image.tgz

At this point you may reboot the system to check if it still can boot with restored images.

You need to create a new ramdisk image for your new system. Your old ramdisk images will probably not have the correct devices drivers.

mkinitrd /boot/new-initrd-2.6.9-42.0.10.ELsmp 2.6.9-42.0.10.ELsmp

Next you need to merge the files /boot/grub/grub.conf and /boot/grub/grub.conf.backup. The file /boot/grub/grub.conf is new working grub configuration file while the file /boot/grub/grub.conf.backup is old grub configuration file. The problem with old grub configuration file is that it is pointing to old lame ramdisk image, you need to change that to point to the newly created ramdisk image. You just can’t use the new working grub configuration because that is probably not configured to use the recent installed kernel.

If your old grub configuration looks like this:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux ES (2.6.9-42.0.10.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.0.10.ELsmp.img
title Red Hat Enterprise Linux ES (2.6.9-42.0.10.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.0.10.EL.img

You should change it to:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=2
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux ES (2.6.9-42.0.10.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.0.10.ELsmp.img
title Red Hat Enterprise Linux ES (2.6.9-42.0.10.EL)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.EL ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.9-42.0.10.EL.img

title Red Hat Enterprise Linux ES (2.6.9-42.0.10.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /new-initrd-2.6.9-42.0.10.ELsmp.img

Now, compare the files /etc/fstab and /etc/fstab.backup. You need to check that root and /boot files are mounted correctly and not mounted like the old system.

/etc/fstab
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
/dev/VolGroup00/LogVol01 swap swap defaults 0 0

The restoration is almost complete, the next thing to do is reboot the system. Once it boot up kudzu (Red Hat Linux hardware probing library) should be triggered. Remove all old drivers and configure newly found devices.

The last thing to configure is the network configuration. Your old NIC configuration will not work since the MAC address is hard coded on the NIC startup scripts. (see /etc/sysconfig/network-scripts/ifcfg-eth0)

You should now have fully recovered your system.

Leave a Comment

Your email address will not be published. Required fields are marked *

CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top