I recently re-installed my Raspberry Pi after yet another SD card crapped out on me. Instead of running from SD card though, I installed Raspbian on an external USB hard drive …
… on a Raspberry Pi 1 B+!
Yes it is possible! Not in the same way as you would with a Raspberry Pi 3, but it’s definitely doable! OK, so the Pi isn’t booting from the HDD, but the majority of the OS and programmes are running from it. It’s not exactly SD card less, but it significantly reduces the number of writes to the SD card which should vastly increase its lifetime.
I’m not going to go massively into the wheres and hows, suffice it to say the basic method is as follows …
Download the Raspbian (or other OS) image of your choice and burn this to both your SD Card and your HDD (Caution: You will lose all existing files on the HDD so back them up if you need to!)
Plug both the SD card and the HDD into a Linux PC or another already working Raspberry Pi.
Expand the root partition on the HDD. Do this with something like gparted or similar.
Get the PARTUUIDs of the boot partition of the SD card and the rootfs partition of the HDD. Use the blkid command on the Linux PC.
pi@raspberrypi:~ $ blkid /dev/mmcblk0p1: LABEL="boot" UUID="FBD8-71DF" TYPE="vfat" PARTUUID="8be0d8aa-01" /dev/mmcblk0p2: LABEL="rootfs" UUID="e9646bf0-ef1f-4e8b-983b-c9f97f60e931" TYPE="ext4" PARTUUID="8be0d8aa-02" /dev/sda1: LABEL="boot" UUID="FBD8-71DF" TYPE="vfat" PARTUUID="d47c6af0-01" /dev/sda2: LABEL="rootfs" UUID="e9646bf0-ef1f-4e8b-983b-c9f97f60e931" TYPE="ext4" PARTUUID="d47c6af0-02"
Edit /boot/cmdline/txt on the SD CARD and change the PARTUUID to match the PARTUUID of the rootfs partition of the HDD.
pi@raspberrypi:~ $ cat /boot/cmdline.txt dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=d47c6af0-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Edit /etc/fstab on the HDD and change the PARTUUIDs to match the PARTUUIDs of the boot partition of the SD Card and the rootfs partition of the HDD.
pi@raspberrypi:~ $ cat /etc/fstab proc /proc proc defaults 0 0 PARTUUID=8be0d8aa-01 /boot vfat defaults 0 2 PARTUUID=d47c6af0-02 / ext4 defaults,noatime 0 1 # a swapfile is not a swap partition, no line here # use dphys-swapfile swap[on|off] for that
Double check your work before rebooting.
That’s all there is to it …
… and that’s why this version of my site is so sloooooooow; it’s running WordPress on a Raspberry Pi 1 B+ (just because I can!)