Let me begin with an example:

  1. "/" or Root Filesystem is of Size 10GB and is currently 100% in Use.
  2. "/usr" is a directory under "/".
  3. "/usr/something" is a separate logical volume or mount point and looking fine.
  4. "/var" is a separate LV and looking fine too.

When we check what directory / file is consuming the disk space on the root volume, we use "du" command as shown below:

du -sh /*

However, this includes the other partitions/volumes too.

du -x -sh /*

That too, does the same thing. It does not exclude other disk volumes. However, the man page says:

-x, --one-file-system skip directories on different file systems

If we see "/usr" consuming most of the disk space on the root filesystem and it is a directory under "/" then running "du -x -sh /usr/*" against it would also report on "/usr/something" which is a separate disk and is large in size causing the command to exit with much delay.

Bottom Line: How to show only "one filesystem" when running "du" command or any other command to identify disk usage and culprit files excluding any other disk volume under that directory / filesystem?


  • Is there a reason you can't use --exclude=[PATTERN]? Apr 21, 2021 at 3:02
  • I noticed that option, but we have multiple of such subdirectories that are logical volumes mount on. I gave a simple example in the question. Apr 21, 2021 at 3:40
  • Besides, "--exclude=" is required for each pattern separately, so this thing does not work: du -sh /* --exclude=echo $(df -hTP -t xfs | grep -v File | awk '{print $NF}')`` Apr 21, 2021 at 3:55

1 Answer 1


du is doing exactly what you told it to do.

-x skips directories on different file-systems, but it will do that for each and every one of the non-option arguments on the command line.

When you run du -x -sh /*, you are telling du to give you the details on ALL of the files and directories in /, regardless of whether they are mount-points for other file-systems or not.

du does not receive a single argument /*, it gets all the pathnames that /* expands to. The shell expands /* to all of the matching file/directory/sockets/fifos/etc names in / and passes them to du (actually all except those beginning with a . - "hidden" filenames - unless the dotglob shell option is set). See man bash and search for Pathname Expansion.

What you probably want to do is use du's -d (aka --max-depth) option. e.g.

# du -h -x -d 1 /
512     /media
8.7M    /var
512     /srv
1.4G    /opt
10K     /tmp
512     /mnt
512     /boot
1.1M    /etc
13K     /run
512     /home
97M     /usr
1.5G    /

Notice how other file-systems (e.g. /proc) are excluded from the output - that's because while they match the -d 1 maximum depth, they are also separate file-system from / itself, so -x excludes them and du never descends into those mount-points.

Note: -d is a non-standard (i.e. non-POSIX) option for du. It is, however, available in both GNU and *BSD versions of du, and probably many others too. i.e. this will definitely work on Linux and FreeBSD and almost certainly on other modernish unix-like systems, but may not work on ancient or proprietary unixes.

The man page extract in your question (-x, --one-file-system skip directories on different file systems) indicates that you are using the GNU version of du from GNU coreutils.

  • If i helps clarify, to a shell (such as bash, [t]csh, zsh, etc) in a un*x environment, the parameters '/' and '/*' are two very different things. '/' passes du only the directory name of '/', while '/*' looks up every name in the / directory, and passes the whole list (without the '/*') to du. du then happily processes the whole list including the other mount points which are part of that list. So only use '/' and not '/*' if you only want the filesystem mounted on '/' (i.e.: the root filesystem).
    – C. M.
    Apr 21, 2021 at 8:57
  • 1
    Running "du -h -x -d 1 /" also lists "/home", "/tmp", "/boot" and others which are separate filesystems / mountpoints in which I am not interested. If I get an alert stating "/ is 95% full" then I don't want to look at the contents of "/home" or "/tmp" which have no disk space issue. Also, without "-s" the size info for directories is not provided. What you get is a metadata only. On my production system it is showing "4.0K /home", for example. May 14, 2021 at 6:51
  • It lists them because those mount points are directories in /, and directories also use some disk space (independent of the size of their contents), but it does not descend into them, because of the -x option, to examine the contents of those mount points. 4.0K is the size of the /home directory itself (probably because 4K is the minimum size of any file on your root fs), not the size of its contents.
    – cas
    Jan 19, 2022 at 1:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .