When I initially switched the computer portion of my rhythm stage setup over to a Raspberry PI I went with a 32GB SD card because that's recommended. But I don't need very much space for what I'm doing and a bigger SD card makes copies slow: the cheap cards I've been using take me over an hour to write with my Mac's card reader.

I recently made some changes to my setup, removing support for bass whistle on the PI (now that I have an arduino-based version) and adding support for more foot-bass options. This normally means round of re-imaging all of my SD cards: I have a bunch of them because SD card corruption is probably the most common reason my system breaks [1], and it's easy to have extra cards. I'm pretty sick of 82-minute waits, however, so I decided to go down to four-GB SD cards.

I imaged a card with Raspberry Pi OS Lite (64-bit), started setting it up, and immediately ran out of space. Turns out apt-get update and apt-get upgrade can use a lot of space. After apt-get purge and apt-get clean, however, I had about 300MB to spare. It would probably be possible to get a lite distribution to go a lot smaller than this, since the only actually large thing I need is the sound font, fluid-soundfont-gm at 145MB, but this seems to work fine.

Regardless, it works great, and I can now image a card in 15min:

$ time sudo dd if=~/Desktop/rpi-4gb.dmg of=/dev/disk4
7782400+0 records in
7782400+0 records out
3984588800 bytes transferred in 877.723067 secs (4539688 bytes/sec)

real       14m41.556s
user       0m3.299s
sys        0m28.741s


[1] This used to happen a lot, but now mostly doesn't. The hardware hasn't changed, so I think the reason it has stopped happening is that my Raspberry PI is no longer responsible for the bass whistle. My MIDI router doesn't write to the file system, and doesn't read beyond initialization, while the bass whistle version used the file system to persist settings across reboots.

Comment via: facebook, mastodon

New Comment
1 comment, sorted by Click to highlight new comments since:

Depending on your devops pipeline (that is, how often do you reimage with DD, as opposed to updating in place, and what changes you make AFTER imaging), you might consider a few timesaving options:

  1. small root partition, rest as a data partition.  This lets you image only the root with dd.  It's probably FASTER to image a 4GB partition of a 32GB SDCARD than to image a 4GB card directly.  
  2. Go smaller than 4GB (by partition, you probably don't want to buy smaller cards).  RPiOsLite should install in under 1GB, and a very usable commandline system with space for updates in 2GB.   If you only have 300MB free in a 4GB storage, something is wrong.  It may not be worth fiddling with, though.
    For multiple copies of a master, it's common to have a large/fast setup that you install, update, tune, and prepare on, then prepare the image for distribution.  There are lots of options for that, the simplest is to clean and shrink the filesystem, and use that shrunken filesystem as the image to distribute.
  3. use a USB "real" SSD, not an SDCARD.  Rpi4 and above can boot from it, earlier models need to boot from SDCARD, but can have root and all data on usb.  this can be MASSIVELY faster and somewhat more reliable than sdcard.
  4. Probably not worth the effort, but PiLFS or Yocto make it possible to build a "custom application distribution" for your pi.  It will contain only the packages you need, and needs no update mechanism on the devices - to do an update, you rebuild and re-distribute.  It can be TINY and still quite functional.