I have a home server running Ubuntu 14.04.3 LTS with an ext4
file system, to which I regularly backup data from various devices.
Now I have set-up an external USB HDD with ZFS
file system and would like to backup all of the data from the home server onto that USB drive. And since I am using ZFS
on the external drive, I would also want to use ZFS
's snapshot abilities.
Because I would be copying files from ext4
to ZFS
, I cannot use the zfs send
command. Therefore I am stuck with rsync
.
I have been using rsync
for a while, so I am quite familiar with it. But, since I will be performing snapshots on the target file system, I want to waste as little space as possible.
I came across this blog post which uses the following command:
/usr/bin/rsync -axH --no-whole-file --inplace --delete / /$backup_target/root/
Aside from the usual flags like -a
, -x
, and --delete
it also uses:
-H
(hard links),--no-whole-file
(force enable delta-xfer algorithm), and--inplace
(update folder instead of making a new backup).
My question: are those flags sufficient or should I add or remove some?
The backup flow will be as follows:
- Backup with rsync to the same directory every time
- Create snapshot of that directory using
zfs snapshot backup@'date +%Y%m%d'
I am guessing that --inplace
is a must (because of backuping to the same directory every time). Same probably goes for --no-whole-file
since it only copies changed block of data. But what about -H
? Any other flags I should add?
-aAHX --delete --numeric-ids --relative --delete-excluded
plus some--exclude
parameters. You may want to have a look at that parameter set as a starting point. Using-x
may or may not be appropriate depending on how your file systems are set up.-x
doesn't make much sense. I also don't use ACL's in fstab so-A
is probably not useful as well. I also don't need--relative
and will add--delete-excluded
if I exclude anything. On the other hand,-X
and--numeric-ids
look useful, so I will probably use them. Would you agree that--inplace
and--no-whole-file
are also good to use?-x
is probably what you want (unless you want to copy the backup target directory into itself... recursively.)x
then. I have been using it all the time, but wasn't aware that it prevents recursive copying :) If you wish, you can put everything into an answer, so I can reward you.