1

I have created a backup of my server using the following command:

tar -cvzf ~/clone.tgz --exclude ~/clone.tgz /etc /home /opt /tmp /usr /var

Then I want to restore this backup to another server (same hardware except for the hard drive, which I upgraded to a a SSD). There is already a fresh install of the same ubuntu distribution.

I first did a backup of the following files:

  • /etc/hosts
  • /etc/hostname
  • /etc/host.conf

So I run the following command :

tar -xvpzf ~/clone.tgz -C /

Once the files are restored, I restore the host files.

Everything seems fine so I reboot the server, but it won't boot. I don't have access to the server during boot since it is hosted from a remote location. All I can do is start all over again.

What might explain this problem ? Is there a file that I should not have overwritten during the restore ?

1
  • Your restore was a really bad idea :\
    – A.B.
    Oct 2, 2015 at 5:20

3 Answers 3

1

With the command tar -xvpzf ~/clone.tgz -C / you have restored all, /etc, /home, /opt, /tmp, /usr, /var.

I believe, you have more problems than a wrong UUID in your /etc/fstab.

  • The full restore of /etc, problematic
  • The full restore of /usr, bad idea
  • The full restore of /var, bad idea

also on identical machines.

My piece of advice, install the server again.

1
  • I know that I've restored all files in these directories. I have the same hardware (except for the ssd). I tried a second restore, this time with the fstab file excluded, but same problem: it did not reboot. I find it annoying that linux mixes system config files with application config files in /etc. It makes it very hard to find out what to restore :(
    – Sam
    Oct 2, 2015 at 6:52
1

What is the problem

You have a problem with grub and UUID in your /etc/fstab.

There is a line in /etc/fstab and grub.cfg like this:

..... UUID=73faad0d-2343-4f69-8103-92dbbaf40a5f .....

Each partition in Linux has unique identifier called UUID, it is assigned during partition creation. Linux use this UUID to distinguish partitions. After replacing hard drive you have to change all old UUIDs with the new ones, which can be checked by running command blkid.

What to do

You have to boot from Ubuntu Live CD and replace all old UUID to new UUID in /etc/fstab and grub.cfg. Here is another Q/A where you can find further instructions. Then update grub using this Q/A or simply install and run Boot Repair choosing Recommended Repair option.

3
  • I did not exclude the grub.cfg file, only the fstab. Maybe that could be it, I will try.
    – Sam
    Oct 2, 2015 at 6:53
  • actually grub.cfg is in the /boot/grub folder. I did not overwrite the/boot folder as it is not part of the archive. That must not be the problem then.
    – Sam
    Oct 2, 2015 at 7:37
  • @Sam you are right, if you do not restore /boot so grub is not a problem
    – c0rp
    Oct 2, 2015 at 16:28
0

I ended up doing it this way:

  • install fresh ubuntu server

  • export list of installed packages on old server: dpkg --get-selections >output-file

  • import list on new server: sudo dpkg --set-selections <output-file sudo apt-get dselect-upgrade

I just had a few users and permissions to set/create and a few application config files to copy across from the old server, but all in all it was very quick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .