10 things you can do when the drive on your Linux box is full

Larger hard drives should mean the end of disk space worries, but our appetite for bigger files has kept pace with all that increased capacity. Here are some effective ways to keep your Linux box from busting at the seams.

Do you remember the days when keeping a hard disk from getting full was essential to keep your machine running well? That was then, this is now, right? Well, not quite. The truth is, "The more you have, the more you need." Today, people are saving more on their drives, and that "more" consists of files that are far larger than what hard drives were once filled with. I see people filling up even terabyte drives faster than they can name the videos they just saved.

So... What do you do when that drive is full and your operating system is Linux? Do you have to do some special incantation or magical programming trick? Or do you just need a bit of common sense to help you through? Although common sense will be a great aid in this task, it also helps to know a few things about the operating system in general and how to use it properly. Let's take a look at some things you can do when your Linux box begins running out of space.

Note: This article is also available as a PDF download.

1: Use Computer Janitor (or its equivalent)

Ubuntu Linux has a handy tool called Computer Janitor. (You'll find it in the Ubuntu Software Center.) It will analyze your system and report which applications are no longer supported or no longer required. The tool is incredibly simple to use and will gain you some space, depending upon how many unsupported applications you have on your machine. This tool probably won't recover gigabytes of space, but you may recover a few hundred megabytes. And in the quest to gain as much space as you can find, every little bit helps.

2: Add an external drive

Linux really loves external drives. In modern incarnations, it doesn't matter if that drive is ext2/3/4, reiserfs, fat, vfat, NTFS, hfs... Linux can read it. Naturally, you're not going to move your applications to the external drive (although you could). But you can certainly use it as a data drive and move all of those precious family pictures, home movies, and MP3 collections to it.

3: Install the OS with /home on a separate drive

This makes sense on a number of levels. First, it moves all user data off the drive housing the OS. This also means when you reinstall the OS you don't have to worry about overwriting your user data. Of course, that's assuming you remember NOT to install the OS on the drive that contains all the data on your /home drive. (But if you forget and do that, this article won't help you anyway.)

4: Check your log files

Although this isn't nearly as common as an Exchange log getting out of hand, I have seen instances where a log file did not rotate and exceeded the normal size. The Linux operating system has a good log rotational tool, and usual logs shouldn't get the chance to grow overly large. But if that should happen, you can take advantage of the built-in logrotate tool to solve that issue. As a general rule, I have found this to be an issue only with non-system (or non-default system) software. Remember, all log files are usually housed in /var/log.

5: Clear your package manager cache

If you use a distribution that employs a package manager like apt, you can free up a good amount of space by clearing the cache. Apt retains the .deb packages it uses in /var/cache/apt/archives. You don't want to just delete those file, as that could have negative repercussions on the apt tool. Instead, use the built-in apt-cache tool to purge the cache and free up a good amount of space.

6: Clear application caches with Bleachbit

Another outstanding tool (also found in Synaptic) is Bleachbit. This tool clears only the various caches that applications use, but you will be surprised at how much space you can free up from clearing the cache of Adobe Reader, APT, Bash, Browsers, Evolution, Flash, GNOME, KDE, and many more applications. On a single run, without clearing the cache of all available applications, I was able to free up 485.9 MB. Not only will this give you more space, but some of those applications (the ones that tend to hold onto more cache than others) will begin running with more snap.

7: Write your own script

This is the approach that most hard-core Linux users prefer. Why bother with a fancy GUI when bash is all you really need? You can create a simple bash script to traverse the directory hierarchy and report which files are taking up the most space and delete them, if applicable. For example, this simple one line script:

find /home/jlwallen -size +1000000k

will print out the results of a find command, but only those files found that are larger than .95 Gb. Or you can find and delete duplicate files with a script like this:


find -type f | while IFS= read vo


echo `basename "$vo"`


Call that script and then pipe its results through uniq, like so:

./ | uniq -d

This will print out all duplicate files you have on your drive, and you can then decide whether you want to delete them.

8: Remove applications

I know this sounds silly, but I bet if you went through the hierarchy of your menu you would find a good number of applications you simply do not use. Why keep them on there if you're not going to use them? Delete those bad boys and recover some space. This especially holds true if you like to install numerous applications just to test the waters. The best approach is to use your GUI package manager so you can simply scroll through what is installed and remove away.

9: Empty your Trash

In some instances (and distributions), Delete works similarly to how it works in Windows -- instead of actually deleting the file, the file goes to the Trash. I have seen cases where the Trash was very full, and the act of emptying that directory freed up quite a bit of space. To clear it, simply right-click on the Trash icon and select Empty Trash.

10: Reinstall

Although this should be used only as a last-ditch effort, a clean installation certainly does restore that factory fresh smell, as well as giving you the chance to migrate to the latest, greatest version without the bad taste of doing an upgrade installation. Here's the kicker: If you have a TON of files in your ~/ directory, when you copy those back, you will wind up with the same tonnage on your newly installed system. Take this opportunity to either move those files to a new location or just weed out that huge collection of wallpapers you have from the '90s and the redundant backups of all your movies and MP3s.

Portion control

You would be surprised how quickly even a terabyte drive can fill up. With more and more people downloading video and audio onto their machines (and that process growing ever more user friendly), it's no wonder the size of hard drives continues to grow increasingly EPIC! But with the help of the above tips, you should be able to prevent your Linux system from getting overstuffed and slowing down.


Jack Wallen is an award-winning writer for TechRepublic and He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website


if you're using ext2/3/4 you can change the amount of blocks reserved by the system for use by privileged processes to something smaller than the default 5% by using tune2fs or tune4fs. to change it to 1% you would type (either as root or using sudo): "tune4fs -m 1 /path/to/your/disk", and you can even do that while the disk is still mounted. depending on the size of the disk you might find yourself with quite a lot of extra space suddenly!


This is a bit outside the point of the article, but you mentioned Linux reads almost any filesystem, I was wondering if you, or anyone here, may know if that includes HPFS (ala OS/2 Warp)?


kdirstat is a util (in the repos) that will graphically, quite beautifully, show you the file size layout and composition of whatever dir you point it at. Allows some cleanout at the same time. Also ported to windows (windirstat) and Mac (forget the name)


I can't believe this is still a problem for *nix distros. The first time I encountered this particular problem, logs on /var had filled up on a Solaris slice - and it was causing a kernel panic. It took me a ton of research to figure out how to just get the system to boot. After that, I had to install a second drive and create a symbolic link to give Unix the space it needed on /var in order to write logs. Only then could I clean up the space on the orignal drive. This was during the days when 4GB drives were the norm. I learned a lot about *nix through the process -but you know, the idea of having maxed sized circular log files that delete the oldest messages as new ones are logged is so logical - I don't see why *nix doesn't adopt this approach. I'll also grant that there are any number of situations where you can end up consuming all of your space on an NT based platform, with similar results (and often because of apps that do continious sequential logging or transaction log files of some sort and don't purge the oldest automatically). I put everything on one slice on a big drive these days. Setting up a slice with a particular directory on it seems like a sure path to this kind of challenge. I know it isn't a Linux BKM for the enterprise, but for home users and requirements, it just seems like a much easier way to go. (Just read the details, and it is funny that you should mention Exchange, because that is the only other time I've had something like that happen. Exchange and *nix, gotta watch those log files - seems that most people learn that the hard way.)


Thumbs up from me too, for BleachBit. I'm using it, on Debian. I think a nice addition (specially for people who prefer a GUI), is GTK Orphan. THANKS for the article!!! :-)


hpfs is the High Performance Filesystem, used in OS/2. This filesystem is read-only under Linux due to the lack of available documentation.

Neon Samurai
Neon Samurai

My guess is log history. If I hammer your server with traffic and the log eats the oldest to make room for the newest then I can burry my evidence under a load of chaff log entries. With the log being cut and compressed, I can always go back to an older log file. This is a random guess though.

Editor's Picks