[Windows] How do I account for hardlinks when checking disk usage?
[Windows] How do I account for hardlinks when checking disk usage?
Hi.
Im using the AMC script in --action hardlink. After it completes and does the job its intended to do (awesome), my nas reports free space including both files created by amc, essentially using twice the space even though I know it isnt. To be clear, if i download a 5GB file on a 100GB disk, the nas thinks theres only 90GB free. if someone could clarify for me id appreciate it. Thanks to rednoah for an amazing piece of software
Im using the AMC script in --action hardlink. After it completes and does the job its intended to do (awesome), my nas reports free space including both files created by amc, essentially using twice the space even though I know it isnt. To be clear, if i download a 5GB file on a 100GB disk, the nas thinks theres only 90GB free. if someone could clarify for me id appreciate it. Thanks to rednoah for an amazing piece of software
Re: Hardlink space question


Code: Select all
df -h
Code: Select all
du -h

Re: How do I account for hardlinks when checking disk usage?
I was going by what free space windows and my Nas’ interface was showing the volume has left. I will run those commands to see the breakdown but what my concern is is does windows still know that technically if I fill the drive half way will it still think it’s full because every media file has a hard link.
Re: How do I account for hardlinks when checking disk usage?
Your NAS manufacturer (Synology? QNAP? A different one?) may not have accounted for this use case well during testing.
It'll probably just work, even if some tools "double count" things and end up displaying unreasonable values. You could take some 1 GB file, and then create 10.000 hardlinks with a bash script, just to see what will happen in your specific case and software at play.
e.g.
I get 264K as total file size. Looks like du -h is even aware of sparse files. ls -lh will report lots of 1 GB files though.

e.g.
Code: Select all
# create a 1 GB file
dd if=/dev/zero of=1g.img bs=1 count=0 seek=1G
Code: Select all
# create 10k hardlinks
for i in {1..10000}; do ln -v 1g.img 1g-${i}.img; done
Code: Select all
# check total size
du -h

Re: How do I account for hardlinks when checking disk usage?
Ok I will mess around with those commands on my Asustor NAS. So lastly, in my case QBit is running on a windows machine using the Nas for storage as a mapped network drive. Shouldn’t windows understand the hard links properly? Or because they were created on a network drive would windows disregard and just report both files as equal size consumption?
Re: How do I account for hardlinks when checking disk usage?
Few Windows users use hardlinks, so most Windows applications do not account for hardlinks. I am already very surprised that creating hardlinks from a Windows client via SMB works at all. I would be 10x surprised if Windows Explorer were to account for hardlinks on a remote SMB share correctly.
Well, all you can do is create a few thousand hardlinks, and then report your findings back to us. Because we'd like to know too!
Well, all you can do is create a few thousand hardlinks, and then report your findings back to us. Because we'd like to know too!

Re: [Windows] How do I account for hardlinks when checking disk usage?
That's interesting to me because I've only ever used the script via windows this way. the script never throws a hardlink error and always completes. do you have a suggestion besides hardlink? symlink maybe? its basically just for plex purposes which i know handle symlinks very well
Re: [Windows] How do I account for hardlinks when checking disk usage?
If it doesn't error out, then it works. You can use the stat /path/to/file command on the Linux device to see if two files are the same file, i.e. same device / inode.
You'll want to stick to hardlinks cause they're indistinguishable from normal files (because normal files are hardlinks) while symlinks (i.e. files that just contain the file path to another file) probably are nothing but trouble if you create them on one machine and then use them on another.
