I'm running Raspian on RPi3 from a 16GB SD card. Now I try to use a SSD connected by USB to hold the root / partition and copy the /boot partition to a smaller SD card that is 512MB. I can't get it working somehow.
I don't want to touch the OTP memory to boot directly to USB, so I need the SD card for boot.
I started off with guides like this: https://www.raspberrypi.org/forums/viewtopic.php?t=44177
Drives:
- sda is the 16GB SDcard from the Raspi running Raspian
- sdb is the new 512MB SDcard
- sdc is the SSD
I did the following steps on my PC booting into a live Linux (PartedMagic):
- sudo dd if=/dev/sda of=/dev/sdb
- sudo gdisk /dev/sdc
- create /dev/sdc1 partition covering the whole SSD
- run clonezilla and copy partition /dev/sda2 -> /dev/sdc1
- blkid
- take note of PARTUUID of /dev/sdb1 and /dev/sdc1
- sudo mkdir /mnt/sdb1
- sudo mount /dev/sdb1 /mnt/sdb1
sudo nano /mnt/sdb1/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=[PARTUUID-of-sdc1] rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
sudo mkdir /mnt/sdc1
- sudo mount /dev/sdc1 /mnt/sdc1
sudo nano /mnt/sdc1/etc/fstab
proc /proc proc defaults 0 0
PARTUUID=[PARTUUID-of-sdb1] /boot vfat defaults 0 2
PARTUUID=[PARTUUID-of-sdc1] / ext4 defaults,noatime 0 1
Upon boot, I can see the linux booting up, rootfs seems to work, but then there is a problem with boot partition not found and the whole thing halts.
EDIT:
My goal is to move rootfs to USB SSD disk and boot using SD Card. But I don't want to use the current 16GB card for booting, as a 512MB card is more than enough to hold the /boot partition. The above instructions are just to illustrate what I tried, if there are better ways to accomplish my goal I'm more than happy to proceed as suggested.
EDIT 2:
I did set the OTP usb boot flag in the mean time, meaning the smaller SD card is no longer necessary. This makes the whole process much easier. What I try now is the following:
First copy the whole SD card to the SSD drive:
sudo dd if=/dev/sda of=/dev/sdc
If I attach the resulting SSD to the RasPi it boots just fine and everything works. But if I try to grow the /dev/sdc2 partition (rootfs) using GParted, it won't boot successfully anymore. Here is a screenshot showing the problem(s):
How can I resize rootfs without causing this problem?
I don't want to touch the OTP memory to boot directly to USB
- Just out of curiosity: why?sudo dd if=/dev/sda of=/dev/sdb
will produce an invalid disk. This could be done far more simply on the Pi itself using the SD Copy utility.