Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Running version 12.04, with Virtualmin/Webmin.

I tried to remove all unnecessary linux-image files today, since the /boot partition was full. I followed a guide from Ask Ubuntu, but that resulted in a broken Grub, or something, probably because the command in the suggested guide removed more than it should have.

After several hours I finally managed to install a new kernel image, and created a new Grub, but then I found out that all files in the directory /run were deleted and probably several other files/directories, that were related to those packages in that directory. I don't know how that could've happened, but I knew there was something strange already when I booted into the Recovery Mode, since I couldn't find any link to the symlink /etc/resolv.conf --> /run/resolvconf/resolv.conf.

Anyway: I have a complete backup of my filesystem, that was made today with the rsync command (sudo rsync -ahe ssh ..., options: --delete --exclude=.gvfs --exclude=/proc --exclude=/dev --exclude=/sys) .

I tried to restore just the /run directory, without any luck.

My question is then: can I just replace all files on my server, with the files on my backup-location, with the same rsync command? (Yes, I know I have to swap "source" and "destination" in the command)

In case that it is possible, is there anything else I should do afterwards?

share|improve this question
What Ask Ubuntu question/answer did you read? – edwin Aug 8 '13 at 22:51
All of them gave me diffenrent answers so I felt that i got confused. Haven't restored a backup like this before, so I'm trying to do it as carefully as possible. Leaving for my vecation in about 5-6 hours, so this is something I really would like to fix before I leave. Since my backup was made when all packages was installed, and a fully functional setup, then I assume that using this sudo rsync -ahe ssh /BUpArchive root:host/mnt --delete --exclude=.gvfs --exclude=/proc --exclude=/dev --exclude=/sys is the correct one to restore. My filesystem is mounted at /mnt in Recovery OS. – Joachim Aug 8 '13 at 23:49
And I'm wondering if I need to configure Grub again? Or should everything be «good to go», after the filesystem is unmounted from the Recovery OS, and serverer is rebooted? Another problem is that this server is located approx 3,214 km away from me, so all of this is doen in Terminal, through SSH. – Joachim Aug 8 '13 at 23:53

First, my compliments on having a current backup -- you've hit the 90th percentile of diligence right there. Now to proceed, I would do this:

  1. Boot from the install CD into the Live Ubuntu envrironment (or if using a server CD, choose the Repair option.)
  2. Open a shell window
  3. Mount the root drive to /mnt, e.g.

    sudo mount /dev/sda1 /mnt
  4. Create a second mountpoint, /mnt2 and mount the backup drive to that.

    sudo mkdir /mnt2
    sudo mount /dev/sdb1 /mnt2
  5. Now restore like this

    for DIR in bin boot etc home lib lib64 opt root run sbin usr var; do
      sudo rsync -aH --delete /mnt2/$DIR /mnt

    All of the directories I skipped, dev, sysfs, tmp, etc. should basically be empty.

  6. Once the restore completes, try chrooting to /mnt and updating grub.

    for DIR in dev proc sys; do
       sudo mount --bind /$DIR /mnt/$DIR
    sudo chroot /mnt
  7. Restart

If this doesn't work, then it's time to reinstall and just restore your /home directory & any data files you want.

share|improve this answer
I needed to reinstall. Not able to restore from backup this easy. So now I'm backing up with Duplicity, and hoping for a better success next time everything crashes :) – Joachim Jun 26 '14 at 14:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.