Help cloning a drive so that it will boot

I have a 4GB Pi4 which runs DietPi and a number of services (Nextcloud, DNS service, MariaDB). It runs from a 240GB Kingston A400 SSD connected via USB and because it basically works it has been largely left alone.

However I am aware that in doing this I have now let it lapse as far as OS and application updates are concerned, so it is still running buster.

Knowing it would be beneficial to me to upgrade I decided to address both this and also try in increase capacity. I bought a 480GB Kinston A400 SSD and the intention was to clone the existing drive and perform the upgrades on this new device. Then if anything major went wrong I could simply switch back to the original 240GB drive and think about what to try next.

I used Macrium Reflect on a Windows PC to clone the drive and this completed without issue. But with a block of unsused space on the drive I then plugged it into a Linux host and used GParted to expand the drive to its full capacity.

However when it came to booting the Pi with this new drive after a flurry of messages for a few seconds it would simply stop and refused to go any further. Thinking that maybe I should have tried this before expanding the free space I performed a fresh clone which, again, completed successfully and tried to boot the new drive straight away before attempting anything further. Again it would not boot.

The following link is to a photo taken of the screen at the point where it stops and I am hoping that it is clear enough and contains something of use that someone will be able to see and maybe point out where I am going wrong.

https://app.screencast.com/h21WFXwkCuDWb

As soon as I disconnect this drive and connect the original 240GB it boots just fine. In each case I am using the same USB-SATA cable on the Pi - I am simply connecting the drive I wish to boot from to this cable and at all times the only drive I am trying to boot the Pi from is the one connected to this cable.

If someone is able to help that would be fantastic. Or, if there is a better way of cloning the existing drive to a new device I will be happy to give it a try.

Many thanks in advance.
-Phil

following could give an idea how to move from one disk to another Moving a running DietPi system to a USB stick/disk or an onboard eMMC – DietPi Blog

It was initially created to move from SD card to HDD/SSD/eMMC but should be working similar on your scenario.

As I understand, in the blog post we use dietpi_drive-manager to resize the partition instead of doing it on a different system with gparted. Additionally, the dd command to clone the disk is much easier to use.

I am not aware of issues which should prevent your method. But please give the blog post description a try.

Thanks all for the guidance.

I may have also been dealing with a USB-SATA cable (for the drive I was cloning to) that the Pi wasn’t totally happy with as after completing the ‘dd’ portion of the blog post the console would begin to show all manner of messages as I was seemingly no longer able to do anything at the console and while SSH appeared to still be working after the dd had completed it then didn’t want to recognise a single command line tool (-bash: <command_name>: command not found) - ls? no, lsblk? no, htop? no, etc… which was a little confusing to me. I connected the “new” drive to my main PC, deleted the partitions, and tried again with the same outcome.

After rebooting to the original drive (cloned drive disconnected for the time being) I performed the steps to mount the / filesystem back into rw mode and made sure the Pi was able to work as normal with the original SSD. It did, so I then shut down, swapped over the SSDs and booted again. This time the Pi did at least boot, I was able to remount / in rw mode and run the dietpi-disk_manager to resize the main partition.

I’ll run it for a few days to make sure it is stable and will then look to upgrade it from the current build (buster) to bullseye and then to bookwork - assuming it is best to do it this way rather than trying to jump straight to bookworm.

Thanks again.
-Phil

You need to do it step by step anyway. Upgrading to bookworm is something i would not recommend. Best to ensure your system working after each step done.

Best/easiest way to clone a drive
I use clonzilla live on a Ventoy USB drive

https://clonezilla.org/clonezilla-live.php