Best way to clone a Linux system

I've just finished setting up a Debian system running on an embedded device. It has custom partitioning, numerous config file changes, web content, and a couple of applications compiled from source.

This exact setup now needs mirroring to a dozen or so other identical embedded devices. They are all the same processor, memory, disk size etc (hence ”identical”). What would be the best way to do this?

The disks in the devices are not really physically accessible, otherwise my first though would have been to put a second disk in the finished box and dd to mirror it.

If I mirrored the disk to a USB stick, how would I get that onto the clean box? I guess it would depend on whether the BIOS could help?


Your embedded device may have certain limitations so I'll just outline a general approach which you could take.

  1. Make a disk image of the system which you have already setup. Choose the disk imaging software which works best with your device.

  2. Create a boot media which will boot on your device and complete the image restore process completely unattended. You can store the device image either on the boot media itself or on some network share assuming that you can easily access it.

  3. Put the boot media in a new device and leave it to do it's job. You may as well make a dozen copies of the boot media and run them all in parallel.

As already suggested have a look at Clonezilla. If it works with your device then it might be the easiest option.


I used the copy method to resize my root filesystem a few times with great success but these were ordinary disks and I was able to have both filesystems (source and target) available from the one running (source) instance.

(cd / ; tar -cf - . --one-file-system) | (cd /mnt ; tar xvfpB - )

This copies practically everything across to a mounted directory (the root of your new disk) but you may need to copy the files in /dev/ separately.

One important step I cannot guess in your environment is the setup of your boot loader.

A few years ago when using an embedded NSLU2 system (ARM, 32MB internal memory, internal 8MB flash-on-chip disks) I was able to just dd from the internal mmcblk0 to a file for backup purposes.