Announcement

Collapse
No announcement yet.

Announcement

Collapse
No announcement yet.

Full backup over WiFi or Ethernet for X96 and maybe others

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Full backup over WiFi or Ethernet for X96 and maybe others

    Totally reworked to include the latest of my findings!

    If you ever had the need to create a backup from a TV box with TWRP or other custom recovery available then there might be a way now.
    But first a few words of warning:
    This is not for the faint of heart and certainly not for the beginner.
    I was able to create usuable backups in several ways, some are slower, some are faster.
    Restoring these backups however is a different matter.
    The box does not have a fully functional recovery or fastboot mode.
    This means we can not just connect a USB cable and perform the actions while in recovery or bootloader mode - the later does not even exist...
    Certain images can be renamed to be used with TWRP's recovery function but they can't be flashed as image files.
    Long story short: You can create a backup of all vital partitions but you need a running system to write them back or a custom flash tool.
    Still great for example if you want to test recoveries...

    General how to:
    I left the older batch files in the attached archive so people can see what other methods I used and might useful.
    X96_backup.bat is current and will make a disk image on the same folder you unpacked the archive.
    Recovery, Boot, Bootloader, Logo, Cache and System partitions will be created as images.
    Additionally the system folder itself will be pulled from the device, same for the internal memory (userdata).
    X96_userdata.bat will create a backup of the internal storage only, so all personal data and userstuff.
    Similar story for the recovery but with the limitation that I don't know if the writing of the system partition on a running system is a good idea.

    TWRP:
    If you need a backup that can be used with TWRP then simple rename the corresponding image files the same way used in the TWRP backups - emmc.win.
    Of course for this you need a wroking TWRP recovery first.

    Full NAND backup:
    X96_full_dump.bat will pull the entire mmcblk0 partitions from the device.
    This, on a normal Android system would include all parttions of the device in question.
    A lot of things are different on our boxes, so experiment with this backup however you see fit.
    I included the Testdisk utility for Windows.
    With this you can read the created mmcblk0 image and do a lot more - read it up if you have to.

    Additional notes and "words of wisdom":
    During my journey I noticed that a lot of things are totally different on our boxes compared to normal Android phones or tablets.
    Some partitions are only directly present but not as a reference to any mmcblk partition.
    ADB only works on a running system but not in any recovery.
    Fastboot is not even present - or at least I am unable to boot into it.
    My main aim was a simply way to backup userdata, the rest was just added in an attempt to create a PC based backup option.
    If you need a really complete and fully working recovery that is proven to work then please check other options first.
    What you do with these batch files is your thing, if you brick your device because different mount options are used then ask yourself why you did not check it first

    Detailed info to get the batch files to work:
    I included the ADB tools and all you need in the archive.
    Just unpack to a folder on your PC and open a command promt with admin right in this folder.
    Check the network settings on your box for the IP address it uses - note it.
    Run adb connect yourIP - where yourIP is the IP address of your box.
    Run adb root
    You now have root access to your box - if it is not rooted, don't worry too much.
    At this point you can just start the batch file you require.

    For the experts:
    A normal /cat proc/mnt won't work.
    If you need the corresponding blocks you need to look in
    /dev/block/platform
    There should be a folder with .emmc at the end of the name.
    Inside you find the "by-name" folder listing the blocks.
    If you note these and list /dev/block/ you should get the amount of entries.
    On my system however this does not add up, which means the manufacturer did not really care...
    ls -al /dev/block/platform/d0074000.emmc/by-name
    gives the corresponding dev block names.
    This info might be useful if you want to try other ways of creating or restoring backups or to manipulate data on the device.
    The images created from the system and data partition are only usable if you can mount them or use Testdisk.
    In theory is should be possible to just push them back as done in the restore.bat but I have my doubts it will work on a running system.
    TWRP creates backup images in a very similar way.
    This means you can rename the corresponding images pulled from the device for the use with TWRP after renaming them accordingly.
    So far however I have not found a way to properly extract the recovery to get to the data required to port a TWRP recovery from it.
    Might be as easy as trimming the image and adjusting the headers, but I had no time to check this approach.
    The data.img pulled contains the app data and all but again you need to mount it or use Testdisk to get to it.

    I hope all this is helpful for someone and might give us more things to play with.
    Archive is too big to attach, so :
    Download
    Last edited by Downunder 35m; 07-06-2017, 05:25. Reason: redone and new batch files plus Testdisk

    #2
    Looks very interesting.

    I will try this out on a couple of boxes.
    R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

    Comment


      #3
      Let me know ifit works for backups on more than just my X96.

      Comment


        #4
        Nice.....
        Many devices now mk902ii/Shield/Mk68 /Ugoos/neox5/minix5 (yes they still work lol) mk80 no it doesnt work lol.

        Comment


          #5
          I'm running it on an MX-IIIG II right now using the full backup option and it's going OK so far but it does highlight the slow WiFi on these boxes because it's definitely going to take a very long time.
          R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

          Comment


            #6
            Nice new way to back up... Have to try to now..... Blues you see fix for x96 that go to 1 gig on flash seems another way to return them to 2 gig found.
            Many devices now mk902ii/Shield/Mk68 /Ugoos/neox5/minix5 (yes they still work lol) mk80 no it doesnt work lol.

            Comment


              #7
              Originally posted by scooter2014 View Post
              Nice new way to back up... Have to try to now..... Blues you see fix for x96 that go to 1 gig on flash seems another way to return them to 2 gig found.
              No, not seen that but sounds very interesting.
              R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

              Comment


                #8
                If Wifi is too slow Ethernet might be faster.

                Comment


                  #9
                  Sadly no adb over ethernet on many AMLogic boxes.

                  Actually ignore that as I may be wrong.

                  Update: Yes it works over ethernet and is much faster, although I did have a few issues getting adb to show the box to be online.

                  For an all_full backup:

                  An hour and a quarter over WiFi
                  25 minutes over ethernet.

                  Noticed a few changes to the partition list for this box, so will modify the batch file, backup again, reset the box back to factory defaults and restore to see if it works.
                  Last edited by bluesmanuk; 07-01-2017, 08:35.
                  R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

                  Comment


                    #10
                    Use Wifi ADB then it will work also.

                    Neomode

                    Gesendet von meinem K6000 Pro mit Tapatalk


                    Comment


                      #11
                      Ran the full backup again but after it completed backing up the system.img it returned an error for the rest of them.

                      adb: error: connect failed: more than one device/emulator

                      Will investigate this error further.
                      R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

                      Comment


                        #12
                        Had that error too a few time, seems to be the old problem of the deamon not closing automatically.
                        I usually end the adb process in the taskmanager and start a new session.
                        That solves the emulator problem for me.
                        As for the partitions on other deives: Do a list of the partitions in /dev/blcok/ or through listing the filesystems in FX file explorer to find out the correct mounting names.

                        Comment


                          #13
                          I noticed a possible problem when restoring a backup I made this way.
                          The created images were empty.
                          Some I created earlier don't have that problem but that excludes the system partition.
                          Despite using DD to dump everything the data gets lost somewhere sometimes.
                          Might need further investigations....

                          Comment


                            #14
                            No matter what I try, I always get the device/emulator errors at some point.

                            But whilst looking at some of the images that are output, which can be of considerable size, it did make me wonder just how many of the unusual ones are either static in an original firmware or perhaps even auto generated.

                            Some examples would be instaboot.img, zram0.img, cache.img, which total 1.5Gb, or mmcblk0 at 1.1Gb

                            Plus a few others that generically don't seem present in a typically unpacked image.
                            R-TV BOX S10, Beebox N3150, Chuwi Hibox, Nvidia Shield, A95X Max

                            Comment


                              #15
                              That observation is correct.
                              Some of these images are part of the full firmware, the part that usually does not come with an update, some are generated during boot.
                              The ramdisk for example should usually be empty except for the stuff the OS is using.
                              I was hoping to find a way to get a full dump from which it would be possible to extract all that we might need.

                              Comment

                              Working...
                              X