在 ntfs 分区上从 linux 创建硬链接是否可行?
我发现了一个程序,可以通过硬链接实际上相同的文件来节省空间,从而在文件系统上只留下文件的一个副本,并有多个硬链接指向它。该程序称为hardlink。
这非常好,因为我终于找到了一种方法来节省备份磁盘上的空间,用于在我了解 rsync 和增量备份之前所做的旧备份。
经过如此冗长的介绍,任何读者都会想到一个问题,所以这里是:
使用硬链接来节省 ntfs 分区上的空间安全吗?硬链接当然是从 Linux 创建的,使用上面提到的硬链接程序。更准确地说,Windows(任何版本)是否能够使用已被硬链接替换的文件?
非常感谢
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.
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? The hardlinks would of course be created from Linux, using the hardlink program mentioned above. More precisely, will Windows (any version) be able to then use the files that would have been replaced by hardlinks?
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Windows 上有硬链接。它们是由 kernel32.dll 中的 CreateHardLink 系统调用创建的。至于你的硬链接程序是否可以通过远程共享工作,我不知道,但本地程序或 cygwin 的程序可以。
现在真正的问题是 Windows 程序是否能够处理它们。即使 Windows 资源管理器也无法正确计算用于硬链接的磁盘空间。
There are hardlinks on Windows. They are created by the CreateHardLink system call in kernel32.dll. As to whether your hardlink program would work over remote shares, I wouldn't know, but a native one or one from cygwin would.
Now the real question is whether or not Windows programs handle them. Even Windows Explorer fails to calculate disk space used for hardlinks correctly.
我做了一个小测试。创建硬链接(使用“ln TargetName LinkName”)会在创建时生成相同的文件,但此后文件和硬链接内容会独立更改。因此,我不鼓励在 NTFS 分区上使用基于 UNIX 的硬链接。使用 Ext4 分区(仅限 Linux)或适用于 NTFS 分区上类似于 Windows 的链接的软件(Windows 软件或可能是某些 Linux 软件,如果明确提到的话)。
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. I would therefore discourage any use of unix based hard links on an NTFS partition. 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).
我猜想程序硬链接要么会失败,因为 Windows 上不存在硬链接,要么会创建 Windows 快捷方式。
I guess that the program hardlink will either fail because hard links doesn’t exists on Windows or create Windows shortcuts.