Home > Linux > 84 MB Minimal Raspbian ARMHF Image for Raspberry Pi

84 MB Minimal Raspbian ARMHF Image for Raspberry Pi

Many embedded systems applications do not require a desktop environment or graphical interface on the screen (e.g. server), and you may want to only install the files you really need on the SD card either to reserve as much space as possible for data and/or your program or to reduce costs.

After searching for a minimal image based on Raspbian ARMHF distribution for the Raspberry, I could only find Linux Systems minimal image based on the Alpha version of the Raspbian Wheezy. Their compressed image is 109 MB in size, has a custom kernel,  sshd and ntpd are enabled, but the wireless tools were deleted, and at the time the swap was located in another partition instead of a file inside the rootfs. The uncompress rootfs is about 414 MB (as reported by df -h when mounted as a loop device).

I decided to prepare a minimal image myself based on the first Raspbian Wheezy release, that supports about the same features of the image mentioned above, plus support for the wireless tools. I’ll describe how I proceeded below, but for those who are only interested in the image, and could not care less how it was done, here’s the download link (84 MB compressed image). The username / password are the same: pi /raspberry.

Upon the first boot you can change the time zone:

This image only support US keyboard layout and English locale, if you need to change those:

If you are mainly going to access your board via ssh, you probably don’t need those.

Instructions to Generate a Minimal Raspbian Image

I’ve downloaded the image via BiTorrent and copied it to the SD card using dd. During the first boot, I configured the keyboard to US layout, Bangkok timezone, enabled SSH and disabled X are started and did not resize the partition.

Now let’s have a look at the rootfs usage:

We’ve got 1.4 GB used, so we’ll need to delete about 1 GB.

The steps below are not optimized, and I’ve just described the way I did it.
As I login to the Raspberry Pi as pi user, the first thing I see is a directory called python_games. Sorry kids, but:

Then I vaguely remember some things that are pre-installed in the image by default, so I removed those:

Those two steps only shoved around 100 MB, so it’s not such a good start, but it’s still progress. I miraculously remember a command to find large file in Linux:

Now that’s more interesting! The first 3 files are the apt caches and the swap, we’ll take care of those at the end. Some icon takes appear to take a lot of space, the .a file show there are some development libs installed and the last file reminded me there’s some Raspberry media sample code.

Let’s take care of those code samples:

Now I need to find a way to list development packages installed in the system. Luckily there is a command to list installed packages, which I can filter to list development packages:

Good! Let’s remove those:

Let’s remove python and some other packages (LXDE, omxplayer…)that do not look necessary in a minimal image.

sudo apt-get remove sudo dpkg --get-selections | grep -v "deinstall" | grep python | sed s/install//
sudo apt-get remove lxde-common lxde-icon-theme omxplayer raspi-config

At this point I just discovered there were still some x11 packages, and realized this should have been the first thing I had removed since it would get rid of several hundred MB of data:

sudo apt-get remove sudo dpkg --get-selections | grep -v "deinstall" | grep x11 | sed s/install//

Let’s say we don’t need audio support either:

sudo apt-get remove sudo dpkg --get-selections | grep -v "deinstall" | grep sound | sed s/install//

As I mentioned above, we would still like to have ssh access, but we don’t need to use the default sshd, and we can replace it with the lightweight dropbear ssh server:

sudo apt-get remove sudo dpkg --get-selections | grep -v "deinstall" | grep ssh | sed s/install//
sudo apt-get install dropbear

We now have 550 MB used space in the rootfs, minus the 100 MB swap file, that’s still 450 MB which is well above the 414 MB for Linux Systems image. I can see gcc is still there, and we should not need to build anything directly on the device. let’s remove it!:

sudo apt-get remove sudo dpkg --get-selections | grep -v "deinstall" | grep gcc\- | sed s/install//
After this operation, 234 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] no

OK, this was a bad idea, and I answered no. So instead,  I decided to only keep gcc 4.7:

After some more time trying to find non-essentials packages, I removed a few others, and call autoremove to delete unused packages.

sudo apt-get remove ca-certificates libraspberrypi-doc xkb-data fonts-freefont-ttf locales manpages
sudo apt-get autoremove

Almost done. Since we won’t use apt-get anymore, let’s clean apt-get cache:

Let’s disable swappping, and fill the swap file with zeros:

Delete the logs

Check the size:

Yes! That 461 MB including swap file. Time to turn off the Pi:

Now, we can remove the SD card from the Raspberry Pi board, and access it from a Linux PC to create an image.

We can mount the root and use sfill to fill free space with zeros:

and finally compress the image with 7z using ultra settings:

7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on 2012-07-15-wheezy-raspian-minimal.img.7z 2012-07-15-wheezy-raspian-minimal.img

Done. We now have a 84 MB minimal Raspbian image.

It’s certainly possible to even go slightly lower, as a basic debootstrap of Debian unstable comes out at 269MB uncompressed, and using Emdebian Grip might even allow a ~100 MB uncompressed rootfs with all the features we need, but I doubt this option is available with Raspbian mirrors (TBC).

  1. dave m
    August 16th, 2012 at 17:06 | #1

    Great post, thanks.

  2. rew
    August 20th, 2012 at 16:22 | #2

    Hi, You forgot to mention the “mkswap /var/swap”

  3. August 20th, 2012 at 17:23 | #3

    Yes, I must have forgotten this part, or the swap might not work…

  4. Matias
    August 29th, 2012 at 22:18 | #4

    Deleting the whole /opt directory is not a wise thing, because you will lose the ability to change resolutions and use OpenGL. I guess you can remove “include” and “src” directories, however “bin”, “lib” and “sbin” should be spared.

  5. August 30th, 2012 at 11:44 | #5

    Thanks for this great post!!!
    It would be great if you release this article’s instructions as a shell script, so everyone can follow your steps easily!

  6. sophana
    September 6th, 2012 at 18:49 | #6

    Hi, thanks for the image.
    I found out that there is no sftp-server in openssh-server
    I had to do a: “apt-get install openssh-server –reinstall” to get it back
    removing useless packages is a good thing.
    But removing files from packages is not a good idea.
    Are there any other files deleted like this?

  7. September 6th, 2012 at 18:59 | #7

    That’s because openssh-server is not installed in this image, only dropbear is installed.

  8. sophana
    September 6th, 2012 at 22:30 | #8

    strange, so there’s something I don’t understand well in debian…

    dpkg -L openssh-server gave me a list of files, which was much smaller than now after I reinstalled.

  9. September 6th, 2012 at 22:43 | #9

    I’m not sure, but if you look the instructions, I removed all installed packages with the string “ssh”, before installing dropbear. So I guess it’s possible dropbear uses a subset of openssh, but I don’t know the details.

  10. September 23rd, 2012 at 16:44 | #10

    Thanks for creation of this howto and image,
    But please add following steps to your howto/image:
    sudo swapoff -a
    cd /var
    sudo dd if=/dev/zero of=swap bs=1M count=100
    #We have to put the swap signature
    mkswap /var/swap

    #Optional: Regeration of SSH keys (I’m using openssh and not dropbear)
    #Take a look to the original image, copy the script /etc/init.d/regenerate_ssh_host_keys to your image
    chmod +x /etc/init.d/regenerate_ssh_host_keys
    update-rc.d regenerate_ssh_host_keys defaults
    update-rc.d ssh disable
    rm -f /etc/ssh/ssh_host_*

  11. v1ncen7
    October 20th, 2012 at 13:45 | #11

    hunting for MBs 🙂

    sudo apt-get remove liblapack3
    sudo apt-get remove libatlas3-base
    sudo apt-get remove penguins puzzle
    sudo apt-get remove gdb

  12. v1ncen7
    October 20th, 2012 at 13:45 | #12

    I meant sudo apt-get remove penguinspuzzle

  13. October 21st, 2012 at 18:19 | #13

    Thanks for this! Definitely going to try this!!

  14. DrB
    October 26th, 2012 at 10:51 | #14

    Using “apt-get purge” instead of “remove” will drop the configs and save some more bytes.

  15. October 30th, 2012 at 06:57 | #15

    When will someone produce an image which is actually shrunk to fit? It’s easy to expand an image once its copied onto a card, not so easy to shrink one down using loopback or some other method beforehand. I want to run a minimal distro on 512Mb card. I can’t be the only one?

  16. October 30th, 2012 at 09:02 | #16

    @Chris Hatton
    It’s possible to write a script to do that. I wrote one for another platform (Mele A1000): https://github.com/cnxsoft/a10-tools/blob/master/makeSD.sh. Of course to be used with RPi it would have to be modified.

    You an also do that manually, as the rootfs in the image above should fit into your 512 MB SD card, simply mount the image, and copy the files to your SD card with cp -a (assuming it is already partitioned correctly).

  17. Adwin
    November 6th, 2012 at 06:04 | #17

    You can also drop the docs & man for an additional 44Mb:
    rm -fr /usr/share/doc/* /usr/share/man/*

  18. November 6th, 2012 at 10:40 | #18

    I thought “apt-get remove manpages” would do that. But maybe not finally…

  19. DrB
    November 12th, 2012 at 07:53 | #19

    The manpages are part of the individual packages. Deleting them, is a hack, this
    will damage the package consistency.

    [email protected]:~ # dpkg -S /usr/share/man/man8/fdisk.8.gz
    util-linux: /usr/share/man/man8/fdisk.8.gz

  20. jtoledano
    November 12th, 2012 at 22:26 | #20

    Wil dropbear suppor sftp with some pach

  21. November 12th, 2012 at 22:33 | #21

    This looks possible indeed: http://linuxexplore.com/how-tos/sftp-secure-file-transfer-protocol-with-dropbear/
    But it may require to build dropbear, instead of using the debian packages.

    Another solution could be to ask Raspbian maintainers to enable sftp support in dropbear package. Not sure if this is suitable.

    I’m also not sure of the amount of space saved between dropbear and openssh, so it may not be worth it.

  22. November 16th, 2012 at 02:06 | #22

    thank for this great tutorial. I’m on a 2GB disk and after yate and dc++ hub (probably 4MB), and it’s out of space. It’s terrible how much space is wasted. Do people even use that crap?

  23. November 16th, 2012 at 09:28 | #23

    They installed the main packages they think people will use, but if you want to use a smaller SD card, then some work is needed, which is why I provided this image and instructions.

  24. Sander
    November 16th, 2012 at 13:17 | #24

    FWIW http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=17028 offers a ready-to-run minimal Raspbian.

  25. November 17th, 2012 at 23:21 | #25

    thank you very much for your tutorial ! Its really helps me 😉

  26. January 2nd, 2013 at 04:03 | #26


    Having a smaller image is a very appealing idea.

    I just wanted to give the minimal image a try in the hope to use one of my 128 MB or 256 MB SD cards. Unfortunately the image is tailored to a 2 GB card. How much is actually needed? Would it be possible to provide a smaller image?

    I tried to copy the image to a 256 MB card and to fix the partition table, but fdisk complained even about the start of the partitions so I refrained from further experiments.

    Nice work though!

  27. January 2nd, 2013 at 14:50 | #27

    @Georg Bisseling
    The compressed image is 84MB, but it’s just over 400 MB uncompressed. If you want to install Linux in a 256MB SD card you can try Slitaz armhf: http://www.cnx-software.com/2012/12/15/slitaz-armhf-46mb-linux-distribution-for-raspberry-pi/ The binary image is for 512MB, but the rootfs is just uses ~18MB, so it might work with dd + resizing the partition, but the safest way is probably to mount the image manually in your PC and copy the files with “cp -a” to your card.

  28. Andre
    March 7th, 2013 at 16:39 | #28

    I am pretty new to this and recently I downloaded one of the images online.
    However, this one had at boot a logo which I wanted to remove.
    If I use your image, will there be an option to enable splash or a simple picture as log at boot time?
    If so, in which file can I change the boot logo?

    Ps.: nice work as you make it sound easy even for a newbe like me.

  29. Witiko
    May 1st, 2013 at 17:43 | #29

    You don’t need either when you’re not using a graphical environment, do you?

  30. Matthew
    May 5th, 2013 at 16:52 | #30

    Andre :
    I am pretty new to this and recently I downloaded one of the images online.
    However, this one had at boot a logo which I wanted to remove.
    If I use your image, will there be an option to enable splash or a simple picture as log at boot time?
    If so, in which file can I change the boot logo?
    Ps.: nice work as you make it sound easy even for a newbe like me.

    Search online for a “plymouth” tutorial. “plymouth” allows you to have a custom boot animation/logo.

  31. Will
    May 6th, 2013 at 01:47 | #31

    Some others you may want to consider removing:

    not needed if you don’t have a desktop and are running headless:

    If your not going to do anything wireless
    libiw30, wpa-supplicant, wireless-tools

    network filesystem stuff

    A couple of others
    nano / ed vim / vim-tiny Whichever you dont use

  32. Andres Misiak
    June 21st, 2013 at 02:05 | #32

    Exelent!! Thank’s was very helpfull

  33. Benjamin
    June 30th, 2013 at 23:37 | #33

    Yeah ya,

    I’m just performing your cleanup on a new 2013.05 Raspbian Image and I got to notice the following. First you just use apt-get remove, but since you want to get rid of the packages at all you better should use apt-get purge which will also remove any configuration etc file 🙂 Freeed up another 40 MB or so 🙂 (as mentioned before by DrB)

    apt-get purge dpkg --get-selections | grep deinstall | sed s/deinstall//

    In doing all the stuff from your post and stuff mentioned in the comments, I get an rootfs of 675MB. There is still the icon-theme.cache around (74MB), apt’s cache not cleared, logs still in place etc. So you could say can squeeze another 100MB out of it (maybe more).

    Thanks again for the info

  34. August 22nd, 2013 at 04:31 | #34

    I get an ‘sfill’ command not found error on Ubuntu 12.10. Neither it is available in repository.

  35. August 22nd, 2013 at 05:13 | #35

    How to install this minimal image back into the pi?

  36. August 22nd, 2013 at 10:03 | #36

    You can find the package with “apt-file search sfill”, which will let you know you need to install secure-delete

    You can install the image with dd or Win32DiskImager as any other SD card images. You may also want to use gparted to extend the rootfs to the full size of your SD.

  37. Liviy
    October 13th, 2013 at 01:44 | #37


    Great read…I’m just trying to do the same with the current version and I’m a little confused where you got your offset & block counts for the mount & dd commands?

    Thanks 🙂

  38. Berry
    November 23rd, 2013 at 21:30 | #38

    What’s the password for user ‘root’?

  39. Berry
    November 23rd, 2013 at 21:32 | #39

    Enter ‘sudo passwd root’ to set the password for root.

  40. billy.
    January 18th, 2014 at 10:19 | #40

    Security risk “IMPORTANT”.

    I download this image and it’s fantastic awesome. I clone the image to the SDD-Raspberrypi and export the public key to access password less.

    After I had clone the same download and I cloned another SDD.

    Now I do ssh [email protected] and work my pi1. and I do the same for the pi2 and I have Shell Access…

    All the copy’s of this image have the same private key.

    As soon you install this image you must to generate a new ssh_keys.

    generate a host-key:
    # rm -f /etc/dropbear/dropbear/dropbear_*
    # dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
    # dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
    # /etc/init.d/dropbear restart

    Please in future releases please delete the keys before generate the image.

    NB also the image have keys for openssh If some one install openssh the host it’s vulnerable too.

  41. onebir
    January 29th, 2014 at 17:21 | #41

    Also check out minibian: http://minibianpi.wordpress.com/

  42. February 4th, 2014 at 10:32 | #42

    Somebody has written a script tp create a minimal image based on the instructions of this post: https://gist.github.com/enxt/8791390

  43. Kyle
    March 22nd, 2014 at 01:23 | #43

    You do realize that he cut out the entire X system on purpose, right?

  44. Uday
    March 25th, 2014 at 21:42 | #44

    Hie, Thanks for the steps and explanation.
    Can you please tell me, how can I access the Overlock option, because we don’t have rasp-config any-more.
    Thanks a million in advance.

  45. March 25th, 2014 at 22:07 | #45

    You need to edit config.txt in the SD card as shown in http://elinux.org/RPiconfig#Overclocking

  46. Uday
    March 25th, 2014 at 23:27 | #46

    Thanks a lot for the reply.
    I am trying to do some real time sensor data processing. I still have latency, even with the minimal raspbian.
    Can you please suggest me with some other compatible OS, which can support real-time sensor data processing.
    Right now I think the problem is wiht memory, and my fear is about the stability of the processor, if I overlock it.
    Thanks in advance.

  47. March 26th, 2014 at 10:51 | #47

    You can try real-time OS like ChiBiOS or FreeRTOS

    I have never tried myself.

    I’m not sure overclocking the CPU will improve I/O latency much.

  48. rich
    April 15th, 2014 at 05:30 | #48

    How does one disable hdmi from the command line?

  49. rich
    April 16th, 2014 at 03:41 | #49

    Actually wondering if I can just blacklist a kernel module to do it.

  50. Pranita
    July 25th, 2014 at 12:03 | #50

    Thanks, it worked for me if I used compressed image directly downloaded, but facing some issues when I executed the commands to remove unnecessary components, Actually I want to use this compressed image for executing nodeJs components further, so is there any other way to compress the image a little more.

  51. July 25th, 2014 at 14:15 | #51

    There must be some packages that you may not need, so you just need to remove them.

    If you know exactly what you need, you may also consider using the Yocto Project, and you will be able to build an image that matches exactly your requirements. It’s a little more complicated thought. To get started: http://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/

    SliTaz might be another option: http://www.cnx-software.com/2012/12/15/slitaz-armhf-46mb-linux-distribution-for-raspberry-pi/

  52. Pranita
    July 25th, 2014 at 16:47 | #52

    Thank you so much for the quick reply. There is no doubt in it, Your post really helps me a lot,
    Sure will try for the provided links too.
    Ya I know its little complicated but not impossible so I want to try with it.
    and the version for the provided minimal image is also older so I was trying commands provided by you for latest image and facing some issues so asked for this.
    means, not exactly the image get compressed to 84MB.
    So can you please tell me solution for this?
    And one more thing since I required those specific tools so can i go for this : first I will install all the tools and will make .img for it.
    and then I will distribute or use for further use. So will it work ?

  53. July 25th, 2014 at 17:47 | #53

    OK, so you are using the latest Raspbian image and try to make it small.. I don’t know which issues you are facing.
    But if you want to make it smaller, run “ls -lR > tree.txt” in the root directory, and check which files may be removed.

  54. Pranita
    July 25th, 2014 at 19:08 | #54

    okay thanks a lot for the reply and solution too. I will definitely try it and Will ask the issues if any,

  55. September 25th, 2014 at 17:30 | #55

    Why would removing gcc be potentially harmful? If you install packages via apt-get only, I don’t see a problem with removing gcc. A full list of packges removed by your operation would be interesting. Also, I’d spend some more MiB for vim and aptitude, when you’re building a custom image anyway.

  56. September 25th, 2014 at 17:33 | #56

    I can’t really remember, but I have seen some funny things with apt-get somethings.
    Maybe removing gcc would have remove libc, or something like that. It’s not suppose to happen however, as gcc is not an essential of a system.

  57. Mattias
    January 8th, 2015 at 16:37 | #57

    link to download is reversed, it says images/raspbian but it’s raspbian/images, just a fyi 🙂

  58. January 8th, 2015 at 16:50 | #58

    Thanks for letting me know. They must have re-orgainized their server since I wrote this post.
    Anyway, I think most people going through these instructions will probably want to get the latest version of Raspbian.

  59. Masno
    February 10th, 2015 at 05:09 | #59

    will there be a version for the raspi2 ?

  60. February 10th, 2015 at 10:24 | #60

    This image should also run on the Raspi 2, you’d probably just need to update the firmware files and kernel.

    I have seen other people release small images similar to that one. So I’m sure one will eventually be released.
    Not from me, since I don’t have RPi 2.

  61. _omega_
    March 1st, 2015 at 02:37 | #61

    I also would love to see an updated image here with support for Raspi 2. I suppose in the meantime I will look into finding the appropriate files to change out of the image…

  62. Austech
    April 2nd, 2015 at 05:17 | #62

    Seconded. As a total noob I have applied this tutorial to the RPi2 2015-02-16-raspbian-wheezy image.
    Ultimately I’m looking to cut cpu overhead to get a functional headless samba fileserver with qbittorrent-nox and openvpn. Off the back of the 20150216 image Samba and QBitorrent-nox are fine, but when I got openvpn up and running QBittorrent would sporadically crash. I’ll report back soon.

  63. Austech
    April 2nd, 2015 at 09:24 | #63

    I have followed your tutorial using the RPi2 2015-0216-raspian-wheezy image, except I used win32disk imager at the end. Installed samba / samba-common-bin and all works well.

    I’m really looking for a stable, headerless samba/torrent client solution, ie not just no monitor but no UI at all running at cpu expense. This is why I am here exploring your minimal install. Not sure if this will relieve some cpu strain or it just saves space (not my primary concern on an 8gb sd with 1+2tb external usb attached).

    On the B and B+ Samba is rock solid. Same with RPiB+2.

    Was using Deluged because of it’s windows client support for magnet links, but it was too unstable, sometimes running for days, other times crashing every few minutes.

    Advised to check out QBittorrent but I never really put it through it’s paces until AFTER I had PIA openvpn running at which point I noticed that QBt crashed too.

    So now on the RPi2, with cnxsoft’s stripping guide applied to the the newer RPi2 wheezy image. About to try just samba and Qbt. If QBt still fails I will try it with Deluged again and go from there. Once I have either of those running stable under multi torrent load, Ill come back to applying openvpn. I’ll report back soon.

    creating an image at this stage and will install qbittorrent-nox and check stability.

  64. April 26th, 2015 at 13:41 | #64

    My raspberry pi is only show the it has 215m of memory when i have a raspberry pi b (500M)

    total used free shared buffers cached
    Mem: 215 192 22 0 10 116
    -/+ buffers/cache: 64 150
    Swap: 0 0 0
    [email protected]:/tmp# cd

  65. June 17th, 2015 at 03:15 | #65

    Hello there, I do need additional explanation for 2 lines in the tutorial
    Things are not obvious to me.
    Thank for helping.

    === Value of Count parameter ===

    sudo dd if=/dev/sdb of=2012-07-15-wheezy-raspbian-minimal.img count=3788800

    How the value of count is evaluated? Where can I find the equivalent value for my latests raspbian?

    === Value of 512*122880 ===
    sudo mount -o loop,offset=$((512*122880)) 2012-07-15-wheezy-raspian-minimal.img mnt

    How this value is calculated. I did make different package removal and I wonder which value I should use.

  66. Julio
    July 12th, 2015 at 02:03 | #66

    Thanks, great post!!!!

  67. Chris Sparks
    August 1st, 2016 at 00:37 | #67

    How about a minimal Raspian for the 2016 Jessie version? I have an RPi3 and If I tried to burn this onto an sdcard it may not even work.

  1. August 3rd, 2012 at 16:01 | #1
  2. August 7th, 2012 at 17:12 | #2
  3. August 13th, 2012 at 10:34 | #3
  4. March 11th, 2013 at 02:26 | #4
  5. July 5th, 2013 at 16:15 | #5
  6. December 20th, 2013 at 01:50 | #6
  7. December 30th, 2013 at 17:25 | #7
  8. March 9th, 2014 at 22:43 | #8
  9. March 11th, 2014 at 20:25 | #9
  10. April 21st, 2014 at 02:16 | #10
  11. May 23rd, 2014 at 12:54 | #11
  12. August 8th, 2014 at 11:22 | #12
  13. December 9th, 2014 at 17:36 | #13
  14. January 19th, 2015 at 20:20 | #14
  15. April 26th, 2015 at 08:23 | #15
  16. May 12th, 2015 at 20:27 | #16
  17. August 4th, 2015 at 18:44 | #17
  18. August 4th, 2015 at 19:27 | #18
  19. August 6th, 2015 at 14:50 | #19
  20. October 13th, 2015 at 15:15 | #20
  21. November 21st, 2015 at 04:47 | #21