hardlinks in windows

7 posts / 0 new
Last post
Anonymous
hardlinks in windows

Great software. Thanks for all your hard work.
Can rsync/cygwin handle hard links in windows xp/ntfs?

We're hoping to accomplish effecient incremental backups ala:
http://www.mikerubel.org/computers/rsync_snapshots/

Searching rsync and cygwin doc has me confused...

Thanks

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

rsync on cygwin gives following output with --version switch :
-------------------
rsync version 2.6.5 protocol version 29
Copyright (C) 1996-2005 by Andrew Tridgell and others

Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles, inplace, no IPv6, 64-bit system inums, 64-bit internal inums
-------------------

It should handle hardlinks.

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

Thanks for your response
We'll try it out, and see how it works.

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

I was indeed able to manually create incremental snapshots with hard links (on a NTFS partition), which is great!
I was however wondering: do you think it would be possible to package the rsnapshot script (along with the Cygwin Perl package then I guess) in order to automate this? I have no idea how feasible this is...

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

Yes, it is possible. You can also use perlapp, perl2exe or par to make ready-to-run executables on windows.

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

Can rsync/cygwin handle hard links in windows xp/ntfs?
It can, though it's a bit hard to prove it. None of the stock tools for viewing directories will give you any indication of when a file has hard links.

To prove that it was working I had to track down this tool:

Hlscan.exe: Hard link display tool
http://www.microsoft.com/windows2000/techinfo/reskit/tools/new/hlscan-o.asp

And sure enough, it showed that rsync's --link-dest option did create hard links on Windows XP. Unfortunately the tool doesn't run on Windows NT, so I was not able to confirm the behavior there, even though NT's flavor of NTFS also supports hard links.

Whether hard link support on Windows proves adequate for snapshots with rsync is another matter. NTFS hard links are a bit brain dead, in that modifying a file through one link will, as expected, modify the data seen via all links, but the meta data (timestamps, file size) only gets updated for the link being used in the update.

Lets day you have a file in directory d1 and another hard link to the same file in d2. Then you update the file via d2. The directory listing in d1 looks unchanged.

This could throw off rsync. Though I believe if you treat your snapshot directories as read-only (as recommended), rsync will do the right thing. (As I understand it, it never modifies a linked file - it always breaks the link and creates a new copy if the file was modified. This behavior is required in order for --link-dest to do its thing.)

...do you think it would be possible to package the rsnapshot script (along with the Cygwin Perl package...

I looked at several of the Perl and shell scripts for creating snapshots. I wasn't that impressed with them. They seemed overly complicated and used a lot of code to do what should be fairly simple.

Although I make my living as a Perl developer, and find batch scripts to be horrendously ugly, for this project I wanted to find a cmd.com batch script solution, so clients could use it without needing a Perl install. I started with a Perl script that was about a page of code, and then after refreshing my memory on some of the "extended" batch features (such as SET's ability to evaluate mathematical expressions) that were introduced in NT, I ported the script to cmd.com.

The script is still in preliminary testing and debugging, but I'll post it when it is complete.

-Tom

itefix
Offline
Last seen: 48 min 20 sec ago
Joined: 01.05.2008 - 21:33
Re: hardlinks in windows

The script is still in preliminary testing and debugging, but I'll post it when it is complete.

Tom - did this script ever get beyond preliminary testing? Could we have a look at it? It sounds like what I need to do incremental backups in a pure Windows environment.
Bart

Topic locked