1 of 1 people found this helpful
Using the dd command you can backup to a USB drive and restore from the USB drive as long as the root password was not set.
dd if=/dev/mmcblk0 of=/mnt/sda1/<Any File Name> bs=1M
dd if=/mnt/sda1/<File Name> of=/dev/mmcblk0 bs=1M
I've been away for a while, but finally got back to this topic. Sergio's suggestion worked like a charm. Actually, I used a modification to the recipe to compress the image, since all I had was a 4GB flash drive (which was unfortunately just under the capacity of 4GB MMC on the Edison) and was too lazy to go out and buy a bigger drive. Specifically, what I did was:
On the Edison I wished to clone:
1. Create a place to mount a USB flash drive. I did 'mkdir /mount/usbdrive'
2. Plug in a USB drive to the USB OTG port, using a suitable OTG adapter cable and a powered USB hub.
3. Mount the USB drive: 'mount /dev/sda1 /media/usbdrive'
4. Create the compressed image: 'dd bs=4M if=/dev/mmcblk0 | gzip > /media/usbdrive/Edison_backup.gz'
Step 4 took about 35 minutes. (with bs=1M, it takes a lot longer)
On a brand-new Edison, right out of the box:
5. Connect via USB. I'm connecting with a Linux system, so: 'screen /dev/ttyUSB0 115200'
6. Create a place to mount a USB flash drive. I did 'mkdir /mount/usbdrive'
7. Plug in a USB drive to the USB OTG port, using a suitable OTG adapter cable and a powered USB hub.
8. Mount the USB drive: 'mount /dev/sda1 /media/usbdrive'
9. Transfer the image to the new Edison: 'gzip -dc /media/usbdrive/Edison_backup.gz | dd bs=4M of=/dev/mmcblk0'
Step 8 took another 35 minutes.
After step 9, the new Edison responds to every line command with a "segmentation error" indication. However, after a power cycle, the new Edison comes up as a perfect clone of the old Edison. It also got the partitioning right. On my old Edison, I flashed it with a 1GB root ('/') partition. The cloning resulted a 1GB root as well. The only difference was that when connecting to the new Edison wirelessly, my router assigned a different IP address to it, since it had a different MAC address.
In just a little over a half-hour, one can completely backup one's Edison, or in just a little over an hour completely clone it.
Thanks for the useful guidance, Sergio!
I have an Edison-Arduino breakout board and (2) Edison modules and thought I would try to make a clone of the module I have been using with the SDK and XDK on my Windows 7 machine.
In my case, I Putty’d into the Edison-Arduino using a USB serial console cable to make a backup on the Edison-Arduino breakout board’s onboard SD card slot. I used an 8GB SD card formatted as FAT32. The SD card auto mounts during boot.
I’ve always heard backing up and restoring a live mounted system will cause problems, but since it worked for you and I don’t really know any way to backup the Edison’s partition unmounted, I thought I would give it a try.
I used this command: dd if=/dev/mmcblk0 of=/media/sdcard/edison_backup.img
I believe dd uses a 512 byte block size if one isn’t specified. I’ve never had a problem doing it that way, although I know it can move data faster or slower depending on block size.
It finished without complaint creating a file with these stat’s: Size: 3909091328 Blocks: 7634944 IO Block: 32768 regular file
I didn’t time it, but it took about ½ an hour.
So, then I restored it to my 2nd Edison module. Once again, I Putty’d into it using my USB serial console cable. The SD card auto mounted during boot. I used this command to restore the image to the new module: dd if=/media/sdcard/edison_backup.img of=/dev/mmcblk0
It finished without complaint. I didn’t time the restore either, but it took less than ½ an hour.
Since you said you had segmentation errors until you power cycled, I didn’t even try anything. I just powered down, rebooted. It works great!
As near as I can tell, this procedure created an exact working clone of my original module, except for assigning a new IP address.
I would be interested to hear from anyone who can think of a way to backup/restore the Edison unmounted, either with a Windows or Linux machine.
Yes, that happens when you restore the data to another Edison board, the same results seem to happen to rubidium and toadaze. If this is an issue you can try changing the IP address manually such as in http://www.tecmint.com/ifconfig-command-examples/ .
Thanks everyone for contributing to this thread - it's been immensely helpful with duplicating our test boards with Ubilinux - instead of manually reinstalling packages from scripts. It helps a lot when software versions are identical (i.e.development & testing).
Here's something that I found helpful when making images; using the "pv" tool to watch the time elapsed, time estimation, transfer progress and transfer rate (it's small and simple to install: sudo apt-get install "pv"). For instance, here's what I used to make in image of the rootfs of one of our boards this morning using a microsd card in a USB reader plugged into the standard USB port on the Edison (I also included the informative output):
"dd bs=4M if=/dev/mmcblk0 | pv -s 4G -petar | dd bs=4M of=/media/microsd/ubilinux_rootfs_backup.img"
932+0 records ins] [3.98MB/s] [=========================================> ] 90% ETA 0:01:32
932+0 records out
3909091328 bytes (3.9 GB) copied, 935.834 s, 4.2 MB/s
0:15:35 [3.98MB/s] [3.98MB/s] [=========================================> ] 91%
0+29824 records in
0+29824 records out
3909091328 bytes (3.9 GB) copied, 965.389 s, 4.0 MB/s
I hope this helps anyone who needs more information when using dd. pv is a really great tool for a lot of uses, not just watching the progress of dd.
I know this is an old post, but I was hoping you could clarify something. You mention that you can use dd to backup if the root password is not set. Will I encounter some issue if I try to do this procedure if my root account has a password? If so, is there a simple way to clear the password?
I'm not sure if you tried it yet, but I just performed a backup from one of our fully-configured Edison/Arduino boards running Ubilinux (with the root password enabled) and restored it into one of our recently received boards. We didn't have any issues with the root or non-root accounts.
As expected, all of the backed up accounts simply use the passwords from the the source system.
Hi, correct, I found it.
I think it's a very stupid trick to have the bluetooth mac address written in a file.
If I delete the bluetooth address file I notice that the bluetoothctl show me another address.
The problem is that with "dd if=/dev/mmcblk0 of=/mnt/sda1/<Any File Name> bs=1M" I backup every partition, include /factory.
I tried to backup only ROOT and HOME, but the if I restore these two partitions into another edison doesn't work. Maybe because I have to make two dd commands, and when I execute the second command, the partition is already inconsistent.
I tried to clone my Ublinux build with the gzip / dd instructions mentioned above, but for some reason, after power cycling the flashed Edison I can no longer get a login prompt or any response on the serial connection at all. Was the Edison that you wrote the clone file to already flashed with Ubilinux or was it stock? Mine was stock...maybe that was the reason for the failure?