More hardlinks

2 posts / 0 new
Last post
itefix
Offline
Last seen: 7 hours 21 min ago
Joined: 01.05.2008 - 21:33
More hardlinks

I can't seem to get the hardlinks to work in windows via --link-dest. It just refuses to find the files in the directory and make a hard link. Here's the setup. -I run 2 rsyncs from batch files called sync.bat and sync2.bat.
-I'm connected to the server via a mapped network drive, we'll call it 'z'.
-I then run the client, on the destination, once to pull the data from the server and make a base-level mirror in a directory I call "source".
-Next, I want to run the backup again and put it in a different directory called "mirror", but only hardlink the files that already exist in my base-level mirror.

Every time that I run the first backup to "source", everything works fine and all of the files are moved to the location desired. Then when I run the second backup, which is supposed to hardlink to the first one if the file already exists, it merely copies all the files and doesn't make a single hardlink.

//References
sync.bat, first backup (z is the mapped network drive,destination is #the machine I am on)
"c:\program files\cwrsync\rsync.exe" -avr --stats "/cygdrive/z/users/scott's folder/testBackup/" destination::testBigCopy

#sync2.bat second backup - should use hardlinks
"c:\program files\cwrsync\rsync.exe" -avr --stats --link-dest="/cygdrive/c/source" "/cygdrive/z/Users/Scott's Folder/testBackup/" destination::testHardLinks

#rsyncd.conf

path = /cygdrive/c/source/
read only = false
transfer logging = yes

path = /cygdrive/c/Mirror/testBackup/
read only = false
transfer logging = yes

Any ideas? I've tried nearly everything that I could think of that had even the slightest modicum of validity for a resolution. Nothing works yet.

itefix
Offline
Last seen: 7 hours 21 min ago
Joined: 01.05.2008 - 21:33
Re: More hardlinks

...I then run the client, on the destination...
...rsync.exe -avr ... "/cygdrive/z/.testBackup/" destination::testBigCopy

Something doesn't add up here. If you're running an rsync client on the destination, then why are you using remote server syntax as the target location?

I would expect the command to look like either:

rsync -a /network/path /local/path

or

rsync -a server::/path /local/path

if you are really running the rsync client on the destination. The latter will outperform the former. You loose much of the benefit of rsync if you are syncing to or from a network drive.

(By the way, the -r switch is redundant with -a.)

...rsync.exe -avr --link-dest="/cygdrive/c/source" "/cygdrive/z/.testBackup/" destination::testHardLinks

I think you have a usage problem.

--link-dest= should point to a directory containing an older copy of the data files, and it should be local to the destination machine, I believe. Logically, that makes sense, as hard links can only be created among file entries on a single file system.

Things are a bit more confused here, as you seem to be looping back and connecting to the rsync server of the machine you're on. If we assume that /cygdrive/c/source and destination::testHardLinks are both on the same system, then the problem might be that your rsyncd.conf isn't permitting access to /cygdrive/c/source. (/cygdrive/c... is an absolute path to a local drive. At minimum you probably need to use /path.)

Be aware that the --link-dest= path, if relative, is relative to the destination directory. If you get it wrong, and point to some non-existent directory, rsync silently ignores it.

To get your existing commands to work with minimal change, I would define an entry in rsyncd.conf that points to a shared parent directory of your backup and your link-dest directories. So lets say:

path = /cygdrive/c/backups
read only = false

where you're expecting to create:
c:\backups\source
c:\backups\testBackup

Then use an rsync command like:

rsync.exe -a --link-dest=source" "/cygdrive/z/.testBackup/" destination::backups/testBackup

But as above, I think this is not a good usage if this is executing on 'destination' and the source is a network drive.

More generally, lets say on your destination machine you have:

/backups/current
/backups/lastweek

you might first:

rsync -r remote-server::/source /backups/current

then a week later, you move /backups/current to /backups/lastweek, and then run:

rsync -r --link-dest=lastweek remote-server::/source /backups/current

and you should end up with hard links in /backups/current that point to files in /backups/lastweek that haven't changed.

-Tom

Topic locked