Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm having a problem with rsync.

I'm on a Mac and I'd like to sync my everyday's changes from my HFS+ partition to my NTFS formated networked drive.

Pretty simple, and everything goes well except that it syncs every file each times.

Here's my script:

#! /bin/sh

snapshot_dir=/Volumes/USB_Storage/Backups
snapshot_id=`date +%Y%m%d%H%M`

/usr/bin/rsync -a \
  --verbose \
  --delete --delete-excluded \
  --human-readable --progress \
  --one-file-system \
  --partial \
  --modify-window=1 \
  --exclude-from=.backup_excludes \
  --link-dest ../current \
  /Users/tommybergeron/Desktop/Brainpad \
  $snapshot_dir/in-progress

cd $snapshot_dir
rm -rf $snapshot_id
mv in-progress $snapshot_id
rm -f current
ln -s $snapshot_id $snapshot_dir/current

Could someone help me out please? I've been searching for like two hours and I still am clueless.

Thanks so much.

share|improve this question

2 Answers 2

-a implies that rights that may not translate correctly to NTFS are to be copied and matched. I use only -rltD. -a implies -rlptgoD.

Note: I use rsync from linux with EXT4, and I don't know how HFS compares to NTFS.

Here is a complete script I use to backup some of my folders to removable USB-disc. This works fine in 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!

Sample output from a run:

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!
share|improve this answer
    
+1 The -a option, while convenient, is often too blunt, not only when syncing from one file system to another (eg, EXT4 to NTFS), but also whenever you are not the owner of the target files and directories. I encounter the latter scenario at work, and often use the following combination when I need to make two directory trees equivalent: -rvOlt --delete (mnemonic: Revolt). –  FMc Dec 29 '10 at 14:57

A simple thing to check that has bitten my shiny metal ass more than once: make sure that the system clocks in the both computers are set to same time.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.