Open timo12357 opened 1 year ago
You're talking about sys-clone
, but this repo contains only rpi-clone
. Is that a typo?
AFAIU, you've cloned from SD-card to EMMC, which works, but then running from EMMC cloning back to SD card fails? Is that right?
You could try running bash -x rpi-clone sdc 2>&1 | tee output.log
, that should print all the commands that are executed (and also log them to output.log). Maybe that provides a hint about what the script does that breaks the SD-card.
The drive can be mounted manually after the initial sync with no errors. Running the subsequent sync with sys-clone makes the sd card unreadable.
You mean you can mount the SD card after the sync-to-EMMC (but before the sync-back-to-SD), but after the sync-back-to-SD fails, the SD-card is no longer mountable? That suggests to me that the script does something to the SD card that breaks the filesystem.
I'd also suggest you add some code formatting to your post (eg. use ```
-delimited codeblocks) to make it a bit more readable.
You're talking about
sys-clone
, but this repo contains onlyrpi-clone
. Is that a typo?
I renamed rpi-clone to sys-clone as I am not using raspberry pi. It is the same code.
AFAIU, you've cloned from SD-card to EMMC, which works, but then running from EMMC cloning back to SD card fails? Is that right?
I did not use rpi-clone to clone the system to EMMC, I used the Armbian native scripts to do it.
You could try running
bash -x rpi-clone sdc 2>&1 | tee output.log
, that should print all the commands that are executed (and also log them to output.log). Maybe that provides a hint about what the script does that breaks the SD-card.
Will do and report
You mean you can mount the SD card after the sync-to-EMMC (but before the sync-back-to-SD), but after the sync-back-to-SD fails, the SD-card is no longer mountable? That suggests to me that the script does something to the SD card that breaks the filesystem.
I can mount the SD card after the sync-from-EMMC-to-SD but before doing a subsequent sync from EMMC to SD. If I repeat the sync from EMMC to SD the card is no longer mountable.
I'd also suggest you add some code formatting to your post (eg. use
```
-delimited codeblocks) to make it a bit more readable.
Tried that but failed. Will try better.
This is what comes in the log:
I've looked at the log, but I'm puzzled why it does not work. It looks like the script mostly just collects info, and then the failing mount of /dev/sdb1 is pretty much one of the first things it does, so I do not see any preceding commands that look like they could kill the FS. The only thing that happens beforehand is setting the FS label, so maybe that breaks it?
Maybe you can verify this by trying it manually? e.g.:
mount /dev/sdb1 /mnt/clone
and umount /mnt/clone
e2label /dev/sdb1 --
mount /dev/sdb1 /mnt/clone
Everything until
e2label /dev/sdb1 --
works. After that it fails:
$ sudo umount /mnt/clone
$ sudo e2label /dev/sdb1 --
$ sudo mount /dev/sdb1 /mnt/clone
mount: /mnt/clone: mount(2) system call failed: Rakenne vaatii puhdistusta.
The error text direct translation is "Structure requires cleaning"
Edit: Trid this a few times. I can mount, umount and use /dev/sdb1 as I like as long as I do not run the e2label command
If I run rsync without the e2label command it works just fine:
$ sudo rsync -acxHAX --info=progress2 / /mnt/clone --exclude='/mnt/clone/*'
256,621 0% 16.28kB/s 0:00:15 (xfr#12, to-chk=0/81770)
What is the e2label command good for?
What is the e2label command good for?
It sets the filesystem label. In this case there is none (or it is literally "--", not sure). That should be fairly harmless command, though it does modify the filesystem, and in this case, for some reason, that gets messed up.
Maybe you could try running sudo e2label /dev/sdb1 somelabel
instead and see if that also breaks? If not, the --
label is somehow problematic...
Unfortunately same error:
$ sudo e2label /dev/sdb1 somelabel
$ sudo mount /dev/sdb1 /mnt/clone
mount: /mnt/clone: mount(2) system call failed: Rakenne vaatii puhdistusta.
Is the e2label command necessary in the context of rpi-clone? Why is it used here?
It is used to copy the filesystem label from the source filesystem to the target filesystem, to provide a sync that is as complete as possible. Also, the filesystem label is sometimes used for mounting the filesystem (check /etc/fstab
and /proc/cmdline
), though using partition or filesystem IDs is often used instead.
So I guess you could remove the e2label command and see if that works (would be a good debug step as well - maybe e2label is not the problem, but just exposes a different problem..)
After doing the initial sync, I commented the e2label out like so:
change_label()
{
pnum=$1
fs_type=$2
dev=$3
dst_part_label "$pnum" "$fs_type" label
if [ "$label" != "" ] && [[ "$fs_type" == *"ext"* ]]
then
echo " e2label $dev $label"
# e2label $dev $label
elif [ "$label" != "" ] && [[ "$fs_type" == *"fat"* ]]
then
echo " fatlabel $dev $label"
fatlabel $dev $label
fi
}
Now the subsequent sync works just fine and my SBC boots onto the cloned SD-card, as it should. However, after that sys-clone fails again, if I boot from the EMMC:
$ sudo mount /dev/sdb1 /mnt/clone
mount: /mnt/clone: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.
I have an Orangepi 3LTS running Armbian 23.8.1 Bullseye with Linux 5.15.93-sunxi64. Installed rpi-clone and renamed it to sys-clone by
git clone https://github.com/matthijskooijman/rpi-clone.git cd rpi-clone git checkout support-fsuuid-and-armbian sudo ./rpi-clone device
sys-clone works perfect as long as I have the Armbian system on an SD card. Problems started when I moved the Armbian system to the Orangepi 3 LTS EMMC. The initial sync works, but sys-clone fails to do a subsequent sync complaining that it can not mount the clone disk:
$ sudo sys-clone sdc