ZhongUncle / clone_rasp_disk

CLI tool to clone Raspberry Pi disk or SD card to another driver (even smaller space)
MIT License
2 stars 0 forks source link

crash #1

Closed jimlynnjulian closed 1 month ago

jimlynnjulian commented 1 month ago

30Gb SD in raspberry pi 4, copied to 15Gb SD card in USB reader.

uname -r 5.10.103-v7l+ (Raspbian Buster)

Two attempts 1.) Previous Raspberry Pi OS Bookworm installation was overwritten - crash 2.) Wiped SD card clean - crash

pi@raspberrypi:/var/www/html $ sudo chmod 777 clone_rasp_disk.sh pi@raspberrypi:/var/www/html $ ./clone_rasp_disk.sh /dev/sda Model: TS-RDF5 SD Transcend (scsi) Disk /dev/sda: 15.9GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags:

Number Start End Size Type File system Flags 1 4194kB 541MB 537MB primary fat32 lba 2 541MB 15.9GB 15.3GB primary ext4 lba

mkfs.fat 4.1 (2017-01-24) mke2fs 1.44.5 (15-Dec-2018) /dev/sda2 contains a ext4 file system labelled 'rootfs' last mounted on /mnt/rootfs on Sun Jul 21 13:26:06 2024 Proceed anyway? (y,N) y Creating filesystem with 3738624 4k blocks and 934720 inodes Filesystem UUID: 0270eb91-c27a-4d2f-9aaf-8896fbf20c58 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done

mkdir: cannot create directory ‘/mnt/rootfs’: File exists 880,669,419 96% 6.68MB/s 0:02:05 (xfr#18149, ir-chk=1003/23900) file has vanished: "/proc/10/exe" 913,238,371 99% 6.66MB/s 0:02:10 (xfr#18225, ir-chk=1042/24018) file has vanished: "/proc/10/task/10/exe" 913,238,371 99% 6.66MB/s 0:02:10 (xfr#18267, ir-chk=1000/24183) " " " " " " " " " " file has vanished: "/proc/178/exe" 913,238,371 99% 6.58MB/s 0:02:12 (xfr#23420, ir-chk=1002/31063) file has vanished: "/proc/178/task/178/exe" 913,238,371 99% 6.58MB/s 0:02:12 (xfr#23534, ir-chk=1005/31203)^C rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(644) [sender=3.1.3] rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(513) [generator=3.1.3] rsync: change_dir "/boot/firmware" failed: No such file or directory (2) 0 100% 0.00kB/s 0:00:00 (xfr#0, to-chk=0/0) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3] sed: can't read /mnt/rootfs/boot/firmware/cmdline.txt: No such file or directory pi@raspberrypi:/var/www/html $

This may be a permissions problem:

pi@raspberrypi:/proc/10 $ ls ls: cannot read symbolic link 'cwd': Permission denied ls: cannot read symbolic link 'root': Permission denied ls: cannot read symbolic link 'exe': Permission denied

pi@raspberrypi:/proc/10/task/10 $ ls ls: cannot read symbolic link 'cwd': Permission denied ls: cannot read symbolic link 'root': Permission denied ls: cannot read symbolic link 'exe': Permission denied

ZhongUncle commented 1 month ago

I reproduce your results. Thanks your report this bug and use this repository! This project needs people try it to find potential issues and usage.

I exclude more directories when using rsync, like/proc. These directories stores many files generated by system, such as swapped memory. In your sample, cwd is the current work directory of a process, we don't have permission to access it.

These files and directories aren't necessary for clone, because they will be removed or generated after next boot.

In my previous tests, maybe I reboot in high frequency, system doesn't generate many files, so this issue doesn't happened.

In some Linux backup tips, they recommend many directories, but excluding much directories cause boot problem. Excluding less directories also cause first boot taking more time. And some services will need some minutes to start after first start, like SSH and SMB server.