-a
NTFS로 올바르게 변환되지 않을 수있는 권한을 복사하여 일치시켜야합니다. 나는 단지 사용합니다 -rltD
. -a
의미합니다 -rlptgoD
.
참고 : Linux에서 EXT4와 함께 rsync를 사용하는데 HFS와 NTFS를 비교하는 방법을 모르겠습니다.
다음은 일부 폴더를 이동식 USB 디스크에 백업하는 데 사용하는 완전한 스크립트입니다. 이것은 우분투 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!
-a
편리하지만, 한 파일 시스템에서 다른 파일 시스템 (예 : EXT4에서 NTFS로)으로 동기화 할 때뿐만 아니라 대상 파일 및 디렉토리의 소유자가 아닌 경우에도 옵션이 너무 무딘 경우가 많습니다. 나는 후자의 시나리오가 발생하고 종종 두 개의 디렉토리 트리를 동등하게 만들어야 할 때 다음 조합을 사용합니다.-rvOlt --delete
(니모닉 : 반란).