Introduction: Backup/Restore Intel Edison
Greetings, Instructabees! In another instructable I created (which will be uploaded soon) I talked about resetting the Intel Edison. It is heartbreaking to find all of your hard work washed away when you mess up a file. In this Instructable, I will be going through the steps to backup the Edison to a microSD card, along with restoring an Edison with this customized image.
This is a very important thing to do whenever you are going to drastically change something on your system. I have many microSD cards at my disposal, so I can make backups as I please. If you are not so lucky, or want to save on the amount of cards used, you can save them to your PC.
You will need a microSD card which has at least 4 GB of available memory. The MMC of the Edison is 4GB, which means your image will be very close to that.
Before going any farther, I want to thank Intel and Instructables for being awesome by selecting me along with 249 others to receive a Dev Kit. That was very surprising to me, and I am very grateful for it. Thank you!
*Note* I am not liable for any damage (software or hardware) to your Intel Edison/Galileo. You are following my advice at your own risk.
Step 1: Plug In/Boot Edison
Obviously, you will turn your Edison on at some point. Before turning it on, you'll want to insert a microSD card into the slot beside the push buttons.
You will need to plug in a micro USB cable into the port farthest from the big USB port, and that into your computer. This makes the COM link between your Edison and PC. To power the Edison, you may either use a power adapter, or a second micro USB to the other port. Wait a minute or so to let the Edison boot up, and proceed to the next step!
Step 2: SSH Into the Edison
You've most likely come to this instructable because you already have an Edison and know how to use it. If not, you will need an SSH program on your PC; I will be using PuTTY. You also, hopefully, know what COM port your Edison shows up on. If not, you will need to go to your Device Manager (in Control Panel > System) and find it. It will be labeled as "USB Serial Port (COM#)", like in the image above.
In PuTTY, connect to the Edison by selecting the "Serial" radio button, typing in the COM port in the format of "COM#" where # is the number you found in Device Manager, along with "115200" in the (speed) box. Click "Open" and you will see a screen like the third image above. Press <Enter> and type root at the prompt.
Note: If you SSH into the Edison before it boots, you may see something like in Image 4 in your terminal box. Just let it finish and type root when the prompt appears.
Step 3: Back Up the Edison
Now we're getting into the good part. With PuTTY active, you will want to copy/type the command below into the terminal. You can change the "edison_backup.img" to anything, so long as it ends with ".img". If you want to make regular backups, you can have the name include the date. BE ABSOLUTELY SURE that you do not use special characters in the name, and have no spaces. If you want spaces, put quotes around the entire path (/media/sdcard/edison_backup.img)
The command: dd if=/dev/mmcblk0 of=/media/sdcard/edison_backup.img
The "dd" is the command used to save data elsewhere. It can be read as "duplicate data". The "if=/dev/mmcblk0" is assigning the location of the MMC data center to the "input file" or "if". The "of=/media/sdcard/edison_backup.img" is assigning the location of the new image to the "output file" or "of". You can add an extra statement to this line, "bs=1M", where "bs" is "byte size" and the 1M is the size of each packet transferred at a time. Different values will yield different write times. Default is 512 bytes.
You might want to take note of the number behind "records in" and "records out". They should be equal, and should match with the numbers displayed after the restore.
Step 4: Restore the Edison
If something has gone wrong, you will probably want to restore instead of completely reflashing. With the terminal open, enter the command found below. The command is similar to backing up, except the input file is now the image and the output file is the MMC. MAKE SURE that you have the input file as the image and the output as the MMC. otherwise, you will write the bad MMC data to the image, thus losing the good image. Change the image name to what you have it saved as on the SD card.
dd if=/media/sdcard/edison_backup.img of=/dev/mmcblk0
Again, you can specify the byte size, or leave it with the default of 512 bytes.
I forgot to time the restore, but it took less than 30 minutes for me.
You may notice that some errors were thrown. I looked at all of them, and they are just log files. I'm assuming that log files have something to them that they can't be re-written, or are temporary files that couldn't be read in the backup. Regardless, you want to look at the numbers behind "records in" and "records out". If they match the amount in the backup, then you should be fine.
Step 5: Wrapping Up
That about sums up how to backup and restore an Intel Edison. If you have any questions or comments, just let me know in the comments. I love finding out where (if) I went wrong!
Good luck with your Edison, and happy hacking!
Note: My work was derived from various sources around the internet, along with a few from communities.intel.com. I posted this to make an easy-to-access manual, and to add to the Internet of Things hub here at Instructables.