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
The du command is a standard Linux/Unix command that allows a user to gain disk usage information quickly. It is best applied to specific directories and allows many variations for customizing the output to meet your needs.
Method 01: Using Findmnt Command Let's start working on it. To see the list of mounted filesystems, type the simple “findmnt” command in the shell as below, which will list all the filesystems in a tree-type format. This snapshot contains all the necessary details about the filesystem; its type, source, and many more.
If you only need to know the size of the directory, you can speed it up a lot by simply avoiding writing the information to the screen. Since the grand total is the last line of the du command, you can simply pipe it to tail .
Linux command to check disk space using:df command – Shows the amount of disk space used and available on Linux file systems. du command – Display the amount of disk space used by the specified files and for each subdirectory.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With