How can I make a directory in Linux show up as a mount point so users can see it with df?
Technically this is possible with
mount --bind /realdir /newdir. That will give you a
/newdir dummy mount of /realdir. However
df will detect that as a “dummy” filesystem, so users would need to run
df -a (or
df -ha) or
df -h /newdir to see it, and since it’s not an actual separate filesystem, the usage reported by df is the same as the usage for the filesystem the directory is in.
Maybe it would be better to teach your users to use
du -hs, which will get the used space in a directory.
It’s very strange, but filesystem-level usage simply cannot be accurately reported for a sub-directory of a filesystem due to it being possible for a file to have multiple hardlinks, due to open files continuing to use space when they are removed (until they are closed), and other seemingly strange things about the unix/linux filesystem model.
If you mean you want to create a filesystem and mount it at a directory, you need to understand what’s going on with the underlying storage to do that.
Source : Link , Question Author : user173176 , Answer Author : freiheit