There are occasions when you may want to free up some space on your (micro)-SD card. If it’s getting full, or you want to store large media files, or install a large application, you may find you run out of space.
There’s an awful lot of good stuff in the default Raspbian Jessie distro these days, but you may not be using all of it on all of your Pis. So, let’s have a look at which of the pre-installed packages take up a lot of space and could give us “an easy win” here.
If you don’t want a full desktop, there is Jessie Lite too (under a Gigabyte) but, if you want a leaner card with a desktop pre-installed removing, some large packages may be a better way to go.
Which Are The Easy Wins?
If you don’t need them, these applications take up a lot of space…
- Wolfram (658 MB)
- libreoffice (253 MB)
…and some of their dependencies take up space too. Clearing them both and using clean
and autoremove
freed up over a Gigabyte of space on my micro-SD card.
Let me show you what I mean. Typing df -h
shows you your disk usage. If you look at the first entry /dev/root/
it shows 3.9G used and 3.0G available…
Then I typed…
sudo apt-get purge wolfram-engine
…which showed me I could free up 658 MB, so I did it.
I then checked how much space was freed up…
Then I ran these two commands…
sudo apt-get clean
sudo apt-get autoremove
Then I did the same with libreoffice…
sudo apt-get remove --purge libreoffice*
…which showed another large space saving of 253MB…
sudo apt-get clean
sudo apt-get autoremove
And then I checked the disk space again. OK, the numbers don’t quite add up. I’m not sure why, but it looks as if I now have 1.3GB more micro-SD card space than I had before…
So after removing these two bulky packages and cleaning up, it looks like we’ve redeemed 1.3 GB of SD card space. That was a relatively easy win and didn’t take very long.
Those are the “low-hanging fruit” (raspberries of course) if you need an extra Gigabyte of space on your Raspbian SD card. I don’t recommend you bother doing this unless you need to though.
There may be other large packages you don’t use. If you have other suggestions, leave a comment.
Couldn’t agree more, one of thing first things I do when I fire up a new PI is get rid of Wolfram.
This has become one of the first things I do after each new install. Especially if you’re using Raspian primarily for home automation or electronics, Sonic Pi, Scratch and a few others can easily give you another few hundred MB extra as well.
First thing after afresh install I purge off the SD card are:
wolfram-engine scratch minecraft-pi sonic-pi dillo gpicview penguinspuzzle oracle-java8-jdk openjdk-7-jre oracle-java7-jdk openjdk-8-jre
Nearly 2 GB of things I do not need!
And not to forget libre-office* !!!
20180124: penguinspuzzle not installed, but apart from that, another 298 MB saving, thanks!
Don’t forget squeak and qjackctl and epiphany
Same here I remove Wolfram as well.
Nevermind, I’m sure both the people that have used it are grateful it was pre-installed for them ;)
It also has the advantage of speeding up any future apt-get upgrade’s as changes to these packages are ignored
Try this command to get a list of installed packages (with their size) sorted by size:
dpkg-query -Wf ‘${Installed-Size}\t${Package}\n’ | sort -nr | more
Now that is a useful command!
Great tip! To elaborate on it:
dpkg-query -Wf ‘${Installed-Size}\t${Package}\t${Priority}\n’ | egrep ‘\s(optional|extra)’ | cut -f 1,2 | sort -nr | less
This will exclude high-priority packages (required, important or
standard) and list only optional and extra packages.
gives me this error
-bash: syntax error near unexpected token `(‘
That’s because WordPress messed-up the command above in order to make it look “pretty”. :-( You have to replace the curly quotes (‘ and ’, two of each) in the command by regular straight ASCII quotes.
best solution for this for me is minibian https://minibianpi.wordpress.com/
I have been taking Wolfram off since it’s first apperance when it was 450Mb. I expect you remember your first Pi system mine was on a 2Gb SD card now it has to be 8Gb just for what seems bloatware if you only use the command line. Nice to have Jessie Lite. TerryR
Raspberry Pi have released a Jessie Lite SD image which I think helps with this problem, also ArchLinux is good for a very lightweight system (https://archlinuxarm.org/platforms/armv6/raspberry-pi)
I remove Mathematica and Wolfram without a second thought…
As if FOSS alternatives such as octave (QtOctave) and gnuplot, SAGE, scipy and scilab, wxMaxima, ROOT, etc are not as capable, and appropriate, for teaching maths, ref https://en.wikipedia.org/wiki/List_of_open-source_software_for_mathematics
Makes you wonder why such proprietary stuff is included in Raspbian? It leaves me rather disgusted and I find the RPi Foundation’s ethics despicable to say the least…
Thanks!!
Its worked, thanks a lot
Great post, many thanks. It’s exactly what one needs to make space on a crowded SD.
You guys helped me free up 1.9GB, thank you!
How still have libreoffice packages both on the UI and terminal and yet on trying to purge it, this is what l get ,”Package ‘libreoffice’ is not installed, so not removed”
I’ve already removed what you guys have mentioned, but I’m finding out that the majority of my space is being used by Docker containers. How can I optimize Docker? I’m using a Raspberry Pi 3
No need for docker, just use Raspbian and flash your own distro