RaspberryPi4 RPi4 Upgrading from existing SD card setup to boot from SSD

Wanted to put this together as I just succeeded in doing this and I didn’t see a specific setup listed here. This is just what worked for me, so don’t take it as the definitive guide.

If done successfully, you can simply clone over your existing files and configuration without needing to do a clean install.

SSDs, especially NVMe M.2 drives are a huge leap above traditional microSD cards. Big boost in read/write speeds, but also IOPS. Can make a lot of applications much more snappy

I assume you have a functioning RPi4 that’s running nicely off of a microSD card.
I also assume you have a separate laptop/desktop running WIndows or Linux with storage>> microSD card and a means to connect the microSD and the SSD USB adapter

Acquire:

  1. A decent NVMe M.2 stick for your budget. I got a Samsung 970 EVO Plus NVMe M.2 drive for $70, which at the moment is the fastest listed on https://storage.jamesachambers.com/fastest/. Any decent card should be a big boost, so do the math and take your pick.
  2. A GOOD NVMe M.2 USB adapter. The RPi4 is quirky so WHO KNOWS if something allegedly compatible works. I got this:https://www.amazon.com/gp/product/B07NPFV21K/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1
    “UGREEN M.2 NVMe SSD Enclosure, USB C 3.1 Gen 2 to M-Key M&B-Key NVMe PCIe 10Gbps External Enclosure Thunderbolt 3 Compatible with MacBook Pro, WD, Samsung, Toshiba, 2230/2242/2260/2280 NVMe PCIe SSD” model number 60354. They make a number of SSD enclosures that look almost identical, so that’s why I give you the exact model number.
  3. A USB cable (if needed). That specific enclosure comes with a USB type-C to type-C cable that won’t work with the Pi. You want a GOOD cable, else the drive could be janky and give you junky performance. I had one cable that powered the drive but wasn’t recognized, another recognized the drive but it only wrote and read at 32 MB/s.

Smart Idea:

  1. Make sure everything is up to date, rpi-eeprom etc, make a backup of your SDcard system with dietpi-backup

Install:

  1. Install the stick in the enclosure
  2. (Optional) Verify the drive works well. Connect to your RPi4 running and booted off of the SD card. Drive should be visible in dietpi-drive_manager. Mount the drive, format the drive, then run benchmarks with dietpi-config just to make sure everything is playing nicely. You don’t have to do this, but then if something is screwed up you may be backtracking here.
  3. Copy over the system files: Power down the Pi. Pop out the microSD card, connect to another computer (I used alaptop running Windows and clone the microSD card as an .img on another computer. I used Win32 Disk Imager to create the .img, then connected the SSD to my other computer and flashed the .img using Balena Etcher. I got errors the first two times but succeeded without errors the third time.
  4. Plug the SSD into the pi and boot without a microSD card. If all went well the system should boot basically just the same.
  5. (Optional) Resize the drive. After flashing a 32GB microSD card, the 256GB nvme stick was only recognized as a 32GB partition. Open dietpi-drive_manager and select the partion and resize it. dietpi-drive_manager hung for what felt like a few minutes the first time.
  6. Benchmark and enjoy.


    Notes: I moved from a smaller microSD to a larger SSD. Cloning won’t work moving from a larger microSD to a smaller SSD even if the actual space used is less than the SSD capacity. Same microSD to same SSD size still might give errors if the SSD is even a few bits smaller. I fooled around trying to do a fresh install on the SSD and then use dietpi-backup to try to restore the backup made from my microSD onto my SSD but was unsuccessful. Bright ideas to do this more cleanly would be appreciated.
1 Like

Many thanks for share. Usually I would have expect that you would need to adjust device id’s on /etc/fstab. But seems not necessary :slight_smile:

When cloning the SD card with this method, the UUIDs are cloned as well, they are part of the meta data stored on the image. So no need to change fstab and cmdline.txt in this case. Indeed the smartest way I would say :sunglasses:.

Only when copying the files from the mounted SD card into another formatted drive would require to adjust UUIDs/mounts, but it as well would require to assure correct partitioning and installing the bootloader, which is located in front of the partition, so is not part of the file system :wink:.

chucklesmcgee
Many thanks for sharing, this works for most other SBCs as well, as long as they generally support boot from SSD/USB drive like RPi 3 and RPi 4.

I tried cloning using balena etch, rpi-clone and also clonezilla but pu doesn’t start. I get a timed out error. Any ideas please? Seems in raspbian there’s just a menu option in raspi-config to boot from a USB drive. What am I missing with it:)?

Try to add boot_delay=5 or boot_delay=10 to grant the external drive more time to get ready. But since the config file / boot partition is already read at this point, I’m not sure about the effect. Just a simple thing to test.

Can you show the exact error message, so we can be sure at which stage what timed out?

Hi,

Sorry for my noob attitude… If I good understand, I need :

Update eeprom
sudo dietpi-config - advanced - eeprom

Plug and format ssd

Clone all sdcard to ssd with rpi-clone ?
sudo rpi-clone sdX -f

Change PARTUUID ( obtain with lsusb )
sudo nano /boot/cmdline.txt

Edit fstab :
sudo nano /etc/fstab
edit partuuid of /

Shutdown, then boot with ssd ?

What do you think? I’m wrong ?

Thanks :smiley:

Well just update eeprom via dietpi-config. Once done pull SD card from your RPi, plug it to a windows box, used Win32 Disk Imager to create an .img file, then connected the SSD to your computer and flashed the .img using Balena Etcher.

More easy, thanks you :slight_smile:

Don’t need to edit cmdfile and fstab ?
Can I remove sd card for booting or it’s need SD card + SSD?

Let me quote the steps from first post

Install:

  1. Install the stick in the enclosure
  2. (Optional) Verify the drive works well. Connect to your RPi4 running and booted off of the SD card. Drive should be visible in dietpi-drive_manager. Mount the drive, format the drive, then run benchmarks with dietpi-config just to make sure everything is playing nicely. You don’t have to do this, but then if something is screwed up you may be backtracking here.
  3. Copy over the system files: Power down the Pi. Pop out the microSD card, connect to another computer (I used alaptop running Windows and clone the microSD card as an .img on another computer. I used Win32 Disk Imager to create the .img, then connected the SSD to my other computer and flashed the .img using Balena Etcher. I got errors the first two times but succeeded without errors the third time.
  4. Plug the SSD into the pi and boot without a microSD card. If all went well the system should boot basically just the same.
  5. (Optional) Resize the drive. After flashing a 32GB microSD card, the 256GB nvme stick was only recognized as a 32GB partition. Open dietpi-drive_manager and select the partion and resize it. dietpi-drive_manager hung for what felt like a few minutes the first time.
  6. Benchmark and enjoy.

Thanks, I buy my SSD, Waiting receive and I will test :slight_smile:

Thanks again !

Hi,

It’s working :wink:

Thanks so much :smiley:

thx for confirmation that the procedure is working for you as well. :smiley:

For those want to know, I buy (120gb), I plugged to the USB2 because not recognize on the USB 3.0, Maybe it’s my cable or something like that, I need to retry with new cable :wink:

https://www.amazon.fr/PNY-CS900-Disque-Flash-Interne/dp/B01KFLH1WS/ref=sxts_sxwds-bia-wc-drs1_0?__mk_fr_FR=ÅMÅŽÕÑ&cv_ct_cx=ssd&dchild=1&keywords=ssd&pd_rd_i=B01KFLH1WS&pd_rd_r=8fca4e73-c4c5-4a97-b652-2383d885ef2b&pd_rd_w=VNix6&pd_rd_wg=V5RFA&pf_rd_p=4c2d8571-1208-434a-9236-4aacf92decb8&pf_rd_r=WATDW85N80EDGP4N331Y&psc=1&qid=1606309381&sr=1-1-69f2aa40-4718-4485-ba0d-6c4119696677

and

https://www.amazon.fr/Boîtier-POSUGEAR-Externe-Compatible-Transparente/dp/B077XVTTJC/ref=sxts_sxwds-bia-wc-drs1_0?__mk_fr_FR=ÅMÅŽÕÑ&cv_ct_cx=ssd+usb&dchild=1&keywords=ssd+usb&pd_rd_i=B077XVTTJC&pd_rd_r=6369c299-fbc8-4733-817e-05fbd97fd6d3&pd_rd_w=TPP2U&pd_rd_wg=4ovEC&pf_rd_p=4c2d8571-1208-434a-9236-4aacf92decb8&pf_rd_r=JP33RDBPS6YAMCQ697QD&psc=1&qid=1606309394&sr=1-1-69f2aa40-4718-4485-ba0d-6c4119696677

:wink:

Regarding USB boot on USB3, probably you are suffering from this issue as well https://github.com/MichaIng/DietPi/issues/3858
A solution is provided on the last post. Maybe you can give it a try.

I just do this :
echo -e ‘blacklist uas\nblacklist sg’ > /etc/modprobe.d/disable_uas.conf

Nothing change for me, SSD ON USB 3 not booting

I have this

As I see you reported this in Github as well. Ok I guess MichaIng will have a look.

Yes because I think it’s the better place, If I boot successfully, I will reported here :wink:

Sorry, but it also does not work for me.

I followed the “instructions” and ended up with the dietpi/raspberry pi boot screen saying

SD card not detected
Failed to open device: ‘sdcard’

And I was wondering how the Raspi should “know” that it now has to boot from the attached USB/SSD instead of the formerly used sd-card.

My setup:

Raspberry Pi 4
bootloader: a5e1b95f Apr 16 2020
boot: mode 6 order 0x00000001 rsts 0x00001000

Your BL is old

Try to do this :

sudo nano /etc/default/rpi-eeprom-update
change to beta like :
FIRMWARE_RELEASE_STATUS=“beta”
Exit and save
sudo rpi-eeprom-update

root@raspberrypi:/home/dietpi/Jdownloader/cfg# sudo rpi-eeprom-update
BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: mardi 24 novembre 2020, 15:08:04 (UTC+0000) (1606230484)
LATEST: mardi 24 novembre 2020, 15:08:04 (UTC+0000) (1606230484)
FW DIR: /lib/firmware/raspberrypi/bootloader/beta
VL805: up-to-date
CURRENT: 000138a1
LATEST: 000138a1

You will have this after reboot :wink:

Thank you so much… this time it worked!

Problem solved!