Question

I am creating a bash script to backup my files with rsync.

Backups all come from a single directory. I only want new or modified files to be backed up.

Currently, I am telling rsync to backup the dir, and to check the files compared to the last backup.

The way I am doing this is

THE_TIME=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aP --link-dest=/Backup/Current /usr/home/user/backup /Backup/Backup-$THE_TIME
rm -f /Backup/Current
ln -s /Backup/Backup-$THE_TIME /Backup/Current

I am pretty sure I have the syntax correct for this. Each backup will check against the "Current" folder, and upload only as necesary. It will then delete the Current folder, and re-create the symlink to the newest backup it just did.

I am getting an error when I run the script:

rsync: link "/Backup/Backup-2010-08-04-12:21:15/dgs1200series_manual_310.pdf"

=> /Backup/Current/dgs1200series_manual_310.pdf failed: Operation not supported (45)

The host OS is running HFS filesystem, which supports hard linking. I am trying to figure out if something else is not supporting this, or if I have a problem in my code.

Thanks for any help

Edit:

I am able to create a hard link on my local machine. I am also able to create a hard link on the remote server (when logged in locally) I am NOT able to create a hard link on the remote server when mounted via afp. Even if both files exist on the server.

I am guessing this is a limitation of afp.

Was it helpful?

Solution

Two things from the man page stand out that are worth checking:

If file's aren't linking, double-check their attributes. Also check if some attributes are getting forced outside of rsync's control, such a mount option that squishes root to a single user, or mounts a removable drive with generic ownership (such as OS X's “Ignore ownership on this volume” option).

and

Note that rsync versions prior to 2.6.1 had a bug that could prevent --link-dest from working properly for a non-super-user when -o was specified (or implied by -a). You can work-around this bug by avoiding the -o option when sending to an old rsync.

Do you have the "ignore ownership" option turned on? What version of rsync do you have?

Also, have you tried manually creating a similar hardlink using ln at the command line?

OTHER TIPS

Just in case your command line is only an example: Be sure to always specify the link-dest directory with an absolute pathname! That’s something which took me quite some time to figure out …

I don't know if this is the same issue, but I know that rsync can't sync a file when the destination is a FAT32 partition and the filename has a ":" (colon) in it. [The source filesystem is ext3, and the destination is FAT32]

Try reconfiguring the date command so that it doesn't use a colon and see if that makes a difference.

e.g.

THE_TIME=`date "+%Y-%m-%dT%H_%_%S"`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top