Total I start testing the new cloning option. When everything runs fine I will get a perfect clone of the running microSD card. You can clone on an usb stick. You also can use a second microSD card placed in an usb card reader. I try both.
To know which device is mounted I use the command lsblk
(= list block devices). Then I run the new rpi-clone command. This command must be used as root.
moodlebox@moodlebox:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 1 28.8G 0 disk
└─sda1 8:1 1 28.8G 0 part /media/usb0
mmcblk0 179:0 0 14.8G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 14.6G 0 part /
moodlebox@moodlebox:~ $ sudo rpi-clone sda
Destination disk partition /dev/sda1 is mounted on /media/usb0.
The clone cannot proceed unless it is unmounted.
Do you want to unmount /media/usb0? (yes/no): yes
Booted disk: mmcblk0 15.9GB Destination disk: sda 31.0GB
---------------------------------------------------------------------------
Part Size FS Label Part Size FS Label
1 /boot 256.0M fat32 -- 1 28.8G fat32 --
2 root 14.6G ext4 MoodleBox by NMA
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - partition number mismatch: 2 -> 1 ==
1 /boot (31.5M used) : MKFS SYNC to sda1
2 root (2.5G 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 success.
Changing destination Disk ID ...
=> mkfs -t vfat -F 32 /dev/sda1 ...
=> mkfs -t ext4 /dev/sda2 ...
Syncing file systems (can take a long time)
Syncing mounted partitions:
Mounting /dev/sda2 on /mnt/clone
=> rsync // /mnt/clone with-root-excludes ...
Mounting /dev/sda1 on /mnt/clone/boot
=> rsync /boot/ /mnt/clone/boot ...
Editing /mnt/clone/boot/cmdline.txt PARTUUID to use b308b38f
Editing /mnt/clone/etc/fstab PARTUUID to use b308b38f
===============================
Done with clone to /dev/sda
Start - 13:53:34 End - 13:55:54 Elapsed Time - 2:20
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
unmounting /mnt/clone
===============================
moodlebox@moodlebox:~ $
The cloning process is finished. I stop the running MoodleBox with sudo halt and I move away the current boot device. I put in the new microSD card and I power on the MoodleBox. In both tests with the microSD card and with the usb stick the MoodleBox does not start. The monitor at the MoodleBox shows the coloured start screen which we get when we start the Raspberry Pi with Raspberry Pi OS.
What's the problem? Do you have an idea?
As I wrote here https://discuss.moodlebox.net/d/312-install-a-cloning-program-into-the-moodlebox the feature should be an easy way for better content backups.
Many people install their extended MoodleBox and they want to have a copy of the microSD card. They want it as a backup copy. They want to freeze their Moodle development for the MoodleBox. They want to clone the MoodleBox for some other teachers in their school. They want to send updated microSD cards to learning places without internet.
The easiest way would be to have an external microSD card reader connected to an usb port. It would be very helpful if the software for cloning could be preinstalled on the MoodleBox. I don‘t know if it would be a good idea to have also a web interface for this. But it would be a good idea to get a terminal command such as rpi-clone.