SlackWay
Focus
on cloning & system disaster recovery with Slackware
Rsync is a remote
synchronization
tool. The first time, rsync sends all the data over the network to your
backup machine. Just like tar. The benefit comes the next time you
backup. Instead of sending all the files again, rsync only transfers
files that have been changed. If no files were changed, no files get
transferred. And when you want to recover data, you transfer just the
specific files that you want back to your machine (using rsync or scp
or telnet or whatever).
Why
use rsync
Rsync can be used in many ways
and is from far much better than imaging solution:
You could imagine using rsync to:
- synchronize data
- backup remote file systems
- clone your system
- preconfigured a linux desktop
- rsync to test file systems
- rsync to test kernels
......
rsync usage
rsync --force --ignore-errors --delete --delete-excluded
--exclude-from=exclude_file --backup --backup-dir=`date +%Y-%m-%d` -av
Archive
flag
Most of the time, rsync is used with -a
(archive), which
combines a number of other options:
- -r recurse into subdirectories
- -l copy symlinks as symlinks
- -p retain file permissions
- -t retain file time stamps
- -g retain group ownership
- -o retain owner
- -D preserve devices
- --backup: create backups of files before overwriting them
- --backup-dir=`date +%Y-%m-%d`: create a backup directory
for those backups which will look like this: 2002-08-15
- -av: archive mode and verbose mode.
For a full list of rsync options,
visit the rsync
page.
And here some practical information
about how a system can be secured
& restored with rsync:
Cloning a system
This clones a running linux-system (really):
rsync -v -r -p -o -g -D -t -S -l -H \
--exclude /mnt/ \
--exclude /proc/ \
--exclude /tmp/ \
--exclude /home/ / /mnt/fireball/
The target-disk is /mnt/fireball in my case.
We assume the target-disk is empty at the first time.
My home is on a another disk, so i skip it .
The options are:
--verbose
--recursive
--perms
--owner
--group
--devices
--times
--sparse
--links
--hard-links
# next time(s):
--delete
If you want to see
first what happens, add:
--dry-run
Boot from a
CD-ROM and mount the target-disk.
Fix fstab and lilo.conf. Create /mnt and /proc and set the right
permissions (for this directories).
Then run lilo and reboot.
Next time you run rsync, add these option to the command-line:
--exclude /etc/fstab \
--exclude /etc/lilo.conf \
--delete