Move Boot partition to smaller SD Card

I’m going to move the rootfs to an SDD (using drive-manager). Once I have done that, I’d like to move the boot partition to a smaller SD card.

I have seen this topic on the Raspbian forum but I wonder if there is a better way or if it could be built into the drive-manager?

I have successfully moved the rootfs using dietpi-drive_manager (fantastic feature).

I have tried to move the boot partition by inserting a smaller SD Card via an adapter, formatting it as FAT and using

dd if=/dev/mmcblk0p1 of=/dev/sdb1

to move the boot partition.

This failed to reboot. Putting the old card back in reboots fine.

MichaIng, could you suggest how I might do this? I really need the old 16Gb card :wink:.

Anyone any suggestions as to how to move the boot partition?

baz123
When you pre-create the boot partition take care to adjust the PARTUUIDs in /boot/cmdline.txt and /etc/fstab files on the new partition. blkid -so PARTUUID /dev/sda1 if /dev/sda1 is the device of the new SDcard.

MichaIng

I have the SSD running fine with the dietpi-drivemanger utility to move rootfs (great facility BTW).

I now want to use a smaller SD card for the boot partition, but cannot find a method to move boot, that DietPi likes (unless I misunderstood your reply).

Nope there is nn native GUI method in DietPi, however this does not mean that DietPi does not “like” it. We just didn’t implement it since use cases are rare. When editing the two files as mentioned it should work.

Solved. I had misunderstood the response. For anyone following on it is very simple to do.

From the top - I inserted the smaller SDCard into a USB adapter and plugged it into the Pi.

It shows up as sdb with lsblk. First, format the smaller card and create a new partition (taken from this item https://www.raspberrypi.org/forums/viewtopic.php?t=117820#p800811).

root@DietPi:~# fdisk /dev/sdb
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1,3,4, default 1): 1
First sector (2048-15407103, default 2048): 8192
Last sector, +sectors or +size{K,M,G,T,P} (8192-122879, default nnnnnnnn): 122879

Created a new partition 1 of type 'Linux' and of size 56 MiB.

Command (m for help): w

Remember the last command to actually make the changes.

Format the partition as fat

root@DietPi:~# mkfs.fat /dev/sda1

Once the filesystem is made you’re ready to copy - I used dd

root@DietPi:~# dd if=/dev/mmcblk0p1 of=/dev/sdb1

Next is the bit I missed, you need to edit the /etc/fstab file.

You need to edit this line and insert the right PARTUUID for the new boot partition. Use the blkid command to get the value. Remember, it will still be shown as the PARTUUID for /dev/sdb1

PARTUUID=cb7b86f7-01 /boot vfat noatime,lazytime 0 1

I then un-mounted the /boot partition, removed the card and inserted the smaller card before rebooting.

As the boot partition is not mentioned in the cmdline.txt file, I did not find a need to edit it.

Bingo! I now have the boot on an otherwise redundant 2GB card and free up a 16GB card for other things. Reduce, reuse recycle :sunglasses:

MichaIng - would be really great if this function was an option in the dietpi-drivemanager.

Cheers all.