I mount the SD card on boot with the following line in /etc/rc.local:

mount /dev/sda2 /media/USB_OC > /home/pi/logs/USB_mount_log 2>&1

This was working perfectly until an apt-get upgrade and now it fails with:

mount: special device /dev/sda2 does not exist

This line still works manually however. So I've added sleep 10 above it in rc.local, and now it mounts ok on boot. But I'm a bit uneasy implementing hacky workarounds like this without understanding the underlying cause. Is there a better solution?

  • 3
    Why not just add a fstab entry like everyone else.
    – Milliways
    Commented May 8, 2016 at 9:24
  • How long ago was the previous time you ran apt-get upgrade?
    – goldilocks
    Commented May 8, 2016 at 12:07
  • Just yesterday.
    – geotheory
    Commented May 8, 2016 at 16:08

1 Answer 1


/etc/rc.local is custom init script and commands added here are run at boot-time. Nothing guarantee at that time your peripheral devices were properly powered up before your mount command get execute. And the hack sleep 10 is a proof.

I suggest you should mount your card at boot with /etc/fstab instead.

  • 2
    there's also no guarantee (not 100% anyway) that the device will always be /dev/sda - for example add another USB drive and reboot ... if you must use fstab, "real" admins use UUID=.... Commented May 9, 2016 at 4:17
  • yes, at least use LABEL to differentiate devices in 'fstab', I personally use UUID too :)
    – Aura
    Commented May 9, 2016 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.