Apr 272016

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…

Before doing anything

Before doing anything

Then I typed…

sudo apt-get purge wolfram-engine

…which showed me I could free up 658 MB, so I did it.

Removing Wolfram

Removing Wolfram

I then checked how much space was freed up…

After Wolfram removal

After Wolfram removal

Then I ran these two commands…
sudo apt-get clean
sudo apt-get autoremove

After Wolfram autoremove

After Wolfram autoremove

Then I did the same with libreoffice…

sudo apt-get remove --purge libreoffice*

…which showed another large space saving of 253MB…

libreoffice remove

libreoffice remove

sudo apt-get clean
sudo apt-get autoremove

libreoffice autoremove

libreoffice 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…

Disk usage after removing both

Disk usage after removing both

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.

  23 Responses to “How To Free Up Some Space On Your Raspbian SD Card? Remove Wolfram & LibreOffice”

  1. Couldn’t agree more, one of thing first things I do when I fire up a new PI is get rid of Wolfram.

  2. 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.

  3. 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!

  4. 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 ;)

  5. It also has the advantage of speeding up any future apt-get upgrade’s as changes to these packages are ignored

  6. 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.

  7. best solution for this for me is minibian https://minibianpi.wordpress.com/

  8. 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

  9. 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)

  10. 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…

  11. Its worked, thanks a lot

  12. Great post, many thanks. It’s exactly what one needs to make space on a crowded SD.

  13. 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”

  14. 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

Leave a Reply