Incorrect number of hardlinks on network drives
Question / Problem
TreeSize shows an incorrect number of hardlinks for files that are stored on a network share. What can I do?
Answer / Solution
Starting with Windows Vista / Server 2008, Microsoft introduced "Client Caches" with the SMB2 protocol in order to speed up queries about gathering file and directory meta information on network drives. This approach also helps utilizing the available network bandwidth more efficiently. However, these caches always return an incorrect value for NTFS hardlinks (always shown as "1"). The responsible caches can be disabled with the following steps:
- Run "regedit.exe".
- Open the path "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanWorkstation\Parameters".
- Choose "New > DWORD value" in the right click menu and set the name to "FileInfoCacheLifetime" and the value to "0".
- Restart Windows
After these steps, TreeSize should work properly with hardlinks. For further information about client caches, please visit https://technet.microsoft.com/en-us/library/ff686200(WS.10).aspx.