RESEARCH: Booting from HDD/SSD drive #3945
Replies: 32 comments
-
'To enable the USB boot bit, the Raspberry Pi 3 needs to be booted from an SD card with a config option to enable USB boot mode. Once this bit has been set, the SD card is no longer required. Note that any change you make to the OTP is permanent and cannot be undone.' https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md |
Beta Was this translation helpful? Give feedback.
-
@openoms You don't have to do this for the Pi 3B+ and later Pi's the bit is set when it's made (factory set). That's why, as I said in my post, that my unmodified Pi boots the stock Raspbian from USB OK. from that link... "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 programmmble) memory." |
Beta Was this translation helpful? Give feedback.
-
ok, that is right. Most of the issues seems to be sorted on the 3+. Still it is possible that some USB drives don't work as expected as it is described in this blog post linked from the one above: https://www.raspberrypi.org/blog/pi-3-booting-part-i-usb-mass-storage-boot/ |
Beta Was this translation helpful? Give feedback.
-
Thanks for the link. Might refer to it if I have problems. But the article is from 2016 so it prob is of little help since Raspbian and potentially many USB drives may have changed quite a bit since then. |
Beta Was this translation helpful? Give feedback.
-
Things learned so far:
|
Beta Was this translation helpful? Give feedback.
-
Some Bootup info: https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/bootflow.md It looks most likely this is what I'm missing. Will have to try this:
This also needs testing:
And see if there is any workaround for this:
|
Beta Was this translation helpful? Give feedback.
-
That worked. It booted up and LCD now says
after doing the above, the config looks like this: (for Pi boards older than the 3B+) run:
Partitions with HDD not connected yet... |
Beta Was this translation helpful? Give feedback.
-
FYI Just ran @openoms DietPi build script on a USB flash drive and it boots with the same minor change to the /boot/cmdline.txt file: #244 (comment) |
Beta Was this translation helpful? Give feedback.
-
Booted Raspiblitz from USB via DietPi build script (#244 (comment)) it seems perhaps it did find the blockchain DB on /dev/sda1 (HDD) and booted from /dev/sdb1 ... admin@DietPi:/home/bitcoin/.bitcoin $ lsblk |
Beta Was this translation helpful? Give feedback.
-
I wonder what governs which device will become sda or sdb? The SD at least is reliably distinct. It supposed to depend on the physical address of the device so I presume if you swap the usb ports the HDD and USBdrive is plugged in, they can change places being sda or sdb? Need to test this. More on this: |
Beta Was this translation helpful? Give feedback.
-
Good question.
Yes, the script already looks for this label and is how it determines it. I remember reading it is stated that the drive must be formatted Ext4 and labelled "BLOCKCHAIN".
|
Beta Was this translation helpful? Give feedback.
-
@openoms maybe the sda/sdb device assignment has to do with entries in /etc/fstab ; perhaps it's OS dependant and assigns sda/sdb via PARTUUID's before UUID's? anyway, I think it doesn't matter given the scripts are looking for the BLOCKCHAIN label. my fstab:
|
Beta Was this translation helpful? Give feedback.
-
To boot from USB I had to edit _bootstrap.sh. The HDD search is hardcoded /dev/sda. Can boot from USB be a cause of #1070 ? |
Beta Was this translation helpful? Give feedback.
-
When updating to v1.5 I got it working with USBdrive, no SDcard. |
Beta Was this translation helpful? Give feedback.
-
afaik this is done by the linux udev system. |
Beta Was this translation helpful? Give feedback.
-
Replacing my Pi3B with 4B. Put image file on USB drive (2020-05-27-raspios-buster-lite-armhf.img) /boot/cmdline.txt: sudo ./build_sdcard.sh (modified version) The script runs without errors. |
Beta Was this translation helpful? Give feedback.
-
This is still needed for v1.6 |
Beta Was this translation helpful? Give feedback.
-
@adevoss what is needed for v1.6? .. to have booting from SSD will most prob come with a future version, but we will not be able to put it into v1.6 |
Beta Was this translation helpful? Give feedback.
-
@rootzoll I didn't mean to say this has to be fixed in v1.6. What I'm trying to say is when testing with v1.6 and blitz.datadrive.sh makes the mount permanent in /etc/fstab it results in a /etc/fstab file that makes the Pi unbootable. I didn't save /etc/fstab but I know that the root partition entry was missing and there was a line with only a disk id. It's a quick fix I know. When my node is running again I will see if I can write a more permanent solution to fix this issue. |
Beta Was this translation helpful? Give feedback.
-
After fixing /etc/fstab the setup process finished with a few errors:
These errors are not related to USB booting so I think USB booting is possible with a few extra steps. Hardware: Pi 4B 2GB, no LCD, wifi diabled and USB and SSD no SDcard Installed: |
Beta Was this translation helpful? Give feedback.
-
Reading #1285 (comment) (dying USB thumb drive) the logs can be held in RAM at the own risk of the user. Logs are gone after reboot. The first reason for me to use an USB thumb drive are the wear of the SD card. This maybe is not solved by the USB thumb drive. Any thoughts on using a thumb drive to boot by anyone? |
Beta Was this translation helpful? Give feedback.
-
@adevoss I dont think a thumb drive for booting or running the OS is an option. Flashing a sd card is a standard practice when operating a RaspberryPi. Most cases give easy access to the sd card. For the future still its the idea to just run the OS the first time (or on update) from sd card and then use an extra partition of the HDD/SSD to run the OS ... but more research and tests needed targeting in the area of a 1.7 or 1.8 release later this year. |
Beta Was this translation helpful? Give feedback.
-
@rootzoll Correct. At this moment another USB thumb drive went read only. I stop using a thumb drive for the OS. |
Beta Was this translation helpful? Give feedback.
-
re reliability of thumbdrives please see this issue: #924 |
Beta Was this translation helpful? Give feedback.
-
I renamed the research issue. Because I think the goal to aim for should be:
I am still not sure if this is possible ... @adevoss do you see any problems in this setup? Open Questions:
|
Beta Was this translation helpful? Give feedback.
-
I think it is. Didn't try to boot from SSD but why should it be different than from an thumbdrive. I don't have a spare SSD (only one for my live node)
Just overwrite the OS partition with a new one. That is the same what is advised for an update now, isn't it?
The bootloader has a boot_order. (https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md see BOOT_ORDER) So booting from SD card is an update. Booting without SD card, no update. |
Beta Was this translation helpful? Give feedback.
-
Sounds good :)
That can be a fallback .. but I would even like if people just keep the sd card in the RaspiBlitz. That would just be confinient (you dont have to search for the sd card, etc) and it can be used as a medium for critical backup data (storing the SCB copy for example). |
Beta Was this translation helpful? Give feedback.
-
I am moving this issue to the v1.7 milestone as a research topic. Because focus for the v1.7 is a refactor of the setup process - so it makes sense to also take a look at HDD/SSD booting in that regard. |
Beta Was this translation helpful? Give feedback.
-
Can be done with Pi 4B. The boot order is SSD then SD card.
Can be done with cron job. |
Beta Was this translation helpful? Give feedback.
-
So I haven't read the full issue here, but just saw this and wanted to share what has worked for me. I have 3 partitions on a 2TB SSD:
I have a spinning HDD on a second local server for encrypted backups of the Pi, and then I also do off-site backups of that second server. It's all custom-hacked via bash scripts, rsync, and cron, nothing fancy. I don't use SD cards as the more experienced Pi people told me that those are not very reliable and degrade quickly. I don't know how bad it is, but I listened, just in case. However, I have a USB stick with much stronger encryption than my SSD from which I read the most sensitive pieces of information (and when I'm not lazy and I know I'll be at home = don't need to reboot remotely, I typically remove it once it's all in RAM). EDIT: Just to clarify, I can boot the system remotely without the USB stick in the device as long as I remember my various passwords. However, I need to carry the USB with me for that to work so I can So yes, the challenging part is remembering the (necessarily) strong passwords (usb stick, root partition, blockchain partition, SSH key password, ...), but I guess that's my mental training to mitigate Alzheimer's ..... |
Beta Was this translation helpful? Give feedback.
-
experimenting with booting an (unmodified) RPi 3B+ from USB with no SD-card present.
First attempt did not work with Etcher burned Raspiblitz image and also using
dd
Then I tried the full Raspbian Desktop image burned with Etcher and it worked.
So certainly it's possible to boot from USB. I'm gonna have to look into more about how @rootzoll is building the Raspiblitz image (build_sdcard.sh). Anyone can help, know why this is?
Beta Was this translation helpful? Give feedback.
All reactions