It can be convenient to make a bitwise copy. For example to place the contents of 1 embedded board (i.e. Beaglebone) to another embedded board.
If the device to copy is also the storage device that holds the OS, then boot from another device, for example a “Try Ubuntu” usb drive.
We stream the data over the network, because the devices themselves mostly have no space to place the image somewhere on the that device.
Assumption is that you have a working ssh server on the device you want to copy to.
The perform the following:
- Find the correct device to make a copy from. So the whole device, not the partition.
In my case it is “/dev/mmcblk0” so without the partition indicator -> “p1”. - Find the ip adress of the device to copy to (or use hostname)
To create an image:
> sudo cat /dev/mmcblk0 | ssh <user>@<ip-adress> "gzip ~/image.gz"
After the operation is done you have a bitwise copy gzipped on your <ip-address> machine in the home directory of the <user>
To deploy an earlier created image back to the device, from the device to deploy to (Make sure you booted from another device than we are copying to):
> ssh <user>@<ip-address> "gzip -dc ~/image.gz" | dd of=/dev/mmcblk0 status=progress