Windows Hardlinks / Junctions

Duplicati has a advanced option (hardlink-policy) how to handle hardlinks, but this is only for Linux / OSX. What about Windows? How do I stop Duplicati from following hardlinks?

Simon

Welcome to the forum @Simon_Weel

If neither –hardlink-policy nor –symlink-policy help with hardlinks and junctions (which are soft links), then perhaps you are left with source selection and Filters (path-pattern-based ones) added in the backup job.

Note that Duplicati won’t store file content for additional views of a file. It gets entirely deduplicated away, just as would happen if an ordinary duplicate file (e.g. by ordinary copy) were made, however file change would require reading the file through to determine (for additional copies seen) there’s nothing to upload…

As a technical note, it looks like the hardlink feature is done with mono facilities that Windows .NET lacks. Third-party package AlphaFS looks like it offers somewhat similar Windows capabilities from Win32 code however using it less (not more) seems to be the desire, as things head towards convergence at .NET 5.

1 Like

Tried both policies and also tried to exclude the hard link. But without any luck so far.
Don’t know if Duplicatie tries to skip files in hard links - it doesn’t seem so? When I start a backup, it starts gathering files to back up and after several hours, it found 23 TB data on a 1 TB drive…

The hard link in question points to a folder below the hard link itself, like this:
[drive[\Folder1\Hardlink1
Hardlink1 points to Folder1, so if you use Explorer and continuously open Hardlink1, you’ll end up with [drive]\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1\Folder1.… until Explorer chokes on the path length.

NB: this weird hard link is needed for applications that store references to files using absolute paths. When I changed the location of the files, all references to the files where lost. Creating a hard link was a quick & dirty way to solve that.

Simon

How are you making these hard links? Microsoft says you can’t hard link to a directory. In line with that, I haven’t been able to get fsutil hardlink create or mklink /h to do it, even done with “Run as administrator”:

C:\tmp>fsutil hardlink create hardlink1 C:\tmp
Error:  Access is denied.

C:\tmp>mklink /h hardlink1 C:\tmp
Access is denied.

What does work is mklink /j to make a junction which is a soft link and which works OK on directories:

C:\tmp>mklink /j junction1 C:\tmp
Junction created for junction1 <<===>> C:\tmp

C:\tmp>dir
...
09/05/2019  02:42 PM    <JUNCTION>     junction1 [C:\tmp]
...
C:\tmp>

Duplicati seems to treat the soft link as a symlink, where the default –symlink-policy says to store it, thus:

2019-09-05 10:32:45 -04 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-StoreSymlink]: Storing symlink: C:\tmp\junction1\

If I change the policy to Ignore, that also works:

2019-09-05 14:25:20 -04 - [Verbose-Duplicati.Library.Main.Operation.Backup.FileEnumerationProcess-ExcludeSymlink]: Excluding symlink: C:\tmp\junction1\

I think I’m still not clear what you have, including direction. What does dir command say it is? If it’s truly a hard link then I would think you could also get fsutil to give you some info such as in test of hardlinked files:

C:\tmp>echo > hardlinkoriginal

C:\tmp>fsutil hardlink create hardlinkhardlink hardlinkoriginal
Hardlink created for C:\tmp\hardlinkhardlink <<===>> C:\tmp\hardlinkoriginal

C:\tmp>fsutil hardlink list hardlinkoriginal
\tmp\hardlinkoriginal
\tmp\hardlinkhardlink

C:\tmp>fsutil hardlink list hardlinkhardlink
\tmp\hardlinkoriginal
\tmp\hardlinkhardlink

C:\tmp>
1 Like