How to back up a running Linode server?

So you want to backup all your drive without all those nasty mistakes and also filter out all the /proc and other temporary folders?

An option is to mount the root folder onto another folder within the filesystem, like this:

$ cd /mnt
$ mkdir drive
$ mount --bind / drive

This will give you all the files there are on your drive that are not deemed temporary (like the /proc or /sys folders).

Now that you have a clean view of your root folder, you can just copy it to your backup drive using standard cp or rsync. Something along the lines of:

cp -R /mnt/drive /mnt/backupdrive

This solves both your mentioned problems:

  • You don’t get into recursion, because the backup disk is not mounted within the drive (point of view)
  • you don’t miss any important files, because you are taking them all

See also: man mount(8)

Leave a Comment