[Project] : Rpi-mage: self restore a custom image
While playing on my PiLab i was confronted to the restore my custom image of Raspbian whithout any physical manipulation on all RPIs. This was achieve with the RPI-mage scripts.
I order to do so I create another custom image with :
- The boot partition
- The restore partition (moebius)
- The working partition (Customized Raspbian)
The logic (of restore):
On the working partition launch a script that will :
- mount the /boot partition to switch to the restore partition on the next boot
- unmount cleanly the /boot
- mount the restore partition to let a flag on it (rc.local)
- unmout the restore partition
- The restore partition mount the working partition and also the backup partition
- Restore the customized image on it
- Unmount the fresh working partition
- Remove the flag of restoration
- Mount the boot partition to switch to the brand new working partition on the next boot
- unmount the boot
The advantage of this method is that you don't need to touch the devices.
The issues:I expected some performance issue doing the backup/restore on the same microSD but not that much.
The first tests was around 100-150 ko/s to create or write the backup. So i inspire me with the rpi-clone project by adding an extra device (other microSD or HDD) on one of the Usb port.
Again some poor performances but this time for another reason. The light linux distribution is used (Moebius), use the busybox to emulate some usual tools like (dd, fsdik and so on). All these tools where also in light mod with some missing options i need. I change all the binaries that i need:
With these new tools i reach the 30 mo/s to backup and to restore the backup.