Wednesday, July 20, 2011

Backup Restore Linux

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 user@serverB 
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
(serverB), 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.

No comments:

Post a Comment