--link-dest on a local filesystem
Jaco Kroon
jaco at kroon.co.za
Thu Mar 8 18:56:54 GMT 2007
Hi guys,
I've been struggling with getting --link-dest working for a couple of
hours now. I'm using rsync 2.6.9 (protocol 29), on Gentoo Linux.
For some strange reason, whenever I recreate the source file, even
though it's identical to the old source file --link-dest simply does not
create the link. Point in case (starting from a blank directory tmp in
my home directory):
jkroon at pug ~/tmp $ mkdir a
jkroon at pug ~/tmp $ echo foo > a/tmp
jkroon at pug ~/tmp $ rsync -va --link-dest=../b.1 a/ b.0/
building file list ... done
created directory b.0
./
tmp
sent 142 bytes received 48 bytes 380.00 bytes/sec
total size is 4 speedup is 0.02
jkroon at pug ~/tmp $ rm a/tmp
jkroon at pug ~/tmp $ echo foo > a/tmp
jkroon at pug ~/tmp $ mv b.0 b.1
jkroon at pug ~/tmp $ rsync -va --link-dest=../b.1 a/ b.0/
building file list ... done
created directory b.0
./
tmp
sent 143 bytes received 49 bytes 384.00 bytes/sec
total size is 4 speedup is 0.02
jkroon at pug ~/tmp $ md5sum b.*/tmp
d3b07384d113edec49eaa6238ad5ff00 b.0/tmp
d3b07384d113edec49eaa6238ad5ff00 b.1/tmp
jkroon at pug ~/tmp $ stat b.*/tmp
File: `b.0/tmp'
Size: 4 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 183267 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1001/ jkroon) Gid: ( 100/ users)
Access: 2007-03-08 20:50:31.000000000 +0200
Modify: 2007-03-08 20:50:24.000000000 +0200
Change: 2007-03-08 20:50:31.000000000 +0200
File: `b.1/tmp'
Size: 4 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 183111 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1001/ jkroon) Gid: ( 100/ users)
Access: 2007-03-08 20:50:12.000000000 +0200
Modify: 2007-03-08 20:49:51.000000000 +0200
Change: 2007-03-08 20:50:12.000000000 +0200
Ok, so perhaps the -a which includes --times mucks things up, so add
--no-times:
jkroon at pug ~/tmp $ rm -rf *
jkroon at pug ~/tmp $ mkdir a
jkroon at pug ~/tmp $ echo foo > a/tmp
jkroon at pug ~/tmp $ rsync -va --no-times --link-dest=../b.1 a/ b.0/
building file list ... done
created directory b.0
./
tmp
sent 142 bytes received 48 bytes 380.00 bytes/sec
total size is 4 speedup is 0.02
jkroon at pug ~/tmp $ rm a/tmp
jkroon at pug ~/tmp $ echo foo > a/tmp
jkroon at pug ~/tmp $ mv b.0 b.1
jkroon at pug ~/tmp $ rsync -va --no-times --link-dest=../b.1 a/ b.0/
building file list ... done
created directory b.0
./
tmp
sent 143 bytes received 49 bytes 384.00 bytes/sec
total size is 4 speedup is 0.02
jkroon at pug ~/tmp $ md5sum b.*/tmp
d3b07384d113edec49eaa6238ad5ff00 b.0/tmp
d3b07384d113edec49eaa6238ad5ff00 b.1/tmp
jkroon at pug ~/tmp $ stat b.*/tmp
File: `b.0/tmp'
Size: 4 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 183267 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1001/ jkroon) Gid: ( 100/ users)
Access: 2007-03-08 20:53:03.000000000 +0200
Modify: 2007-03-08 20:53:03.000000000 +0200
Change: 2007-03-08 20:53:03.000000000 +0200
File: `b.1/tmp'
Size: 4 Blocks: 8 IO Block: 4096 regular file
Device: 306h/774d Inode: 183111 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1001/ jkroon) Gid: ( 100/ users)
Access: 2007-03-08 20:52:51.000000000 +0200
Modify: 2007-03-08 20:52:51.000000000 +0200
Change: 2007-03-08 20:52:51.000000000 +0200
jkroon at pug ~/tmp $
Still no hard link ... If someone could just explain to me why this
behaviour happens, and if it can be avoided, it would be much appreciated.
Jaco
More information about the rsync
mailing list