Linux du command without traversing mounted file systems

Manngo picture Manngo · May 18, 2016 · Viewed 21.4k times · Source

If the wording of the question is wrong, please let me know. It might explain why I can’t find an answer.

I want to find the usage on my main disk using a command like:

du -sh /*

The problem is that I have a number of mount points at the root level, and I would like du to skip these.

I thought the -x option was supposed to do this, but either I misunderstand what it does or I’m using it the wrong way.

How can I apply du to only the root disk without traversing the additional mounts?

Thanks

Answer

Ignacio Vazquez-Abrams picture Ignacio Vazquez-Abrams · May 18, 2016

du -x will not traverse any mount points it encounters. But if it is told to start at a mount point then it will do as requested.