Server Fault is a question and answer site for system and network administrators. 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

I switched a few weeks ago from a dedicated server to a VPS. Now that everything is working well on the VPS I would like to shutdown the dedicated server and close my account with the hosting company.

For peace of mind and in order to be more safe I would like to do a full backup of the server before stopping it.

The best would be a backup that I could browse if I find that I need a something in the backup.

What would be the best solution from command line?

Update :

Medium : Network

share|improve this question
up vote 19 down vote accepted

The best tool to use for this is probably dump, which is a standard linux tool and will give you the whole filesystem. I would do something like this:

/sbin/dump -0uan -f - / | gzip -2 | ssh -c blowfish dd of=/backup/server-full-backup-`date '+%d-%B-%Y'`.dump.gz

This will do a file system dump of / (make sure you don't need to dump any other mounts!), compress it with gzip and ssh it to a remote server (, storing it in /backup/. If you later need to browse the backup you use restore:

restore -i

Another option, if you don't have access to dump is to use tar and do something like

tar -zcvpf /backup/full-backup-`date '+%d-%B-%Y'`.tar.gz --directory / --exclude=mnt --exclude=proc --exclude=tmp .

But tar does not handle changes in the file system as well.

share|improve this answer
this dump command takes care of installed programs also right? like nginx, etc.. – Thale Dec 23 '13 at 8:47
Dump is a literal copy of the filesystem, with everything in there. As long as you don't have more than one (check by running mount) that's all you need. – Bill Weiss Nov 16 '14 at 0:46

If you want to backup from Linux to Linux I wouldn’t use dump, because it’s inconvenient when you need to access something inside the backup file. Just using rsync over SSH to do a full system backup should be fine in most cases:

rsync -aAXv --delete-after --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /* user@server:backup-folder

This will keep everything important and let you browse the backup without additional steps.

share|improve this answer

I use the command described above from pehrs, but modified for ftp use. Crontab sample:

30 3 1 * * sudo /sbin/dump -0uan -f server-full-backup-root-`date '+%d-%B-%Y'`.dump / && gzip -1 /<path_to_backup_file>/server-full-backup-root-`date '+%d-%B-%Y'`.dump
50 * * * * lftp -f upload.x

upload.x contains ftp credentials and rules for upload:

open -u user,password -p 21
mirror -c -e -R /<path_to_backup_folder> /<path_to_remote_folder_without_trailing_slash>
share|improve this answer

What medium are you going to be storing the backup on? If you're backing up over the network I would sshfs/nfs mount my destination on the source server and run something like:

tar cvjf /<remote_mnt>/<point>/source-030810-full.tar.bz2 /* --exclude=/proc --exclude=/dev --exclude=/sys --exclude=/tmp --exclude=/<remote_mnt>

Note that has not been tested, just my general thinking you may want to exclude more or less than that.

share|improve this answer

have you heard of Bacula?

Bacula is a set of Open Source, enterprise ready, computer programs that permit you (or the system administrator) to manage backup, recovery, and verification of computer data across a network of computers of different kinds. Bacula is relatively easy to use and efficient, while offering many advanced storage management features that make it easy to find and recover lost or damaged files. In technical terms, it is an Open Source, enterprise ready, network based backup program.

share|improve this answer

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.