Tuesday, February 26, 2013

Free up some space on your Pi SDCard

One of the problems about running an OS on your Pi (Raspberry Pi) is that the OS runs from an SDCard which is probably going to be either 4GB or 8GB.
That's not a lot.
Nevertheless, you can probably get away with as little as 2GB to run a fully-fledged (with full Desktop)  OS on your Pi as long as you take steps to manage the available free space.

Here's how I freed up quite a lot of space in some OSes I use on my Pi.

Delete the files syslog, kern.log and messages from /var/log/ and I retrieved 1.8GB of space.
I chose these simply because running the command (from /var/log/)

sudo du -csBM * | sort -rn | head -11
showed these three to be by far the largest log files.

Most people don't need, and never use, these logs but they consume a lot of space.
After deletion, they will be recreated next time you boot and start storing data about the computer's performance.
So, it's probably a good idea to remove these files from time to time.

Arch Linux
In Arch I got back 600 MB when I deleted all files from /var/cache/pacman/pkg/
These package files are stored simply to allow possible downgrading of installed packages.
Read about it here in the Additional Commands section (search for /var/cache/pacman/pkg)

Deleting everything in /var/tmp/portage/ freed up 600 MB of space.
Deleting everything in /usr/portage/distfiles/ gave me back a whopping 1.2 GB

In Fedora, removing everything in the yum cache (/var/cache/yum) gave me 200MB of free space.
In addition, however, make sure you know how your swap is set up in Fedora.
I had created a 500 MB swap partition.
But, it seems Fedora prefers to set up a special Swap file in the root partition (which was designated as /swap0 and of 512MB size).
In /etc/fstab, only /swap0 was being mounted and not the swap partition that I had created myself independently of the config tool.
So, I revised fstab to mount /dev/mmcblk0p3 as swap and subsequently deleted /swap0.
Another 500 MB saved.

No comments:

Post a Comment