Reducing the size of the Raspberry Pi Image

Reducing the size of the Raspberry Pi Image

As you keep using the Raspberry Pi, the SD card image becomes bloated and filled up with files that you do not need anymore. If you want to make a backup image or just want to have some of that precious SD card space back, it becomes very difficult to reclaim any of the wasted space.

One of the easiest way to get this space back is to do an apt-clean.

What apt-clean does, is that it clears out the local copies of the repository of packages retrieved for installation. So the older your SD card is and the more you have been using it, the better the chances are of recovering space back.

We have recovered as much as 400 MB this way.

First check how much space you have initially using df -h. Here we have 42% of the disk used before running the command.Before Running apt-clean

Now run sudo apt-get cleanRunning apt-clean

Check the disk usage again. It got down to 40%. That is almost 150MB. It does not look much but every MB is precious when you are running out of space or are trying to burn an image to an SD card.After running the apt-clean

Hope that this saves someone’s day like it did ours.

Learn More!

If you liked this tutorial, consider getting the SD Card with Raspbian for Robots here and SD Card with Cinch here.