I know I read about this is the past but I can’t find the relevant posts anymore: to limit the risk of SD card failure I would like to replace the SD card in my emonBase with an SLC flash drive.
I assume that this will be easier than selectively moving just the data filesystem(s) to the flash drive (esp. in terms of future updates)?
I am running emonSD-30Oct18 (OEM pre-built) on a Raspberry Pi 3 Model B+ Rev 1.3 - 1 GB (Sony UK).
Are there any easy to follow instructions lying around?
Not for a pi 3b+, from the rpi website link given earlier in the thread.
The Raspberry Pi 3+ is able to boot from USB without any changes, but the Raspberry Pi 3 requires the USB boot bit to be set in the OTP (one-time programmable) memory. If you are using a Raspberry Pi 3+, please go to the next section.
[Edit] if going down the “small sdcard” route, be aware the very latest “Buster” image has a 256MB boot partition, prevoius boot partitions have all been about 60MB. I have a couple of old 64MB cards I used for this previously.
[edit2] I’m looking forward to hearing what the position is with the Pi4, booting to a USB3 HDD/SSD should be pretty slick.
I am assuming that the Pi won’t boot from the flash until the fstab is fixed. I was planning to do that on the Pi after booting from the SD one last time, but it looks like I should be able to mount the ext4 partition on my Mac.
After you modify /boot/cmdline.txt with the new location of the root filesystem. It’ll start the boot
process from the SD card, then mount and run, the root filesystem from the USB drive even if the
root filesystem entry in /etc/fstab still points to the SD card. (that’s been my experience, YMMV)
That’s if the USB drive isn’t bootable, but contains a root filesystem.
Otherwise, if the USB device is bootable, it’ll boot from the USB device first.
I don’t have any 3B+'s so cannot speak from experience, but since the bit doesn’t need setting and in the RPi guide there is mention of a certain image date as to when this works from, I suspect the PARTUUID may be needed. The “/dev/sad2” was a quick and dirty way of setting up a hdd as the PARTUUID can change when any changes are made to the partitions and so because the emonsd adds a 3rd partition, the “/dev/mmcblk0p2” address has continued to be used for the same reason.
If you boot to the sdcard, then mount the hdd, take note of the PARTUUID prefix (50c2568e ? ) and then edit both the cmdline.txt and fstab to use the PARTUUIDs and partition number ids instead you might have more joy.
The cmdline.txt should have something like root=PARTUUID=50c2568e-02 in place of the root=/dev/sda2 or root=/dev/mmcblk0p2 and the fstab will look something like
This is far more robust but it can be a pain since you must be sure to update the cmdline.txt and fstab before rebooting if changes are made to the partitions.
I do not know for sure if this is the issue, but either way, this is the better method if you can manage the PARTUUID changes (or avoid them by not changing the hdd partitions) because one day you might leave another usb drive attached and reboot (power interruption?) and “sda2” might get assigned to another drive and therefore not boot.
Starting with the 2017-04-10 release of Raspbian you can install a working Raspbian system to a USB mass storage device by copying the operating system image directly onto your USB device, in the same way that you would for an SD card.
This all works like a charm in the end, with the proper power supply and the cmdline.txt change to use PARTUUID. Here is a summary of the instructions for anyone hitting this thread in the future:
The steps below were tested with Pi model 3B+ and the emonSD-30Oct18 image. For older models check out the OTP bit step explained higher up in this thread. The good news is that this is 100% reversible, if you run in trouble remove the USB drive, put the SD card back in and your original system is back.
If you just want to edit the cmdline.txt alone, you can do that on your PC immediately after flashing and then just connect and boot straight to the usb drive, eliminating the steps with a sdcard.
In Ether there is a setting to auto-eject after flashing, it is on by default as a safety measure. I have this turned off so that I can drop a ssh and wpa_supplicant.conf file (and any edits etc) to the /boot partition and then manually eject the usb/sdcard once I’m ready.
Having gone this far i would recommend editing your fstab to use PARtUUIDs too
Good point about editing on the PC, I initially thought I would need to edit the fstab on the ext4 partition as well which is why I went that route.
The emonSD-30Oct18 image already uses them. I wondered how that was possible but they come from the partition table which is burnt in the image, so this shouldn’t need changing.
I am not completely out of the woods yet, the performance is dismal with the flash drive (5mn to log in) after I restored my data, though it could be the drive, or the update (I know run low-write 10.1.1), or a power problem, or a process gone wild…
The fstab should look like this on the Oct2018 image
i say “should” but we have no buildguide to reference for that image, previous images used this and we’ve been told the Oct2018 “is the same”.
Obviously those addresses will not work with your HDD so i assume you are saying they are already using PARTUUID ? If that is the case, then when you enlarge your partitions, which i assume you will do unless you have found yourself a really small hdd, the PARTUUID might well change.