Categories
Linux

Show disk usage ignoring mounts

If you wish to know how much space uses some dir in Linux, you can use du -hs /some-folder. But what if you have a lot of mixed mounts in that folder and you want to know how much exactly this folder consumes at root disk storage?

The solution is quite simple. You cannot filter mounts, but you can mount root partition again, and operate with the new mount:

# Go to a quiet place and create new mount for root
cd /var/tmp
mkdir fake-root
mount /dev/sda1 fake-root
# Here /dev/sda1 is your drive, it may differ

# Do some stuff

# Then done, cleanup
umount fake-root
rmdir fake-root

Leave a Reply

Your email address will not be published. Required fields are marked *