Wednesday, July 27, 2016

Where Did All of My Space Go!?

Yes, I have been there and chances are you have too. You're trying to run an application or service on your Linux machine and it fails due to lack of space. Granted, being low on space is typically a valid problem. However, at times you KNOW you have so many terabytes of space available and yet your application complains there is no space. This is usually due to the application using only a certain partition and/or directory out of all that space. In any case, you will have to either clean up the drive, or purchase a larger drive. I use the Disk Usage command with some flags to locate the partitions and/or directories with the most used space which I then clean up. Run the following as root (or preface the command with sudo as non-root user with sudo priveleges).
du -sh /*
You will get an output similar to the below.
[user1@myserver ~]$ sudo du -sh /* --exclude='/proc'
4.0K /applications-merged
0 /bin
6.7M /boot
0 /dev
16M /etc
685G /home
0 /lib
16K /lost+found
4.0K /media
20K /mnt
24K /node.conf.sample
14M /opt
1.1M /root
488K /run
0 /sbin
1.3G /srv
0 /sys
0 /tmp
2.5G /usr
11G /var
For more information and flag variables on the Disk Usage command, view the manpage for du. As always, if you have any pointers to add or questions please leave a comment.

No comments:

Post a Comment