gpt4 book ai didi

linux - ntfs 上的 Cygwin rsync 不会硬链接(hard link) (--link-dest) 文件

转载 作者:太空宇宙 更新时间:2023-11-04 12:49:20 28 4
gpt4 key购买 nike

在我的 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 不是硬链接(hard link)?

最佳答案

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

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

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

关于linux - ntfs 上的 Cygwin rsync 不会硬链接(hard link) (--link-dest) 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37724972/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com