How I solved a 'No Disk Space' error on my Pi

Feb 9, 2020 | 2 minutes to read

Today, I was checking something on my Pi, when I realized there was no free disk space on the Root FS. I used ‘df -h’ to see the list of file systems and the space used / available on each. For my rootfs, I saw:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       6.9G  6.9G 0G    100% /

The first thing I thought of was, “Did I forget to expand the RootFS to use the full size of my SD Card, when I first setup this Pi?”, because that’s a common thing for sure. Here’s a guide if you need it. But no, in this case, I am using an 8GB card and the ‘df’ command shows all 6.9GB of that space available and Used too.

So, I moved on to solving the issue. First, I used ‘sudo apt-get clean’ to clear out the apt-get cache, to free up some necessary space on the disk. Yay, now there are 111MB free. (This doesn’t remove any applications, just cleans up the cache of things previously installed)

Then, I moved on to running ‘du’, to help me find the biggest files on the file system, with this command:

cd \
du -h --threshold=1000000000 -S >> dulist.txt

I then ran ‘cat dulist.txt | sort -h’ to review that listing, sorted by a human-readable size value.

And there I found the problem. I had downloaded a large file recently, thinking I was putting it on my external USB drive, but instead I had run the command wrong and it ended up on my Pi’s SD card.

So it was pretty simple to move that file onto the USB Drive and so solve my issue on the SD card. Whew! I was panicking there for a few until I figured this out. As for solving this, I should have started with the question, “What have I been messing about with recently?” and that would led me to this file faster. Next time… : )

You can leave a comment on this post here.