How can I make a directory in Linux show up as a mount point so users can see it with df?
-
4Mount something there. – Michael Hampton May 09 '13 at 22:11
-
How? I have a folder I'd like to mount to another folder and have it show up with df -h – user173176 May 09 '13 at 22:13
-
3Speak to your manager about getting some education on the tools you're using - you need it desperately. – user9517 May 09 '13 at 22:30
1 Answers
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.

- 14,544
- 1
- 47
- 69