Hard links in Windows that works on FreeNAS

Here is how you create hard links in Windows for files that are stored on your FreeNAS server. This to prevent copies of files and waste of FreeNAS space if you need to access the same file in two different folders.

Create hard links in Windows that also are true hard links in FreeNAS

  1. In Windows, download and install Link Shell Extension for Windows Explorer here.
  2. In Windows Explorer, right click a file and choose: Pick Link Source.
  3. In Windows Explorer, right klick in the directory where you want the hard link and choose: Drop As… -> Hardlink

In FreeNAS you can open a shell from the Freenas gui and go to /mnt/<dataset> and find the the “two” files (it’s acutally one file with to different names) you just created has hard links. Then run ls -l in both places and notice the 2 in the second column indicating that this file has two hard links. Also rung ls -i in both places and notice that that the files have the same so calle inode number in the first number, indicating it is the same file internally but with different names.

You have now created a hard link in Windows saving space on your FreeNAS since the file is not duplicated but actually the same file internally but with two different names. If you remove the file in one of the places it will still stay in the other location but the link number, indicated in the second column by ls -l, will be decremented.

Leave a Reply

Your email address will not be published. Required fields are marked *