Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 25 down vote accepted

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 deleteme-later
> sudo mount /dev/sda1 deleteme-later
> baobab deleteme-later

and then tidy up when you're done:

> sudo umount deleteme-later
> rmdir deleteme-later

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 files that match PATTERN


du -hx

would ignore all other mounted filesystems or

du -h --exclude /media

would ignore all mounted filesystems in /media.

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
share|improve this answer
Cool, I didn't see the -x option. I also found another way: you can mount the filesystem again somewhere, then use du or baobab to analyse it. Also, I find it useful to do du -hx | sort -h, though baobab is easier to interpret. – drevicko Aug 1 '12 at 2:23
@Cumulos007 - if it's cool with you, I'll add my solution and suggestion to your answer and accept it – drevicko Aug 2 '12 at 0:52
That's fine by me! – Cumulus007 Aug 2 '12 at 0:56
thanks ian .. did you find any way to use 'exclude' like you can in du -x with the GUI version? – wim Oct 1 '12 at 11:03
@wim no, the GUI version doesn't seem able to use the -x option of du. Mounting the root filesystem somewhere else works though - that's what I do these days (: – drevicko Apr 4 '14 at 23:22

Depending on the type of filesystem you might not be allowed to mount the root filesystem on a mount point under /. You'll get something similar to this:

mount: /dev/sda1 already mounted or /mnt busy
mount: according to mtab, /dev/sda1 is mounted on /

Mounting read only (-o ro) might help. If that fails, use a bind mount:

mount --bind / /mnt

Once mounted, use whatever tool to analyse the disk usage, ie du -sh * | sort -h

share|improve this answer

Baobab attempts to give you control of the devices/partitions that you scan -- go to Edit->Preferences. Typically, you only want to scan the device at Mount Point /. This doesn't recognize all types of links/mounts/bindings though, so ultimately Baobab may still produce confusing results if you have a non-trivial configuration.

For du, the following shell function called dutop will display the top-level of the specified folder (or the current folder). With this, you can probe sub-folders one at a time.

function dutop() { du --max-depth=1 --one-file-system -h $@ |sort -h; }

This will likely report inconsequential "Permission denied" errors if you apply it to /, but you could resolve those with somethink like the following, which will ask for your password (if you haven't recently provided it).

function sudutop() { sudo du --max-depth=1 --one-file-system -h $@ |sort -h; }

For large folders, these may take a while. They won't report any incremental status because the sort operation is buffering all of the intermediate results. It's fine to abort with Ctrl-C if you get tired of waiting.

share|improve this answer

This bug report explains how it is possible to configure baobab to ignore directories. Unfortunately you cannot do it inside the app itself, but you have to use dconf-editor and open org.gnome.baobab.preferences. Here you will find an item excluded-uris; change this to ['file:///path/to/ignore'] (worked with single quotes for me).

share|improve this answer
This doesn't really answer the question, but it's useful info, and someone seeking such info may end up here, so I'm upvoting (: – drevicko Aug 13 '15 at 3:13
It answers the question on how to ignore mounts in baobab (by excluding the mount points) without having to remount the root partition. The other half of the question (du) is already answered in the accepted post. – geira Aug 13 '15 at 13:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.