In order to allow me to edit these pages on an offline device, I’ve set up a Raspberry Pi to automatically sync my drafts to an SD card for use with that device. In doing so, I came across an unexpected quirk with USB removable media on the Raspberry Pi I thought I’d document here.

If you’ve used a Raspberry Pi before, you may be used to the desktop experience which automatically mounts USB removable media. Unfortunately, as the desktop isn’t loaded by default when headless, it won’t work in that mode.

You can get all this auto-mounting goodness back by re-enabling the desktop when headless. This can be done by explicity specifying a display resolution using raspi-config:

None

Select ‘7 Advanced Options’

None

Select ‘A5 Resolution’

None

Select any option other than ‘Default’

Following a reboot, volumes will now automatically mount in /media/pi.


Note that it’s important to ensure you unmount your removable media using unmount /path/to/mount. If you are tempted to use sudo when unmounting, auto-mounting will not work again until you reboot.