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:
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.
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.
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:
Make sure everything is up to date, rpi-eeprom etc, make a backup of your SDcard system with dietpi-backup
Install:
Install the stick in the enclosure
(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.
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.
Plug the SSD into the pi and boot without a microSD card. If all went well the system should boot basically just the same.
(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.
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.
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 .
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.
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?
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.
(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.
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.
Plug the SSD into the pi and boot without a microSD card. If all went well the system should boot basically just the same.
(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.
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
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.