ntfs上的Cygwin rsync没有硬链接(--link-dest)文件

时间:2016-06-09 11:40:51

标签: linux bash rsync

在我的Windows 10 comp上,我有ntfs分区。 Cygwin具有以下版本:

$ cygcheck --version
cygcheck (cygwin) 2.5.1
System Checker for Cygwin
Copyright (C) 1998 - 2016 Red Hat, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我创建了一个脚本文件:

#!/bin/bash

echo 'clean up current dir'

rm -R source
rm -R 1/
rm -R 2/

echo 'create source file'

mkdir source
echo "Today is a lovely day" > source/source_file.txt

echo "rsync source to the 1 folder"

rsync -aPhv source/ 1/

echo "rsync source to the 2 folder but link destination 1/"

rsync -rlt --modify-window=10 --stats -P --link-dest=1 source/ 2/

echo "disk usage"

du -b --max-depth=1

echo "ls"

ls -l 2/source_file.txt

当我运行该文件时,我得到以下输出:

$ ./link_dest_doesnt_work.bash.sh
clean up current dir
create source file
rsync source to the 1 folder
sending incremental file list
created directory 1
./
source_file.txt
             22 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)

sent 167 bytes  received 62 bytes  458.00 bytes/sec
total size is 22  speedup is 0.10
rsync source to the 2 folder but link destination 1/
sending incremental file list
created directory 2
--link-dest arg does not exist: 1
./
source_file.txt
             22 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)

Number of files: 2 (reg: 1, dir: 1)
Number of created files: 2 (reg: 1, dir: 1)
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 22 bytes
Total transferred file size: 22 bytes
Literal data: 22 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 140
Total bytes received: 100

sent 140 bytes  received 100 bytes  480.00 bytes/sec
total size is 22  speedup is 0.09
disk usage
22      ./1
22      ./2
22      ./source
0       ./source
499     .
ls
-rw-rw-r--+ 1 zoranlj Domain Users 22 Jun  9 13:37 2/source_file.txt

为什么文件2/source_file.txt没有硬链接?

1 个答案:

答案 0 :(得分:0)

您的问题是--link-dest中的路径,根据man页面相对于DEST目录。

相应的错误可以在上面的跟踪中看到:--link-dest arg does not exist: 1

将参数更改为--link-dest=..\1应修复。