geerlingguy / rpi-clone

A shell script to clone a booted disk on a Raspberry Pi.
https://rpi-clone.jeffgeerling.com/
BSD 3-Clause "New" or "Revised" License
172 stars 10 forks source link

Backup failed though procedure looked fine #15

Open scargill opened 3 months ago

scargill commented 3 months ago

Hi I've been using Bills rpi-clone for years, backing up my rpi 4 daily. I recently (Feb) bought an RPI5 and installed the latest RPI 64 bit OS from the RPI site. Weeks ago we cloned the SD to a USB-mounted SSD - worked fine - checked it - no problem. Done this hundreds of times. Been backing up ever since but not checked in last 4 weeks. When I tried to make a clone today and run it, the clone would not work (even tried clean clone using the fdisk option).

So I deleted rpi-clone and grabbed yours - and a fresh PI OS 64 bit - ran sudeo apt update and sudo apt upgrade - exactly the same. Not working - and I've tried 2 different SSDs (the ones I normally use) - made no difference - so it looks like a recent - past days or weeks has not only killed BILL's rpi-clone but yours too. As Bill has not updated rpi-clone in 4 years I'm counting on you.

Looks absolutely fine when creating teh clone - but it will not boot.

I then saw the FRAMP version - but his master version does exacty the same - and I'm seeing that new firmware folder in boot. but it mustnt be getting used..

HELP.


  Destination disk partition /dev/sda2 is mounted on /media/pi/a238896b-e1ac-4eb6-8bde-71225028e249.
  The clone cannot proceed unless it is unmounted.
Do you want to unmount /media/pi/a238896b-e1ac-4eb6-8bde-71225028e249?  (yes/no): yes

  Destination disk partition /dev/sda1 is mounted on /media/pi/1535-B7E7.
  The clone cannot proceed unless it is unmounted.
Do you want to unmount /media/pi/1535-B7E7?  (yes/no): yes

Booted disk: mmcblk0 63.9GB                Destination disk: sda 64.0GB
---------------------------------------------------------------------------
Part               Size    FS     Label           Part   Size    FS     Label
1 /boot/firmware   512.0M  fat32  --              1      512.0M  fat32  --
2 root              59.0G  ext4   rootfs          2       59.1G  ext4   --
---------------------------------------------------------------------------
== SYNC mmcblk0 file systems to sda ==
/boot/firmware        (73.5M used)   : SYNC to sda1 (512.0M size)
/                     (4.5G used)    : SYNC to sda2 (59.1G size)
---------------------------------------------------------------------------
Run setup script       : no.
Verbose mode           : no.
-----------------------:

Ok to proceed with the clone?  (yes/no): yes

Syncing file systems (can take a long time)
Syncing mounted partitions:
  Mounting /dev/sda2 on /mnt/clone
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
  => rsync // /mnt/clone with-root-excludes ...
  Mounting /dev/sda1 on /mnt/clone/boot/firmware
mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
  => rsync /boot/firmware/ /mnt/clone/boot/firmware  ...

Editing /mnt/clone/boot/firmware/cmdline.txt PARTUUID to use 3eaadea2
Editing /mnt/clone/etc/fstab PARTUUID to use 3eaadea2
===============================
Done with clone to /dev/sda
   Start - 22:47:09    End - 22:47:22    Elapsed Time - 0:13

Cloned partitions are mounted on /mnt/clone for inspection or customizing.

Hit Enter when ready to unmount the /dev/sda partitions ...
  unmounting /mnt/clone/boot/firmware
  unmounting /mnt/clone
===============================
framps commented 3 months ago

but it will not boot.

Most of the time that's because the configured PARTUUIDs don't match the existing PARTUUIDs. Actually rpi-clone will update them. But I suggest first to invoke this script which reports the configured and existing PARTUUIDs.

If they match - do you have a monitor connected and can show the boot messages?

scargill commented 3 months ago

pi@rpi5:~ $ sudo bash syncUUIDs.sh /dev/sda
syncUUIDs.sh 0.1.1 (https://github.com/framps/raspberryTools)
--- Root PARTUUID ac2d0382-02 already used in /dev/sda1/cmdline.txt
--- Boot PARTUUID ac2d0382-01 already used in /dev/sda2/etc/fstab
--- Root PARTUUID ac2d0382-02 already used in /dev/sda2/etc/fstab
pi@rpi5:~ $

3 flashing blue on SD then nothing - some time later another 3... still not booting... I don;t have a monitor - always used ssh with RPis - if I go back to SD - are there 2 files I can compare by mounting the SSD and looking inside?

scargill commented 3 months ago

Open to ideas - I utterly rely on rpi-clone and have done for years to get me out of a jam - and right now, without it my RPI05 is sitting on the shelf waiting for a solution.

framps commented 3 months ago

The easiest way to make progress would be to connect a monitor and provide a screenshot of the boot messages. Don't you have any old spare monitor handy? I frankly suggest to everybody who uses a headless system to have a monitor handy - just for these kind of boot issues. I just bought a tiny 10'' LCD monitor exactly for this. I was bored to move my big 17'' monitor I use on my desktop downstairs whenever I had boot issues with my Raspberries located in the basement.

Next you can modify the OS to make the systemd log persistent (I assume you use Bookworm). Then create a clone and inspect the persistent systemd log on another Linux box. I frankly never didn't go this path and only know from theory this should work.

scargill commented 3 months ago

Out now.. Going to follow this up. Can get to a monitor....

matthijskooijman commented 3 months ago

If you have a (3.3V) USB-to-TTL-serial adapter (or another rpi could be used) then it might also be useful to log the serial console - IIRC the bootloader outputs more info there on the early boot process.

scargill commented 3 months ago

The easiest way to make progress would be to connect a monitor and provide a screenshot of the boot messages. Don't you have any old spare monitor handy? I frankly suggest to everybody who uses a headless system to have a monitor handy - just for these kind of boot issues. I just bought a tiny 10'' LCD monitor exactly for this. I was bored to move my big 17'' monitor I use on my desktop downstairs whenever I had boot issues with my Raspberries located in the basement.

Next you can modify the OS to make the systemd log persistent (I assume you use Bookworm). Then create a clone and inspect the persistent systemd log on another Linux box. I frankly never didn't go this path and only know from theory this should work.

I took your advice and connected a monitor -

You;r going to love this :

message 1 image

message 2 image

Looks like it sees the SSD - but not enough power. I've made the ecommended change to the config.txt on a Windows PC with that SSD

And i am using the proper RPi5 power supply (supposedly 4A at 5v). Nothing else connected to the RPi5 - just the SSD in an adaptor - and the monitor... with that change, Mr Geering's rpi-clone works.. curl https://raw.githubusercontent.com/geerlingguy/rpi-clone/master/install | sudo bash

And now I've cloned from the SSD back to another SD. I'm using my macros I made for the original rpi-clone - as user pi.. clone clonem cclone cclonem etc - happy to pass them onto anyone who wants them. (cc version means clean clone - unused sd or ssd. Anything to make life easy.) Happy!