Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
92
rated 0 times [  92] [ 0]  / answers: 1 / hits: 102346  / 1 Year ago, wed, january 25, 2023, 8:02:34

Ubuntu is complaining that my root file system is nearly full, but when I use baobab (aka "Disk Usage Analyser") or du -h it summarises the usage of all the other mounted file systems as well.



How can I exclude the other file systems which are mounted in assorted subdirectories?


More From » disk-usage

 Answers
2

baobab:
If you want to use baobab, this is possible by mounting the root filesystem in another place and analysing that. This way, other filesystems will not be mounted in the new root mount and any files hidden by mounts under / will be uncovered and counted in your analysis.



Assuming your root filesystem is on sda1 (df will tell you which device it is):



mkdir root-rebound
sudo mount /dev/sda1 root-rebound
baobab root-rebound


and then tidy up when you're done:



sudo umount root-rebound
rmdir root-rebound


Alternatively you could unmount said file systems manually. You can also scan just your home folder, because it will most likely contain the source of the excessive disk space usage.



du has two options which are able to prevent counting other filesystems:




 -x, --one-file-system
skip directories on different file systems
--exclude=PATTERN
exclude files that match PATTERN



Thus,



du -hx


would ignore all other mounted filesystems or



du -h --exclude /media


would ignore all files in /media where most filesystems are mounted.



If you're using du, sorting so that the biggest things appear at the bottom of the list can help decipher the output. eg:



du -hx | sort -h

[#36449] Thursday, January 26, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
guialk

Total Points: 300
Total Questions: 144
Total Answers: 121

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
;