Does Cygwin support hard links in Windows 8?

5

1

I'm working on a backup script that behaves like TimeMachine and uses RSync with --link-dest to create hardlinks to unchanged files.

If I run this on a *Nix-based system, of course it works as expected.

But now I want to use the same script with Cygwin on a Windows 8.1 computer. I know Windows 8 added a utility for users to create and modify hard and symbolic links (when run as administrator), so NTFS definitely supports hardlinks and symbolic links.

But does Cygwin know how to map the link() calls from Rsync (and other programs) to the appropriate Win32 API?

Is it as simple as running Cygwin as administrator?

Anro

Posted 2014-09-07T01:36:58.470

Reputation: 127

1

After further reading, it appears that Cygwin actually does support this. Try something like https://www.itefix.net/cwrsync and see. If you need to, you shouldn't have any trouble aliasing that.

– krowe – 2014-09-07T20:53:40.280

Cygwin supports creating and reading symbolic links, even on Windows filesystems and OS versions which don't support them. See the section called “Symbolic links” for details.

Hard links are fully supported on NTFS and NFS file systems. On FAT and other file systems which don't support hardlinks, the call returns with an error, just like on other POSIX systems.

Source:https://cygwin.com/cygwin-ug-net/highlights.html

The command on Windows is called mklink , /H creates hard link. You can test it now :)

– LukasT – 2014-12-09T13:41:19.570

@LukasT that's exactly what I was looking for! Please add that as an answer, specifically this https://cygwin.com/cygwin-ug-net/using-cygwinenv.html in the part about winsymlinks:native. I already knew about mklink on Windows, which is why I was confused that Cygwin was using its own format when my OS and FS support linking. I still had to run Cygwin as Administrator to make more than hardlinks to files (e.g. symlinks to files or folders).

– Anro – 2014-12-10T09:08:22.073

Answers

1

Cygwin supports creating and reading symbolic links, even on Windows filesystems and OS versions which don't support them. See the section called “Symbolic links” for details.

Hard links are fully supported on NTFS and NFS file systems. On FAT and other file systems which don't support hardlinks, the call returns with an error, just like on other POSIX systems.

Source: https://cygwin.com/cygwin-ug-net/highlights.html

The utility on Windows is called mklink

LukasT

Posted 2014-09-07T01:36:58.470

Reputation: 280