[HOWTO] Backup and Restore the System Software

Search This thread

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
The recently posted rooting method for the KFHD has been great for owners to get started on modifying the device to suit their own tastes. However, I've been a little concerned about everybody jumping in without a safety net in place. There are numerous ways that this device can get bricked. Not to put all of you into a panic, but just getting an eventual OTA update from Amazon might put some of these rooted KFHDs in jeopardy. With no custom recovery on the horizon, I think it's important to have some backup/restore plan to get these devices booting again.

Overview

This backup plan involves making raw data clones of all critical storage partitions required to boot the device. These backup archives can then be stored somewhere off the device. In case of some critical failure that prevents the device from booting normally, these archives can be used to get the device booting normally again. The restore procedure requires the use of fastboot to write the backup archives back to their proper partitions. The use of fastboot requires a working bootloader, so the device will need to boot to the bootloader's bootlogo at a minimum. If the device has a broken bootloader, this guide will not be helpful. There's currently no working procedure for repairing a broken bootloader on the 2nd generation Kindle Fire devices.

To be clear, this guide is not a backup/restore plan for your data. This is strictly for backing up the system software while in a bootable state and recovering it if some modification bricks the device. This procedure has been tested on a KFHD with system software version 7.1.1. Although I have not tested it, I'm nearly certain it will work just fine on version 7.1.5. If the KF2 has the same partition layout as the KFHD, there's no reason why it shouldn't work for that device as well. Check the post on KFHD partitions for details.

Warning: Everything below is inherently dangerous and can potentially brick your device if they are not executed properly. I have tested various aspects to the best of my ability, but you assume all responsibility for performing any of these steps.

Backup

Attached is a small shell script written to do the following…

  • Make a "kindlebackups" directory in /sdcard (if necessary) and make it user read/writeable.
  • Create gzipped backup archives of partitions 1 through 11. This includes all partitions except /cache and /data.
  • Make all archive files user read/writeable.

The entire backup (stock) takes up approximately 550 MB, so be sure to have at least that much available in /sdcard. Root privileges are required for the script to run properly. The best time to use this script is after step two of the published rooting procedure. That's after the second reboot of the process when the device boots up in emulation mode and allows root access for the first time. At this point, the system partition is completely stock and has not been exposed to any modifications. Even if you are past this point, the backups will still be useful for any bootable state that allows root privileges.

Download the script, unzip and place it into your current working directory where you still have access to adb, then run the following adb commands to copy the script to the Kindle Fire and prepare it to be executed...

Code:
adb push backup.sh /data/local/backup.sh
adb shell chmod 777 /data/local/backup.sh

If the device is in the process of being rooted and it has just finished rebooting for the second time...

Code:
adb shell /data/local/backup.sh

If the device has already been rooted and the su binary is available on the system...
Code:
adb shell su -c "/data/local/backup.sh"

The entire process should take approximately 5 minutes. Once the script has completed the backup, access the Kindle Fire's storage area from your computer, then copy the contents of the "kindlebackups" folder to it. The "kindlebackups" folder may be deleted after transferring to your computer.

Restore

To begin the restore procedure, the device must be put into fastboot mode. My factory cable did the job for me, so I have not explored the possibility of changing bootmodes. I developed this guide on a borrowed KFHD and I do not intend to risk the device more than necessary. Unless someone comes forward with a procedure to change bootmodes into and out of fastboot mode, I'm going to say that a factory cable is required for the time being. Besides, based on my experience with the original Kindle Fire, a broken system almost always means there is no way to change the bootmode through it. Since this procedure will very likely be used on a device that cannot boot completely or otherwise has a bad system, a factory cable will probably be the only way into fastboot mode. If you plan to root or modify your system software, invest in a factory cable.

  • Use the factory cable (with the device turned off, plug into the device, then the computer) to get to fastboot mode. If successful, a "fastboot" logo will take the place of the original "kindle fire" logo.
  • Decompress the gzipped archive to be flashed… Linux users have gunzip, Mac OS X users also have gunzip and a built-in GUI utility, and Windows users can use 7-zip. The archive must be decompressed before flashing. Skipping this step will brick your device.
  • Flash the image file(s) back to the device. In most cases, the device will just have to get a working system partition flashed back to it, but the others are available if they are needed. To flash the system partition...

Code:
fastboot -i 0x1949 flash system system.img

- Optionally erase the cache and/or userdata partitions if the contents of either interfere with the operation of the system software. The system will rebuild them on reboot…

Code:
fastboot -i 0x1949 erase cache
fastboot -i 0x1949 erase userdata

Once the process is complete, long-press the power button (~20 seconds) until it powers down, unplug the factory cable, and power the device back up.

Good luck.
 

Attachments

  • backup.sh.zip
    1.1 KB · Views: 2,575
Last edited:

Ichigo

Senior Member
May 30, 2012
7,588
0
Nowhere
Thanks kinfauns. I appreciate everything you did for the original kindle fire. This should help a lot of people.

Sent from my Kindle Fire
 

vuhai6

Member
Sep 9, 2006
23
0
When i boot my kindle fire hd to fastboot (by factory cable) and connect it to pc, pc can't recognize kindle, it don't have driver for it.
 

Yuretz

Senior Member
Nov 22, 2005
55
4
Could anybody post his clean backup here? Screwed my kindle, want go back to stock. Backup is only way.
 

ceebu

Member
Oct 11, 2012
37
6
Redmi Note 9 Pro
Copying kindlebackup folder

Thanks for the script - the backup procedure was smooth -

I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)
 
  • Like
Reactions: jgskin

dreamcryer

Member
Nov 22, 2008
26
0
Thanks for the efforts!
BTW, will a backup from a clean device work for other devices instead of the same one which the backup was created from? Just wondering if people who have already fiddled around their root devices can get a fresh start.
 

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
When i boot my kindle fire hd to fastboot (by factory cable) and connect it to pc, pc can't recognize kindle, it don't have driver for it.

I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

http://xdaforums.com/showpost.php?p=23747671&postcount=2

for device driver information. Again, written for the original KF, but the process for installing device drivers is the same. Only the PID is slightly different and that should get edited in the INF before installation.

Thanks for the script - the backup procedure was smooth -

I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)

Glad to hear it worked out for you. I am not familiar with that program, but the KFHD should connect automatically to a Windows device as external storage... does it not?

Thanks for the efforts!
BTW, will a backup from a clean device work for other devices instead of the same one which the backup was created from? Just wondering if people who have already fiddled around their root devices can get a fresh start.

I have not tested this and don't have a way to do so. I have some concerns about it, but I'm sure someone desperate enough will jump in and try it out. I know it's too late for some, but my suggestion is for everybody to make a backup if you can and not rely on someone else to give you archives after the fact. It's better to have your own backups.
 
Last edited:
  • Like
Reactions: naingnaing

vuhai6

Member
Sep 9, 2006
23
0
I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

http://xdaforums.com/showpost.php?p=23747671&postcount=2


But pc don't recognize as Kindle, it as Tate-PVT-08 (sorry, i use mac cho screenshot, but windows too)
 

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
My kindle is also not recognized when plugged in

Then you're first going to have problems getting root privileges. You need to get adb working before you attempt any part of rooting or backing up with this procedure.

But pc don't recognize as Kindle, it as Tate-PVT-08 (sorry, i use mac cho screenshot, but windows too)

This is the correct "product" reported by the KFHD. This and the product ID (0007) are the only differences between the KFHD and the original when it comes to installing the device drivers on Windows.

I was only able to see the contents of /sdcard using windows...

Sent from my GT-I9100 using xda app-developers app

/data/media and /sdcard are essentially the same thing (see the second post in this thread for an explanation of why this is the case). You should have seen kindlebackups in that directory.
 
  • Like
Reactions: vuhai6

Yuretz

Senior Member
Nov 22, 2005
55
4
I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

http://xdaforums.com/showpost.php?p=23747671&postcount=2

for device driver information. Again, written for the original KF, but the process for installing device drivers is the same. Only the PID is slightly different and that should get edited in the INF before installation.



Glad to hear it worked out for you. I am not familiar with that program, but the KFHD should connect automatically to a Windows device as external storage... does it not?



I have not tested this and don't have a way to do so. I have some concerns about it, but I'm sure someone desperate enough will jump in and try it out. I know it's too late for some, but my suggestion is for everybody to make a backup if you can and not rely on someone else to give you archives after the fact. It's better to have your own backups.

I'm ready to try
 

strat6

Member
Jun 30, 2012
23
4
Didn't show at first

Kindlebackups showed up in root browser right away, but didn't show on PC until I rebooted KF2. So now should
I decompress and put in folder containing ADB?
 
Last edited:
  • Like
Reactions: Xyth

kinfauns

Retired Senior Moderator and Retired DC Lead
Jan 5, 2012
1,864
3,543
I'd appreciate it if everybody would refrain from making this a "beg for a system image" thread.

Kindlebackups showed up in root browser right away, but didn't show on PC until I rebooted KF2. So now should
I decompress and put in folder containing ADB?

You can put the the images wherever you want, but you'll need to specify the path to the file. For example, if you are using Windows and put the kindlebackups directory on C:, you just need to modify the command to...

Code:
fastboot -i 0x1949 flash system C:\kindlebackups\system.img
 

onemeila

Senior Member
Jan 2, 2012
320
269
Winchester
Thank you for posting how to do this. It opens a lot of doors with at least a little security.
I made a backup earlier without a problem, then went ahead and made myself a factory cable(easy to do and worked great- old asus usb cable, 1k resistor, soldering iron, shrink tape and voila!). I feel much better about doing any mods to this device now knowing I can just flash my backup.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 21
    The recently posted rooting method for the KFHD has been great for owners to get started on modifying the device to suit their own tastes. However, I've been a little concerned about everybody jumping in without a safety net in place. There are numerous ways that this device can get bricked. Not to put all of you into a panic, but just getting an eventual OTA update from Amazon might put some of these rooted KFHDs in jeopardy. With no custom recovery on the horizon, I think it's important to have some backup/restore plan to get these devices booting again.

    Overview

    This backup plan involves making raw data clones of all critical storage partitions required to boot the device. These backup archives can then be stored somewhere off the device. In case of some critical failure that prevents the device from booting normally, these archives can be used to get the device booting normally again. The restore procedure requires the use of fastboot to write the backup archives back to their proper partitions. The use of fastboot requires a working bootloader, so the device will need to boot to the bootloader's bootlogo at a minimum. If the device has a broken bootloader, this guide will not be helpful. There's currently no working procedure for repairing a broken bootloader on the 2nd generation Kindle Fire devices.

    To be clear, this guide is not a backup/restore plan for your data. This is strictly for backing up the system software while in a bootable state and recovering it if some modification bricks the device. This procedure has been tested on a KFHD with system software version 7.1.1. Although I have not tested it, I'm nearly certain it will work just fine on version 7.1.5. If the KF2 has the same partition layout as the KFHD, there's no reason why it shouldn't work for that device as well. Check the post on KFHD partitions for details.

    Warning: Everything below is inherently dangerous and can potentially brick your device if they are not executed properly. I have tested various aspects to the best of my ability, but you assume all responsibility for performing any of these steps.

    Backup

    Attached is a small shell script written to do the following…

    • Make a "kindlebackups" directory in /sdcard (if necessary) and make it user read/writeable.
    • Create gzipped backup archives of partitions 1 through 11. This includes all partitions except /cache and /data.
    • Make all archive files user read/writeable.

    The entire backup (stock) takes up approximately 550 MB, so be sure to have at least that much available in /sdcard. Root privileges are required for the script to run properly. The best time to use this script is after step two of the published rooting procedure. That's after the second reboot of the process when the device boots up in emulation mode and allows root access for the first time. At this point, the system partition is completely stock and has not been exposed to any modifications. Even if you are past this point, the backups will still be useful for any bootable state that allows root privileges.

    Download the script, unzip and place it into your current working directory where you still have access to adb, then run the following adb commands to copy the script to the Kindle Fire and prepare it to be executed...

    Code:
    adb push backup.sh /data/local/backup.sh
    adb shell chmod 777 /data/local/backup.sh

    If the device is in the process of being rooted and it has just finished rebooting for the second time...

    Code:
    adb shell /data/local/backup.sh

    If the device has already been rooted and the su binary is available on the system...
    Code:
    adb shell su -c "/data/local/backup.sh"

    The entire process should take approximately 5 minutes. Once the script has completed the backup, access the Kindle Fire's storage area from your computer, then copy the contents of the "kindlebackups" folder to it. The "kindlebackups" folder may be deleted after transferring to your computer.

    Restore

    To begin the restore procedure, the device must be put into fastboot mode. My factory cable did the job for me, so I have not explored the possibility of changing bootmodes. I developed this guide on a borrowed KFHD and I do not intend to risk the device more than necessary. Unless someone comes forward with a procedure to change bootmodes into and out of fastboot mode, I'm going to say that a factory cable is required for the time being. Besides, based on my experience with the original Kindle Fire, a broken system almost always means there is no way to change the bootmode through it. Since this procedure will very likely be used on a device that cannot boot completely or otherwise has a bad system, a factory cable will probably be the only way into fastboot mode. If you plan to root or modify your system software, invest in a factory cable.

    • Use the factory cable (with the device turned off, plug into the device, then the computer) to get to fastboot mode. If successful, a "fastboot" logo will take the place of the original "kindle fire" logo.
    • Decompress the gzipped archive to be flashed… Linux users have gunzip, Mac OS X users also have gunzip and a built-in GUI utility, and Windows users can use 7-zip. The archive must be decompressed before flashing. Skipping this step will brick your device.
    • Flash the image file(s) back to the device. In most cases, the device will just have to get a working system partition flashed back to it, but the others are available if they are needed. To flash the system partition...

    Code:
    fastboot -i 0x1949 flash system system.img

    - Optionally erase the cache and/or userdata partitions if the contents of either interfere with the operation of the system software. The system will rebuild them on reboot…

    Code:
    fastboot -i 0x1949 erase cache
    fastboot -i 0x1949 erase userdata

    Once the process is complete, long-press the power button (~20 seconds) until it powers down, unplug the factory cable, and power the device back up.

    Good luck.
    1
    My kindles /system directory is already screwed. :( Do you have a system.img file I can use?

    Sent from my Galaxy Nexus using xda app-developers app
    1
    Copying kindlebackup folder

    Thanks for the script - the backup procedure was smooth -

    I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

    I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)
    1
    When i boot my kindle fire hd to fastboot (by factory cable) and connect it to pc, pc can't recognize kindle, it don't have driver for it.

    I don't know if anybody has packaged the device drivers set up for this device. If nothing else, you can get the device driver installer in the "Kindle Fire Utility" for the original KF and use that. You just have to change the PID from 0006 to 0007 before installing it and should work. Refer to this post if you still have problems...

    http://xdaforums.com/showpost.php?p=23747671&postcount=2

    for device driver information. Again, written for the original KF, but the process for installing device drivers is the same. Only the PID is slightly different and that should get edited in the INF before installation.

    Thanks for the script - the backup procedure was smooth -

    I couldnt find the kindlebackups folder while browsing through my PC and for others like me who wonder how to take these out of your KFHD, here is a simple way - I used a program called Wondershare MObilego (Manage SDcard option under more tools) Backing up was a cakewalk.

    I have no affiliation to this tool maker - Just sharing a way that helped a n00b like me. (First rooting experience)

    Glad to hear it worked out for you. I am not familiar with that program, but the KFHD should connect automatically to a Windows device as external storage... does it not?

    Thanks for the efforts!
    BTW, will a backup from a clean device work for other devices instead of the same one which the backup was created from? Just wondering if people who have already fiddled around their root devices can get a fresh start.

    I have not tested this and don't have a way to do so. I have some concerns about it, but I'm sure someone desperate enough will jump in and try it out. I know it's too late for some, but my suggestion is for everybody to make a backup if you can and not rely on someone else to give you archives after the fact. It's better to have your own backups.
    1
    My kindle is also not recognized when plugged in

    Then you're first going to have problems getting root privileges. You need to get adb working before you attempt any part of rooting or backing up with this procedure.

    But pc don't recognize as Kindle, it as Tate-PVT-08 (sorry, i use mac cho screenshot, but windows too)

    This is the correct "product" reported by the KFHD. This and the product ID (0007) are the only differences between the KFHD and the original when it comes to installing the device drivers on Windows.

    I was only able to see the contents of /sdcard using windows...

    Sent from my GT-I9100 using xda app-developers app

    /data/media and /sdcard are essentially the same thing (see the second post in this thread for an explanation of why this is the case). You should have seen kindlebackups in that directory.