Can FFS recognize and sync hardlinks as hardlinks?

Get help for specific problems
tracync
Posts: 8
Joined: 25 Nov 2018

Post by tracync • 12 Feb 2019, 03:06

I checked this old post and the ones linked to there, as well as a couple others that mention hardlinks, but their concerns seem more about softlinks...

viewtopic.php?t=4902

In this post the user mentions how hardlinked files will be synced to the new location as two copies of the same file.

Is there a way to get FFS to recognize and sync hardlinked files as hardlinked files?

bgstack15
Posts: 61
Joined: 7 Jan 2018

Post by bgstack15 • 21 Feb 2019, 02:00

Hm, I'm no programmer, but it sounds that with some additional steps it could be done. I suspect that if a table were generated of all the inodes in the transaction, the program could check to see if any inode is repeated. Then, on the changed side, the files that match the duplicate-inode files could be the duplicate hardlinks. The functionality is not in the program that I'm aware of, but it sounds like a great question.

Outside of FreeFileSync, one could investigate solutions that reduce space used by doing a scan and hardlink replacement.

tracync
Posts: 8
Joined: 25 Nov 2018

Post by tracync • 13 Mar 2019, 00:51

Yeah there are apps that save space that way. I use Duplicate Cleaner by DigitalVolcano, which is actually why I had this question. When I deduplicate a drive by introducing hardlinks, and then use FFS to back it up to another location, I'd like to have it actually mirrored by having hardlinks be hardlinks, thus saving the same amount of space at the destination. The way it is now, it appears that any time a hardlink is created, the same deduplication operation would have to be done twice...on the source and then at the destination.

bofh
Posts: 6
Joined: 13 Mar 2019

Post by bofh • 14 Mar 2019, 06:31

since I also use hardlinks routinely, keeping them is very important for me.

Is there any alternative to FreeFileSync copying hardlinks?

ILoveFFS
Posts: 2
Joined: 14 May 2019

Post by ILoveFFS • 14 May 2019, 17:49

(First, I would like to thank zenju for his wonderful app!)

As you all mentioned, FFS does not propagate hardlinks. But what happens if the hardlinks have been created on both side BEFORE syncing ?
... I made the test with a result which surprised me :

Test description :
NTFS Volume on left side : 2 files hardlinked together
NTFS Volume on right side : 2 files hardlinked together, same relative paths same names as in left volume
Then I synced, and then checked the hardlink structure (fsutil hardlink list command)

Result :
I was anticipating that the hardlink structure would be preserved... Why ? Because I thought that the sync operation would operate sequentially - file by file - using the underlying Windows copy process (I even checked that to be sure : if I manually copy/paste each file from left volume to the right volume, Windows preserves the hardlink structure).

But guess what ! After FFS sync, HARDLINK STRUCTURE WAS NOT PRESERVED ! FFS broke it : the 2 target files were not hardlinked anymore. It might seem very odd..

Can someone reproduce this test ?
Can Zenju tell us if the underlying FFS copy process is so different that a classic Windows copy operation ?

ILoveFFS
Posts: 2
Joined: 14 May 2019

Post by ILoveFFS • 14 May 2019, 18:36

(Addendum to my Post)
For the purpose of clarity I omitted to mention that my sync test actually went through a NAS (real test was : NTFS <-> NAS <-> NTFS) but in my opinion IT SHOULD NOT change the point I make : I checked that a manual copy/paste of files from NAS to NTFS do preserve the hardlink structure in the target NTFS volume, while FFS sync does not.

bofh
Posts: 6
Joined: 13 Mar 2019

Post by bofh • 15 May 2019, 06:02

did FFS indicate the files as changed?

Could it be that you made different hardlinked pairs on both sides, e.g. different file date, being copied then by the sync process?

I also tested existing hardlinks:
1. Create a file
2. Sync it
3. Manually Hardlink it on both sides to the same path
4. Sync again => no differences reported, no action.

But as soon as you change the files, FFS will consider them as different and copy all instances, breaking the hardlinks of course.

If you need hardlinks to be copied, have a look at syncovery / superflexible (commercial, starting at 35EUR). Tons of options. It also seems to handle folder renames. But FFS looks much better.