2016-06-09 88 views
0

在我的Windows 10 comp上我有ntfs分區。 Cygwin是以下版本:ntfs上的Cygwin rsync不會硬鏈接(--link-dest)文件

$ 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是不硬鏈接?

回答

0

您的問題是--link-dest中的路徑,根據man頁面這是相對於DEST目錄。 --link-dest arg does not exist: 1

改變參數--link-dest=..\1應該修復:

對應的錯誤可以在上面的跡線中可以看出。