简体   繁体   English

在 ntfs 分区上从 linux 创建硬链接是否可行?

[英]Is creating hardlinks from linux on a ntfs partition viable?

I have found a program that can make you save space by hardlinking files that are actually the same, thus leaving only one copy of the file on the file system with more than one hardlink pointing to it.我找到了一个程序,它可以通过硬链接实际上相同的文件来节省空间,从而在文件系统上只留下一个文件副本,并且有多个硬链接指向它。 The program is called hardlink .该程序称为硬链接

This is very nice as I have at last found a way to save space on my backup disk for old backups I have made before I knew about rsync and incremental backups.这非常好,因为我终于找到了一种方法,可以为我在了解 rsync 和增量备份之前所做的旧备份节省备份磁盘上的空间。

After such a lengthy introduction, any reader would expect a question, so here it is:经过如此冗长的介绍,任何读者都会期待一个问题,所以这里是:

Would it be safe to use hardlinks to save space on a ntfs partition?使用硬链接来节省 ntfs 分区上的空间是否安全? The hardlinks would of course be created from Linux, using the hardlink program mentioned above.硬链接当然是从 Linux 创建的,使用上面提到的硬链接程序。 More precisely, will Windows (any version) be able to then use the files that would have been replaced by hardlinks?更准确地说,Windows(任何版本)是否能够使用已被硬链接替换的文件?

Many thanks非常感谢

There are hardlinks on Windows. Windows 上有硬链接。 They are created by the CreateHardLink system call in kernel32.dll.它们由 kernel32.dll 中的 CreateHardLink 系统调用创建。 As to whether your hardlink program would work over remote shares, I wouldn't know, but a native one or one from cygwin would.至于您的硬链接程序是否可以在远程共享上运行,我不知道,但是本地程序或来自 cygwin 的程序可以。

Now the real question is whether or not Windows programs handle them.现在真正的问题是 Windows 程序是否处理它们。 Even Windows Explorer fails to calculate disk space used for hardlinks correctly.甚至 Windows 资源管理器也无法正确计算用于硬链接的磁盘空间。

I did a small test.我做了一个小测试。 Creating a hardlink (using 'ln TargetName LinkName') yields the same file at creation time, but after that the file and the hardlink content change independently.创建硬链接(使用“ln TargetName LinkName”)在创建时生成相同的文件,但之后文件和硬链接内容独立更改。 I would therefore discourage any use of unix based hard links on an NTFS partition.因此,我不鼓励在 NTFS 分区上使用任何基于 Unix 的硬链接。 Use either an Ext4 partition (linux only) or software adapted for windows-like links on NTFS partitioning (windows software or perhaps some linux software if explicitly mentioned).使用 Ext4 分区(仅限 linux)或适用于 NTFS 分区上类似 windows 的链接的软件(windows 软件或一些 linux 软件,如果明确提及)。

我猜程序硬链接要么会失败,因为 Windows 上不存在硬链接,要么会创建 Windows 快捷方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM