My production system is running on a 60 GB solid state drive (highly recommended – cold-boot in 25 seconds!). The machine runs in dual-boot mode with both Linux and Windows operating system partitions and a common data partition. I thought I had allocated lots of space (10 GB) for Ubuntu but, recently, I was getting a “Low Disk Space” warning. The pop-up box included the message “This computer has only 495 MB disk space remaining”. Since I am used to running Ubuntu in a much less than 10 GB, I wondered where all my disk space went – and how to get some of it back! – in order to stop the incessant warning.
The primary options included with the warning are “Ignore”, which just puts off solving the problem to a later time, and “Examine”, which produces a tree directory of file folders and their associated disk usage. Now, the latter is all well and good, but if you don’t know which files and folders can be safely deleted, it’s tough to recover disk space in any kind of reasonable manner.
Surfing the web suggested a number of possible applications to identify and remove non-essential folders. I found the best of these to be BleachBit, an open-source offering from SourceForge. The program installs easily from the Ubuntu Software Centre, creating two entries, Bleachbit and BleachBit (as root), in Applications – System Tools.
Running the program produces a table of folder categories (e.g. APT, Bash, etc.) with associated check boxes to indicate that a given category (with optional sub-categories) should be included in a system scan. A “Preview” button displays the files that are associated with the selected category and indicates the size of each listed file. A final summary includes the amount of disk space that will be recovered (by deleting the selected files) and the total number of files to be deleted. Simply pressing the “Delete” button causes the actual file deletions to occur.
By previewing all of the available options, I discovered that the vast majority of the potential disk space that could be recovered was under System – Rotated logs. This category accounted for 3.1 GB of the disk space being used – with a single debug file using 1.45 GB!
Now, since I almost never look at log files, and especially considering that many of the files were archived (.gz) and would take some effort to view, I decided that all of the rotated logs were surplus to requirements and could be deleted. Pressing the Delete button resulted in a string of “Permission denied” error messages; however, this was easily rectified by using the “BleachBit (as root)” menu option.
Another very useful Linux command is “df” (report file system disk space usage), especially when used with the “-h” switch (print file sizes in human readable format). Using this command sequence in Terminal displays the allocated size and disk space used on any mounted drives. For example, this command shows my Ubuntu (root) partition to be as follows:
Filesystem Size Used Avail Use% Mounted on /dev/sda5 9.9G 5.3G 4.2G 56% /
So, using BleachBit to clean up “System”, and some of the other file categories, I was able to cut disk space usage on my Ubuntu partition down to just over 5 GB (instead of more than 9 GB!) This has very effectively made the low disk space warning go away.
How do I clean up my harddrive?
How do I free up disk space?