linuxstoragelocal-storagemount

Size of hidden folders under mount points


I am trying to guess the disk used on a linux system. The problem is that with commands like 'du -kxa / |sort -g' I see there is less space used than the filesystem reports (8Gb from a partition of 19Gb). I suspect that there are hidden files and folders under several mount points. I can't unmount the disks because is a production machine and it can't be stopped easily.

The question is:

On linux how can I get the folders and files hidden under a mount point? Is there any way to measure this space?

Linux version: Redhat enterprise linux server 5.3.


Solution

  • This is one thing bind mounts are useful for. Assuming I have two separate file systems /usr, and /usr/local, you can do this to see if /usr/local is hiding anything:

    mkdir /tmp/usr
    mount --bind /usr /tmp/usr
    ls /tmp/usr/local
    # clean up if necessary
    umount /tmp/usr
    rmdir /tmp/usr