How to clone Hikey 960

We have a hikey 960 board with linaro stretch built 4.19.5 (using @Mani tutorial) .
We now wish to clone the entire board (including drivers, disk partitions , os , apps etc…)
to another identical board
How can this be done?
Thanks,
Omer

It’s all standard GNU/Linux hard disc wrangling from here. Ultimately it is just a matter of finding the partitions to copy out and creating a command something like one of the following (for every partition you might have changed):

dd if=/dev/disk/by-partlabel/rootfs bs=4096 of=/mnt/usb/rootfs.img progress=status

The other issues you’ll need to look at are:

  • You will need a safe place to run the command from. One option is to boot as normal, mount USB media and then remount all non-USB media as read-only to prevent the filesystem changing whilst you are copying it.
  • It’s worth running e2fsck over the rootfs image after you have copied it to ensure it gets marked clean.
  • One you have the rootfs image you will need to loop mount it on your PC and remove all the unique identifiers (such as SSH keys) which could cause problems if the two clones boards are on the same network.
  • You will end up with a raw image that you should probably process with img2simg or ext2simg before passing it to fastboot