View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Backup

From LQWiki

Jump to: navigation, search

Backups are part of a sane recovery scheme that should help recover lost data. They can be thought of anything that is done to archive important system and user data.

Contents

Backup tips

How to do it

Backup your home directory

From the command line type :

tar -cvzf myhomebackup.tar.gz ~

~ stands for your home directory. The z option packs your file in gzip format.

Then copy myhomebackup.tar.gz onto some other medium: CD, DVD, removable drive etc.

Hint: Using tar with the --newer option will allow you to save only files that have changed since your last backup. This is known as incremental backup, compare rsync.

Backup your computer

To backup your computer including all system configuration and kernel modules, but excluding everything that is mounted (e.g. /proc) use

tar -cvlf slash.tar.gz /

The l option says "local filesystems only". You need it because you do not want to backup /proc.

Backup/Sync several computers

If you have several computers (maybe because you have several flats), you can upkeep an eternal archive on USB disk that you can transport. For data security, you synchronize your USB disk with your computers then. Let's say the USB disk is mounted on /mnt/sda1 and your archive is in /root/archive. You create your archive with

rsync -e ssh -avz /root/archive /mnt/sda1

You can then show the differences between your archive on USB disk and on your computer with

rsync -e ssh -avz --delete --dry-run /mnt/sda1/archive /root/archive

And you can update your computer's archive from USB disk using

rsync -e ssh -avz /mnt/sda1/archive /root/archive

You can add the --delete option behind -avz to delete all content on the target that is not on the source.

Backup strategies

For home users

Keep a folder with files that you want to keep even if your hard disk crashes. Everytime when you do a backup, sync this folder with a USB disk. Syncing should be done based on file contents to identify corrupt files. If you have multiple computers, you can sync bidirectionally. A good choice for content-based syncing is unison.

Backup utilities

See also


Personal tools