-a
подразумевает, что права, которые могут неправильно переводиться в NTFS, должны быть скопированы и сопоставлены. Я использую только -rltD
. -a
подразумевает -rlptgoD
.
Примечание: я использую rsync из linux с EXT4, и я не знаю, как HFS сравнивается с NTFS.
Вот полный скрипт, который я использую для резервного копирования некоторых моих папок на съемный USB-диск. Это прекрасно работает в Ubuntu 10.4
#!/bin/bash
# Rotated backup from EXT4 to removable NTFS-disc using rsync.
# Four generations are saved and automatically purged each run.
# Generations: current, backups/old, backups/older, backups/oldest.
# This script is stored on and run from the root of the removable disc
# where the backups are stored. Destination paths in the rsync commands
# are relative to current working directory below.
# Purge oldest backup
rm -rf backups/oldest
# Prepare recieving folder.
mkdir inprogress
# Grab new contents. Use rsync to create hard links to files already backed up on media.
# Note: --link-dest is set relative to dest.
# Note: Since we copy from EXT4 to NTFS we can't use -a. Rights are different in NTFS.
# If we tried then rsync would copy every file, since rights don't match.
# I use -rltD instead of -a. Care must be taken when restoring files!
echo "Backup of Musik is updated with changes since last backup"
rsync -rltD --verbose --modify-window=1 --delete \
--link-dest=../../current/Musik \
/home/anders/Musik/ \
inprogress/Musik
echo "Backup of tv is updated with changes since last backup"
rsync -rltD --verbose --modify-window=1 --delete \
--link-dest=../../current/tv \
/home/anders/Video/tv/ \
inprogress/tv
echo "Backup of Calibre Library is updated with changes since last backup"
rsync -rltD --verbose --modify-window=1 --delete \
--link-dest="../../current/Calibre Library" \
"/home/anders/Calibre Library/" \
"inprogress/Calibre Library"
# Rotate the backups
# mkdir backups (only needed first run)
mv backups/older backups/oldest
mv backups/old backups/older
mv current backups/old
mv inprogress current
echo Done!
Пример вывода из прогона:
anders@anders-desktop:/media/Samsung S2$ ./refresh.sh
Backup of Musik is updated with changes since last backup
sending incremental file list
./
Artists/
Various Artists/
sent 1787165 bytes received 3256 bytes 102309.77 bytes/sec
total size is 230838013393 speedup is 128929.46
Backup of tv is updated with changes since last backup
sending incremental file list
./
sent 7558 bytes received 35 bytes 5062.00 bytes/sec
total size is 64808873338 speedup is 8535344.84
Backup of Calibre Library is updated with changes since last backup
sending incremental file list
./
sent 227427 bytes received 1883 bytes 91724.00 bytes/sec
total size is 825094709 speedup is 3598.16
Done!