Bare Metal Linux Restore

Several weeks ago we started seeing some pretty scary errors showing up on the main system disk for our Blackboard server. We had an extra server hanging around, so we decided to move all the data off the failing disk and onto our spare server. The only question was how to make the new server as close to a perfect copy of the old one as possible. Simply restoring all the filesystems failed for a variety of reasons, mostly related to GRUB and the kernel, so I had to find a way of excluding only the files and directories that were tied to the specific model of server.

To do this, I started by installing a minimal copy of RHEL 4, making sure to lay the filesystems out in exactly the same way as they were on the old server. I then went through several experiments, leaving just the bare minimum files and directories required for the hardware and booting, but formatting all other filesystems and restoring the data from our old server. In the end, the below process resulted in system that worked perfectly, and very closely mirrored the original server.

  • I conducted a minimal OS install on the new server, replicating the filesystem layout on the old server.
  • I booted the new server from DVD in rescue mode, allowing it to mount the filesystems in /mnt/sysimage
  • I removed EVERYTHING in every filesystem and directory EXCEPT the following:
  • Everything in /sys
  • Everything in /dev
  • Everything in /proc
  • Everything in /boot
  • /lib/modules
  • /etc/grub.conf
  • /etc/sysconficg/grub
  • /etc/modules.conf
  • /etc/fstab

Next, I went to my backups and restored the entire system to /mnt/sysimage, making sure not to overwrite existing files. We use NetBackup, which defaults to not overwrite, but other systems are not so careful. If you accidentally overwrite the files we excluded from deletion above, your restored system will not boot.

Once the restore was complete, I rebooted the system and it came up pretty much as a carbon copy of the old server. Once it was up and on the network, I ran “up2date -uf” to install the latest version of the kernel and I was done.

13 thoughts on “Bare Metal Linux Restore

  1. Hi!
    I am going to wordcamp on Saturday, and during Wordcamp, I am going to be leading online wordgames on different people’s blogs.
    They will be silly, fun, low tech games using wordpress blogs.
    Would you like to host a game on your blog?
    Each game takes 15 minutes, and you would need to be able to post the game, and keep track of comments that 15 minutes while you are at wordcamp.
    Go to http://www.bodyabcs.com/bwp/word-games/ to read more about it.

    Much Love,
    dk

  2. Hi,
    You say : I removed EVERYTHING in every filesystem and directory EXCEPT the following : everything in /sys …

    Do you mean you erase from /mnt/sysimage the content of /sys and if so did you got rid of the directory also or do you mean you maked it to not be restore from the backup?

    Thank you for your help

    André

  3. Hi Andre,

    No, /sys, and everything in it needs to remain, or in your case, /mnt/sysimage/sys. The reason for this is that we do not install a new kernel when doing a bare metal restore. We allow the kernel from the bare-bones install to remain, and upgrade it later using up2date or yum. When you do your restore, make sure that you do not overwrite existing files because you will run into problems with grub if you install your old kernel from backup.

  4. I am using Amanda open source. And I have restored the data to a NFS mount on Amanda Server, bu I am not able to mount it to the machine I am trying to restore. do you have any other suggestions?

  5. I am using Amanda open source. And I have restored the data to a NFS mount on Amanda Server, bu I am not able to mount it to the machine I am trying to restore. do you have any other suggestions?

  6. Really interesting post. I am in a similar situation with testing recovery for RHEL 5.

    What did you need to do to get Netbackup to be able to restore to the /mnt/sysimage? DId you have to re-install the client etc? Did you have to chroot?

    Thanks very much.

    Regards,
    Simon Stanford

  7. I am in a very similar situation cliff but how did you do the netbackup restore via the recovery boot without a netbackup client running on it???

  8. I did exactly as you say with a CentOS 5 install and when i reboot out of the recovery mode and into the bare min. as you instructed i get a kernel panic so i can’t install the netbackup client.

  9. Do you have a second disk you can boot from while you do this work? It works best if you can boot from disk with a bare minimum OS + netbackup on it and then work on your actual boot environment.

  10. Also, the instructions may be different for RHEL 5. I’m doing mostly Solaris administration these days, so I haven’t worried about Linux much lately.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>