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

Guides and tutorials for various stuff. Posted by DietPi users.
chucklesmcgee
Posts: 24
Joined: Tue Jun 02, 2020 7:19 pm

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

Post by chucklesmcgee »

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/B07NP ... 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.
User avatar
Joulinar
Posts: 2597
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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 :)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

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 8).

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 ;).

@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.
Designdev
Posts: 1
Joined: Wed Nov 04, 2020 7:29 pm

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

Post by Designdev »

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:)?
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

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?
billouetaudrey
Posts: 7
Joined: Sun Nov 22, 2020 10:38 am

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

Post by billouetaudrey »

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 :D
User avatar
Joulinar
Posts: 2597
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
billouetaudrey
Posts: 7
Joined: Sun Nov 22, 2020 10:38 am

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

Post by billouetaudrey »

Joulinar wrote: Sun Nov 22, 2020 1:19 pm 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 :)

Don't need to edit cmdfile and fstab ?
Can I remove sd card for booting or it's need SD card + SSD?
User avatar
Joulinar
Posts: 2597
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
billouetaudrey
Posts: 7
Joined: Sun Nov 22, 2020 10:38 am

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

Post by billouetaudrey »

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

Thanks again !
Post Reply