Migration from SD Card to Bootable USB (NVMe) vs. Clean Install

Hello,

As USB boot has appeared in the eeprom critical branch on the Raspberry Pi Foundation side of things), I’ve begun investigating the best way to get a USB drive on my Pi, given my space constraints.

I’ve zeroed in on this board: Raspberry Pi 4 X872 M.2 NVMe 2280/2260/2242/2230 SSD Expansion Board f – Geekworm

Question 1: Will it be feasible to duplicate my existing partition table/root drive/boot drive over to the new m.2 drive, or will this cause unpredictable problems? I can do a clean install, but I’d rather not if I don’t have to.

Question 2: @Darksky put together a really good “transfer your installation to USB drive from SD card” tutorial on the old forum. Has it been preserved somewhere? I have approximately zero idea how to do this. :stuck_out_tongue:

Thanks!

You will have to search for it. I forgot where it was:

Archived Forum

1 Like
  1. man dd (or better: pamac install ddrescue)
    or
  2. CloneZilla Live

:innocent:

Another option.

My favorite imaging program is fsarchiver from the repo. I understand that it is also on the CloneZilla Live.

With dd it wants to clone the whole partition including the free space. I have read that it is possible to elimated the free space but one would have to jump through some hoops. This was problematic for me in many ways with dealing with making compact images for uploading for others to get, making images for backup to save for a quick restore and when restoring I would not be limited to a certain size sdcard.

fsarchiver will create a compressed image saving only the actual data on the partition including data like the partition LABEL like dd. This would allow one to restore the partition to any size sdcard as long as it is bigger than the amount of space the original file system took up. Say you originally had @5G of data on a 32G sdcard It would create a @1.4G compressed image that could be restored to a 8G sdcard.

This would be for the RPi as some devices expect the starting partition position for boot to be different.

Using your desktop…

Back up the sdcard:

Install fsarchiver from the repo
Put the sdcard in your desktop
mkdir xfce-20.08
cd xfce-20.08
mkdir boot
cp -R /path-to your-sdcard-boot(fat32)-partition/* boot/
sudo umount /dev/your-sdcard-root-partition (mine is sdd2)
sudo fsarchiver -v -Z 19 -j 4 savefs root.fsa /dev/your-sdcard-root-partition (adjust the -j value to your # of cores)
Remove the sdcard so there will not be any partition LABEL’s conflict in the next step

Restore to M.2 drive:

Create @150M fat32 partition on your USB M.2 drive with a BOOT_MNJRO LABEL. I use gparted and check the lba flags.
Then create an ext4 partition with a ROOT_MNJRO LABEL filling out the rest of the m.2 drive

cp -R boot/* /path-to-your-M.2/boot-partition/
sudo umount /dev/your-M.2-drive-root partition
sudo fsarchiver -v -j 4 restfs root.fsa id=0,dest=/dev/your-M.2-drive-root partition
sudo sync
unmount your M.2 drive and connect it to your RPi

Now you have a good back up you can restore if something goes amiss. I have been using this for about 5 years to back up my desktop every once in a while also.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.