====== Why backups are so important ? ======
Thanks to protected area of onboard Flash Memory (MMC) and to nvflash protocol, it's virtually impossible to brick your AC100. Whatever you do, you would be able to restore it to its initial state providing that:
* you know how to do it
* you have backups of your working AC100 partitions under your hand
If you don't know how to do it, it's not that killer, you could always find someone who knows lurking around on the [[ac100_irc|#ac100 IRC channel]].
If you don't have backups, there is little we can help to restore a dead AC100. Well, people have their own backups, but:
* There are several ac100 models in the field and backups contents are not all identical
* It's not clear how legal it would be to distribute backup images. This is why you won't find any official site to offer ac100 partition images on the web.
====== How to backup your AC100 ======
First install [[nvflash|nvflash]] on your PC.
=== The manual way ===
Your AC100 MMC contains several [[AC100_std_partitions|partitions]]. The manual way to backup them are:
- Connect a USB-cable between your ac100 (mini-usb) to your PC.
- Enter the recovery mode by keep pressing CTRL+ESC and power-up the AC100. The AC100 will turn on (check LED) but the display will remain dark.
- Start nvflash and load the bootloader to get access to the AC100. This has to be done only once, but everytime, after you (re)enter the recovery mode.
$ nvflash --bl /usr/lib/nvflash/fastboot.bin --sync
**Note:** fastboot.bin might be in a different location depending on your local installation of nvflash
- Download the present partition table of the internal flash-memory
$ nvflash -r --getpartitiontable partitiontable.txt
- Your number of partitions might be different to the below example (e.g., because you modified the partition table before already). Check the content of partitiontable.txt to get the number of partitions on your device.
more partitiontable.txt
- Backup the partitions according to your partition table. For the standard configuration this would be:
$ for i in $(seq -w 2 14); do nvflash -r --read $i part$i.img; done
**Note:** There is no partition 1 and the backups have the full size of the real partitions (make sure you have enough disk space).
- Create the BCT file from your part02 image:
dd if=part02.img of=ac100.bct bs=4080 count=1
You will need this later in case you need to do a full restore of your AC100.
- Optional: tar and gzip the image files, **deleting the original image files**$ for i in $(seq -w 2 14); do tar cfvz part$i.tar.gz part$i.img; rm part$i.img; done
- Create the cfg file. This file is derived from the partitiontable.txt file. You can download this little script http://share.grandou.net/ac100/linux-on-ac100/parttable_to_cfg to do the conversion automatically:
$ dos2unix partitiontable.txt
$ ./parttable_to_cfg partitiontable.txt > ac100.cfg
**Troubleshooting:** If it seems like the nvflash program does not response anymore, or a nvflash error messages appear, you might have to reconnect. Simply turn of the AC100 (long-press power button). You should again receive a prompt from the console. Repeat step 2 and 3 and continue.
=== The automated way ===
TODO
====== How to restore your AC100 ======
nvflash --bl /usr/lib/nvflash/fastboot.bin --sync
nvflash -r --download part.img
The [[partitionlayout|Partition Layout]] might also be interesting to look at.