为什么第一个 rsync 命令可以完美地使用硬链接创建/tmp/data 到 /tmp/bak的克隆,而第二个命令通过复制字节而不是硬链接来创建克隆?
rsync -a --link-dest=/tmp/data /tmp/data/ /tmp/bak/ # HARDLINKS
rsync -a -R --link-dest=/tmp/data /tmp/data/ /tmp/bak/ # REGULAR COPIES
测试/重现的步骤
cd /tmp/
rm -rf data bak
mkdir data bak
echo foo > data/foo
stat /tmp/data/foo | grep Inode
rsync -a --link-dest=/tmp/data /tmp/data/ /tmp/bak/
stat /tmp/bak/foo | grep Inode
### Note that the inode is the same as above.
rm bak/*
rsync -a -R --link-dest=/tmp/data /tmp/data/ /tmp/bak/
stat /tmp/bak/tmp/data/foo | grep Inode
### Note that the inode is different.