{"id":2524,"date":"2020-06-29T12:27:36","date_gmt":"2020-06-29T02:27:36","guid":{"rendered":"https:\/\/jandmf.com\/?p=2524"},"modified":"2020-06-29T12:27:38","modified_gmt":"2020-06-29T02:27:38","slug":"usb-boot","status":"publish","type":"post","link":"https:\/\/jandmf.com\/index.php\/2020\/06\/29\/usb-boot\/","title":{"rendered":"USB Boot"},"content":{"rendered":"<div id=\"pl-2524\"  class=\"panel-layout\" ><div id=\"pg-2524-0\"  class=\"panel-grid panel-no-style\" ><div id=\"pgc-2524-0-0\"  class=\"panel-grid-cell\" ><div id=\"panel-2524-0-0-0\" class=\"so-panel widget_text panel-first-child panel-last-child\" data-index=\"0\" ><h3 class=\"widget-title\">Why ?<\/h3>\t\t\t<div class=\"textwidget\"><p>Why USB boot ? Well for a start I&#8217;m a tinkerer who just can&#8217;t leave things alone. Secondly I&#8217;ve had an SD card fail and didn&#8217;t want to go down that path again &#8211; maybe I should&#8217;ve got better cards ? And thirdly I&#8217;ve always, rightly or wrongly, regarded the SD card boot scenario a bit clumsy.<\/p>\n<p>I got rid of some of the clumsiness by <a href=\"https:\/\/jandmf.com\/index.php\/2019\/11\/01\/moving-the-root-partition\/\">moving the root partition <\/a>to a 1TB Toshiba X1 portable SSD. This was easily done and was a great success. I still had a bit of SD clumsiness though which I wanted to get rid of.<\/p>\n<p>Then along came the announcement of USB booting and for once in my life I didn&#8217;t leap into the deep end with the first BETA. I waited until the BETA was elevated to STABLE and then leapt into the deep end.<\/p>\n<p>What follows is what I did to get it working.<\/p>\n<\/div>\n\t\t<\/div><\/div><\/div><div id=\"pg-2524-1\"  class=\"panel-grid panel-no-style\" ><div id=\"pgc-2524-1-0\"  class=\"panel-grid-cell\" ><div id=\"panel-2524-1-0-0\" class=\"so-panel widget_text panel-first-child\" data-index=\"1\" ><h3 class=\"widget-title\">First steps<\/h3>\t\t\t<div class=\"textwidget\"><p>The first thing to do was to get my hands on another portable SSD.\u00a0 This time it was a Seagate 1TB portable SSD. Not cheap but hey, you can&#8217;t let money stand in the way of a bit of tinkering, can you ?<\/p>\n<p>The second thing to do was to make sure that my existing installation was completely up to date by doing &#8220;sudo apt update&#8221; followed by &#8220;sudo apt full-upgrade&#8221;. Because I hadn&#8217;t done this for a while there were about sixty packages updated. While I was at it I had a look to see what I could get rid of and removed a couple of packages that I didn&#8217;t require.<\/p>\n<p>Next on the list was to update the boot loader and get it configured. That&#8217;s the bit the seemed a bit daunting at the start.<\/p>\n<\/div>\n\t\t<\/div><div id=\"panel-2524-1-0-1\" class=\"so-panel widget_text\" data-index=\"2\" ><h3 class=\"widget-title\">Update the bootloader<\/h3>\t\t\t<div class=\"textwidget\"><p>I was a bit worried about this bit but only because I had no real backout plan if it all went badly. I needn&#8217;t have worried.<\/p>\n<p>First up I had a look at &#8220;\/lib\/firmware\/raspberrypi\/bootloader\/&#8221; and saw that there was a &#8220;stable&#8221; directory and saw that there was &#8220;pieeprom-2020-06-15.bin&#8221; which was what I was after according to <a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?f=63&amp;t=277007&amp;start=50\" target=\"_blank\" rel=\"noopener\">this topic <\/a>on the Raspberry Pi forum.<\/p>\n<p>Because I have a second Pi that USB boots 64 bit Raspbian that I set up a couple of weeks ago I had already done a lot of reading about the configuration. The story of the second Pi is <a href=\"https:\/\/jandmf.com\/index.php\/2020\/05\/29\/pi-4-usb-boot-and-64bit-raspbian\/\">here<\/a>.<\/p>\n<p>Anyway I&#8217;m jumping the gun a bit here. Before updating the bootloader I downloaded the latest version of <a href=\"https:\/\/www.raspberrypi.org\/downloads\/raspberry-pi-os\/\" target=\"_blank\" rel=\"noopener\">Raspberry Pi OS<\/a> and using the <a href=\"https:\/\/www.raspberrypi.org\/downloads\/\" target=\"_blank\" rel=\"noopener\">Raspberry Pi Imager<\/a> I set my Seagate portable SSD up with it. While that was happening I got the bootloader updated and configured. Easily done in a few steps.<\/p>\n<p>I needed a configuration so I used the one from my 64 bit Pi :-<\/p>\n<p>[all]<br \/>\nBOOT_UART=0<br \/>\nWAKE_ON_GPIO=1<br \/>\nPOWER_OFF_ON_HALT=0<br \/>\nDHCP_TIMEOUT=45000<br \/>\nDHCP_REQ_TIMEOUT=4000<br \/>\nTFTP_FILE_TIMEOUT=30000<br \/>\nENABLE_SELF_UPDATE=1<br \/>\nDISABLE_HDMI=0<br \/>\nBOOT_ORDER=0xf41<\/p>\n<p>I got this by doing vcgencmd bootloader_config &gt; bootconf.txt on my 64 bit USB booting Pi. It was a simple matter to copy that to my non USB booting Pi.<\/p>\n<p>Back to the 32 bit Pi and I did &#8220;rpi-eeprom-config &#8211;out pieeprom_new.bin &#8211;config bootconf.txt\u00a0 \/lib\/firmware\/raspberrypi\/bootloader\/stable\/pieeprom-2020-06-15.bin&#8221; \u00a0which gave me a new bootloader called pieeprom_new.bin to install.<\/p>\n<p>Installing the bootloader was my mental sticking point. Up to this point I had a working system with the root partition on an SSD and the \/boot partition still on an SD card. Would it still boot after the new bootloader was installed ? I certainly hoped so!<\/p>\n<p>Anyway I went ahead confident that I could roll it back to the old non USB booting model simply by installing the bootloader from the &#8220;critical&#8221; directory. Anyway I did a &#8220;sudo rpi-eeprom-update -d -f .\/pieeprom_new.bin&#8221; followed by a reboot and it booted just fine. I did a &#8220;vcgencmd bootloader_version&#8221; and a &#8220;vcgenccmd bootloader_config&#8221; and was greeted by the new version and the new configutation. It had worked and my web server \/ samba \/ other stuff system worked as it it always did.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n\t\t<\/div><div id=\"panel-2524-1-0-2\" class=\"so-panel widget_text\" data-index=\"3\" ><h3 class=\"widget-title\">Making the new boot SSD<\/h3>\t\t\t<div class=\"textwidget\"><p>Now to the fun part.<\/p>\n<p>Remember the SSD that I made with the latest Raspberry Pi OS ? Well now its time to shine has arrived.<\/p>\n<p>I plugged it into the Pi and copied \/boot\/*.elf and \/boot\/*.dat to the boot partition of the SSD. I closed the Pi down (sudo poweroff and unplug the power) and unplugged the original SSD and the SD card leaving the new SSD plugged in. I plugged the power in and lo and behold it booted OK and I went through the whole setup process. That&#8217;s half the job done. The brand new SSD had the boot and root partitions and all was right with the world.<\/p>\n<p>I powered off again and rebooted the original configuration &#8211; SD + SSD (Toshiba). The new Seagate was plugged in and I formatted the root partition &#8220;mkfs -t ext4 \/dev\/sdxx&#8221; and mounted the new empty, clean partition in \/mnt. Then came &#8220;rsync -axv \/ \/mnt&#8221; There&#8217;s about 700 GB in that partition so it was going to take a while so I went to bed.<\/p>\n<p>One caveat here. If I plug both SSD&#8217;s into USB-3 ports it <em>will<\/em> fail at some point probably, I think, because it&#8217;s on the edge of the available power from a genuine Pi power supply. If I plug one of the SSD&#8217;s into a USB-2 port it&#8217;ll work OK so I did that which made it a lot slower.<\/p>\n<\/div>\n\t\t<\/div><div id=\"panel-2524-1-0-3\" class=\"so-panel widget_text panel-last-child\" data-index=\"4\" ><h3 class=\"widget-title\">It worked<\/h3>\t\t\t<div class=\"textwidget\"><p>The next morning, after a couple of cups of coffee, I had a look at what happened overnight. The &#8220;rsync&#8221; had completed without error.<\/p>\n<p>At this point I needed to copy from the SD card config.txt and cmdline.txt to the new SSD so I did that. I also needed to edit cmdline.txt to make sure that the PARTUUID pointed to my new SSD. On the new SSD I needed to edit \/etc\/fstab to put in the new PARTUUID&#8217;s for the boot and root partitions.<\/p>\n<p>At this point I was very hopeful but not certain that it would work out properly but I went ahead and powered the Pi down and removed the original SD and SSD and plugged the new SSD into a USB-3 port and plugged the power in. Success. Everything works OK. This web site works OK as does Samba and everything else.<\/p>\n<p>The whole operation was a success. Apart from the &#8220;rsync&#8221; it only took about half an hour. Because of the sheer quantity of &#8220;stuff&#8221; the &#8220;rsync&#8221; was a lengthy affair.<\/p>\n<p>The next step will be to update with Raspberry Pi OS 64bit when that becomes prime time. I&#8217;m sure\u00a0<em>that<\/em> won&#8217;t be a simple upgrade like this ended up being.<\/p>\n<\/div>\n\t\t<\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Why USB boot ? Well for a start I&#8217;m a tinkerer who just can&#8217;t leave things alone. Secondly I&#8217;ve had an SD card fail and didn&#8217;t want to go down that path again &#8211; maybe I should&#8217;ve got better cards ? And thirdly I&#8217;ve always, rightly or wrongly, regarded the SD card boot scenario a &hellip; <a href=\"https:\/\/jandmf.com\/index.php\/2020\/06\/29\/usb-boot\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;USB Boot&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-2524","post","type-post","status-publish","format-standard","hentry","category-pi"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/posts\/2524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/comments?post=2524"}],"version-history":[{"count":16,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/posts\/2524\/revisions"}],"predecessor-version":[{"id":2540,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/posts\/2524\/revisions\/2540"}],"wp:attachment":[{"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/media?parent=2524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/categories?post=2524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jandmf.com\/index.php\/wp-json\/wp\/v2\/tags?post=2524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}