billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.48k stars 327 forks source link

RPi4 SD card to USB Drive failed - drive unmounted #153

Open mpikosdimitris opened 1 year ago

mpikosdimitris commented 1 year ago

Hello, i have this issue, trying to clone my sd card to an ssd drive with usb case and i'm getting my drive unmounted and not recognized by lsblk until i restart the system.

pi@raspberrypi:~ $ **sudo lsblk**
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
**sda           8:0    0 111.8G  0 disk
└─sda1        8:1    0 111.8G  0 part**
mmcblk0     179:0    0  29.7G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0  29.5G  0 part /

pi@raspberrypi:~ $ **sudo rpi-clone sda**

Booted disk: mmcblk0 31.9GB                Destination disk: sda 120.0GB
---------------------------------------------------------------------------
Part      Size    FS     Label           Part   Size    FS    Label
1 /boot   256.0M  fat32  --              1      111.8G  ntfs  --
2 root     29.5G  ext4   rootfs
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - partition number mismatch: 2 -> 1 ==
1 /boot               (49.5M used)   : MKFS  SYNC to sda1
2 root                (13.9G used)   : RESIZE  MKFS  SYNC to sda2
---------------------------------------------------------------------------
Run setup script       : no.
Verbose mode           : no.
-----------------------:
** WARNING **          : All destination disk sda data will be overwritten!
-----------------------:

Initialize and clone to the destination disk sda?  (yes/no): yes
Optional destination ext type file system label (16 chars max):

Initializing
  Imaging past partition 1 start.
  => dd if=/dev/mmcblk0 of=/dev/sda bs=1M count=8 ...
  Resizing destination disk last partition ...
    Resize failed.  See /tmp/rpi-clone-output.
    Try running rpi-clone again.

fdisk: cannot open /dev/sda: No such file or directory

this is the part that rpi-clone fails and after that the lsblk not recognizes the drive.

pi@raspberrypi:~ $ sudo lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 29.7G  0 disk
├─mmcblk0p1 179:1    0  256M  0 part /boot
└─mmcblk0p2 179:2    0 29.5G  0 part /
pi@raspberrypi:~ $

this is the outpout file

pi@raspberrypi:/tmp $ cat rpi-clone-output
sfdisk: cannot open /dev/sda: No such file or directory

====rpi-clone
==orig:
label: dos
label-id: 0x6707a26f
device: /dev/mmcblk0
unit: sectors
sector-size: 512

/dev/mmcblk0p1 : start=        8192, size=      524288, type=c
/dev/mmcblk0p2 : start=      532480, size=    61801472, type=83

==edited:
label: dos
label-id: 0x6707a26f
device: /dev/mmcblk0
unit: sectors
sector-size: 512

/dev/mmcblk0p1 : start=        8192, size=      524288, type=c
/dev/mmcblk0p2 : start=      532480,  type=83

any suggestions ?

ThiloHettmer commented 1 year ago

I got the same issue. Have you fixed it?

ThiloHettmer commented 1 year ago

Little update for anyone who encounters the same issue. It was the ssd case that has the jmicron chipset. Look for asmedia instead.

rhys96999 commented 8 months ago

Same problem for me and same solution

jdrch commented 7 months ago

This is very interesting. I have 2 Kingston Technology USB microSD card readers. The 1st is a MobileLite G4 USB 3.0 which blocks the adjacent USB port on the affected Pi 3B+. The 2nd is a MobileLite Plus microSD Reader that is narrow enough to not have the same fit issue. I guess I'd tested rpi-clone with the former 1st and then set up an unattended cron job with the latter installed so that I'd always have a full sytem backup ready to go.

However the cron job would fail unpredictably, and I couldn't figure out why. I recently updated to Debian 12 on the same Pi 3B+ and noticed rpi-clone was failing again. Swapping the readers fixed the issue. Super odd; thanks for the fix!