Is there some easy way to tell how much space all system and software files take up on my hard drive?

I'm wondering if there's some simple way of knowing how much space all the system and software package files combined take up on my hard drive. That is, all the files and directories in a regular, no-frills Ubuntu MATE installation except for the contents of the /home directory. (They're all on one partition on my hard drive.)

Hi one method is using Disks

Can also use Gpartd for similar result.

Systen Monitor with limited result just shows System / System Status available disk space remaining. Not as informative.

Edit: System Monitor has more information in File Systems Tab

3 Likes

Thank you! Problem is, the system and software directories are in the same partition as the /home folder on my hard drive.

That said, I can look at how much of that partition is full, look at how big my /home folder is, and then subtract the latter from the former. The result seems to be about 40 GB in my case.

I am on Mint Mate right now, but I think Ubuntu Mate also offers "Disk Usage Analyzer". It is a default Mate application.

4 Likes

The simple answer to your question is, "No, there is not a simple way to do what you wish." There are a number of reasons for this, including system directories created and used by software applications that not everyone runs, different numbers and kinds of file systems (I have numerous swap file systems - do you consider them "system" or something else?), linked files (both hard and soft links), and even /tmp contents (because although they are considered temporary, they must be created somewhere, right?).

You might be able to create a bash script that uses as arguments the directories you identify as system directories (e.g., /bin /usr/ /etc /var /opt, etc.) and iterate them through du and/or df.

Keep in mind, any totals you get will be estimates and not actual totals. Sparse files and different OS variants track disk usage differently.

A quick-and-dirty method might be to run sudo du -h -s /* and add up the numbers that are returned for the directories listed.

2 Likes

Yes, there is:

sudo du -sh --exclude="/home/*" / 2>/dev/null
3 Likes

This works if every user-based file is stored under /home. On my system, however, I have mount points for VMware files (838GB) and a /data (4.3T) directory that is shared among multiple users/processes. The total given with your command (which is a nice q&d, don't get me wrong) includes those files and mount points, although they are NOT system files.

(Of course, I can use multiple --exclude= arguments to accomplish this. YMMV)

2 Likes

What about adding this option to the command?

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

This should AFAIK exclude mountpoints.

The resulting line would then be:

sudo du -shx --exclude="/home/*" / 2>/dev/null
3 Likes