• Welcome to Peterborough Linux User Group (Canada) Forum.
 

RPi 4 set up with SSD booting using BerryBoot

Started by fox, January 15, 2021, 03:35:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fox

I have finally set up my Pi 4 to boot directly from an SSD plugged into my USB 3 port, with no SD card installed. It wasn't easy, at least it wasn't easy using BerryBoot, which I wanted to use in order to have multiboot capabilities. The main source of information for how to do this was:here. The key is to first set up your SD card, then add the necessary firmware to allow booting from USB (if you don't already have), to modify the cmdline.txt file on your SD card, and to image the SD card onto the usb drive you want to boot from. At that point you can shut down, remove the SD card, and boot. Once I did the cmdline.txt modification correctly, it worked. I am now writing from Raspberry Pi OS on a 120 GB SSD. Seems to work pretty well.

I should mention that I started out with the instructions in this video. Unfortunately, this didn't work; it was meant for a single booting installation, and BerryBoot needs a bit more modification. If you want to try this on your own, start with the second video to get a general sense of what you're working with, then look at the first for doing it with BerryBoot.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

Jason

I assume it's much faster than the SD card but is it fast as you'd expect with an SSD? Does it feel like a new computer? That is, like a new or faster RPi, not a new PC.

Thanks for the tips. I've moveded this to the tips section because it's valuable information that deserves a higher status than being buried in General.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

While it is faster than running the Pi from an SD card, it isnââ,¬â,,¢t faster than running it from the same SSD while doing the initial booting from the SD card. In fact the boot up this way seems slower than the second option. BerryBoot makes it easy to set up the second option because when installing, it asks whether you want to run the distro from the SD card, a USB drive plugged into the Pi, or a network boot. The only disadvantage of running your distro with the initial part of the boot from the SD card is that the SD card is supposed to have a much more limited lifespan than a hard drive or SSD and if the SD card gets corrupted, the Pi wonââ,¬â,,¢t boot.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

Jason

Interesting. Isn't there an app on the Raspberry Pi for backing up the SD card? I guess you could just use dd if you have to. In any case, it'd be interesting if you did some benchmarks. You can use dd to test writes and reads. Because I'm wondering if the drive is slowed down by having to connect via USB. I'm not sure how fast USB 3 (that's what it comes with, right?) is compared to the SSD.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

#4
There is such an application; it's called Raspberry Pi imager. I used it to clone the SD card onto my SSD drive as part of the boot-from-SSD project. I can try doing some benchmarks. USB 3.0 is slow compared to USB 3.1, but it's fast enough to run Linux pretty well on a computer. I did it for awhile to keep from having to install an internal SSD in an older iMac. However, the SSD I am using for this project is pretty old and slow. I can't remember the brand, but it's a 120 GB SSD and it's one of the first ones I ever bought, maybe 10 years ago. If I was serious about using the Pi as a computer, I would use a Samsung T7. I'm sure it would be at least twice as fast as the one I'm using.

Incidentally, I added several distros to my RPi SSD yesterday - Ubuntu 20.04 server, Nextcloud, OpenMediaVault and Kodi. Ubuntu 20.04 server froze before completing bootup; I'll try that one with the SD card in to see if that was the problem. Kodi seems to work well. Nextcloud and OpenMediaVault both boot up to command line, but don't do much else. This is probably because I'm not plugged into Ethernet, and I don't know how to connect them to wifi from the command line. For those, I'm going to take the Pi downstairs where I can make a wired connection and see what happens.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

ssfc72

Well done Mike!  You should make a YouTube video about the steps you took to use Berryboot, to boot the RPi 4 from the SSD.  You would become famous. :-)

Quote from: fox on January 15, 2021, 03:35:23 PM
I have finally set up my Pi 4 to boot directly from an SSD plugged into my USB 3 port, with no SD card installed. It wasn't easy, at least it wasn't easy using BerryBoot, which I wanted to use in order to have multiboot capabilities. The main source of information for how to do this was:here. The key is to first set up your SD card, then add the necessary firmware to allow booting from USB (if you don't already have), to modify the cmdline.txt file on your SD card, and to image the SD card onto the usb drive you want to boot from. At that point you can shut down, remove the SD card, and boot. Once I did the cmdline.txt modification correctly, it worked. I am now writing from Raspberry Pi OS on a 120 GB SSD. Seems to work pretty well.

I should mention that I started out with the instructions in this video. Unfortunately, this didn't work; it was meant for a single booting installation, and BerryBoot needs a bit more modification. If you want to try this on your own, start with the second video to get a general sense of what you're working with, then look at the first for doing it with BerryBoot.
Mint 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

fox

#6
I will keep updating this section as I learn more and try more tests. One quick update: Ubuntu 20.04.1 server, packaged from BerryBoot, wouldn't boot even after I tried reinstalling it with the SD card in. That doesn't necessarily mean it wouldn't install and run if I just used the SD card. That card is now set up to refer to the SSD, even if it does install on the card. I would have to set up the SD card from scratch to really determine if it works, as I have altered some of the booting parameters. I'm not interested in doing that. I was not interested in the Ubuntu server per se, but only as a means of installing NextCloud following Jason's instructions. I can still do that, but I wouldn't do it on BerryBoot.

One other thing I noticed. I installed Thunderbird on Raspberry Pi OS and even running it from the SSD, it is very slow to load. (Takes about 10 seconds.) Once it loads, it's very responsive, so I don't know why the loading is so slow. Nothing else I've tried is so slow. LibreOffice, Firefox and Chromium load slower than on a regular i5 computer, but still within 3 seconds. I also tried some file transfer from a USB 3 stick to the SSD in Raspberry Pi OS. I didn't time it, but transferring a lot of gigabytes at a time seemed pretty slow. For example, it took several minutes to transfer 5 gb of music files to the SSD. And trying to start up any program while doing this transfer meant a long delay in the start-up. Again, remember that although I'm using an old, slow SSD. The USB stick is a PNY 128gb USB 3.0. This was the same USB stick that I previously used in my Pi 3B with Raspbian, and found it to be slower than the SD card!
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

fox

#7
OK, I ran Agnostics speed test in Raspberry Pi OS running on my SSD (no SD card). Here are my results:

=================
Test : SD Card Speed Test - Samsung EVO plus 32gb
Run 1
prepare-file;0;0;210051;410
seq-write;0;0;219919;429
rand-4k-write;0;0;23813;5953
rand-4k-read;16241;4060;0;0
Sequential write speed 219919 KB/sec (target 10000) - PASS
Random write speed 5953 IOPS (target 500) - PASS
Random read speed 4060 IOPS (target 1500) - PASS
Test PASS
===============
Here are the results running the same distro from the SD card (no SSD plugged in):
Test : SD Card Speed Test
Run 1
prepare-file;0;0;7903;15
seq-write;0;0;10659;20
rand-4k-write;0;0;3065;766
rand-4k-read;7806;1951;0;0
Sequential write speed 10659 KB/sec (target 10000) - PASS
Random write speed 766 IOPS (target 500) - PASS
Random read speed 1951 IOPS (target 1500) - PASS
Test PASS
=================================
Clearly the SSD is much faster than the SD, and my SD card is a pretty fast one (Samsung EVO plus 32 gb). Furthermore, I tried starting up programs on the SD card. Both Firefox and Chromium were slower, taking almost twice as long. LibreOffice was hard to tell, as the first startup was clearly slower, but thereafter it was at least as fast. I didn't have Thunderbird installed to test that one. In any event, there is a clear advantage to running a Pi distro from an SSD instead of an SD card.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

Jason

Quote from: fox on January 16, 2021, 09:44:29 AM
One other thing I noticed. I installed Thunderbird on Raspberry Pi OS and even running it from the SSD, it is very slow to load. (Takes about 10 seconds.) Once it loads, it's very responsive, so I don't know why the loading is so slow.

Check to see the type of package it is. If it's a Snap package, they take longer to run the very first time. But it should be just the very first time ever, not every session. But maybe it's also because Thunderbird is checking your email as it loads up and if it's IMAP, it can take longer because of the syncing. You can also use the system monitor tool to see how RAM it uses and how much you were using when you loaded it up. I've found that my RPi 3 works well if I only use 1-2 programs a time, more than that and it really lags. Modern browsers like Firefox and Chromium are major memory hogs and I would expect that LibreOffice is, too.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

Jason

#9
Adding an SSD to any machine (in place of an SD card, USB stick, or HDD) will drastically increase its performance. I find it's like getting a new computer. Going from a slow SSD drive to a faster one can also feel like that. The slowest component on any system, the bottleneck is reading/writing to storage, especially reading since that's what your computer is doing all the time, every time you open a program or open a file. Additionally, your computer tries to guess ahead of time what processes you're going to use next and loads them into a cache so lots of reading even when you're not doing anything.

Thanks for showing the benchmarks. I expected them to be quite startling, also comparing a pretty decent SSD drive to the SD card alone.

Now back to watching the new SLS setting on its launchpad before the hot-fire test which should happen sometime within the next hour. Not sure why they can't be more specific but it's NASA.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

Quote from: Jason Wallwork on January 16, 2021, 04:54:59 PM
Check to see the type of package it is. If it's a Snap package, they take longer to run the very first time. But it should be just the very first time ever, not every session. But maybe it's also because Thunderbird is checking your email as it loads up and if it's IMAP, it can take longer because of the syncing. You can also use the system monitor tool to see how RAM it uses and how much you were using when you loaded it up. I've found that my RPi 3 works well if I only use 1-2 programs a time, more than that and it really lags. Modern browsers like Firefox and Chromium are major memory hogs and I would expect that LibreOffice is, too.
I don't think that Raspberry Pi OS is set up with snaps, but in any case, the slow loading of Thunderbird isn't just the first time. It could be the synching, but I think it's something else because it takes all that time just to get the window. Thunderbird on my iMac in Ubuntu 20.10 doesn't even take 2 seconds to load to the window. The syncing happens after the window is shown.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

Jason

I think you're right about snaps. I forgot that snaps are a Ubuntu thing. There are similar alternatives like FlatPak but that anybody can use. Snaps are something that Ubuntu controls and I believe that Raspberry Pi OS is based on Debian. Di you do a search online for issues with Thunderbird starting up slowly on the Pi? I did a quick search and found this. I don't know if there is a solution, it was just the result that looked most relevant to me. The Pi forums might help you generally.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

Thanks, Jason. I didn't think of doing a Google search and I should have. Based on the thread you posted the link to, the problem is either with the current version of Thunderbird or with its interaction with Raspberry Pi OS. Good to know. And it seems that my problem with the slow startup is minor compared to the other folks who posted on that thread. I'm sure that it will be fixed eventually, and since I'm just playing with the RPi and not using it for real work, the slow start of Thunderbird is of little consequence to me. If I was serious about using the RPi as a desktop machine, I could either downgrade Thunderbird, use Claws Mail (installed with Raspberry Pi OS), or install another email client.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13