WARNING! You are doing this method on your own risk and you agree to fact that you may loose your data anyhow!

Why I cannot just make backup/restore in recovery?

Because recovery makes image of whole partition, not just backup of files, and when you restore this backup it’s formatting your partition to filesystem, which has been used when backup was made.

What do I need to migrate without loosing data?

  1. ADB installed on your PC
  2. any operating system (Windows/Mac/Linux – doesn’t matter)
  3. sdcard with enough memory to backup whole your /data partition – internal storage is part of /data partition, will also get purged, so we cannot use it (but don’t worry, it will be a part of our backup ( ͡° ͜ʖ ͡°))
  4. some basic knownledge of using ADB

How to perform a migration?

  1. Reboot to recovery.
  2. Go to Mount menu and make sure that /data and /MicroSD are selected.
  3. Open Command Line (Windows) or Terminal (Linux/OS X) on your PC.
  4. Type adb shell and press ENTER.
  5. Type cd /external_sd.
  6. Type tar -cvf data.tar /data/*
  7. Wait until operation will finish. If you see any error, it means you don’t have enough free space on your SDcard.
  8. Perform steps from How to use f2fs? tutorial.
  9. Reboot, but not to system – just back to recovery. If you will boot your phone now, you will need to perform another /data wipe.
  10. Now again type adb shell on PC, because after reboot our phone has been disconnected, and press ENTER.
  11. Go to Mount menu and make sure that /data and /MicroSD are selected.
  12. Now type: cd /external_sd && tar -xvf data.tar -C /data/ && cd /data && mv data backupf2fs && rm -r media && cd backupf2fs && mv * ../ && cd .. && rm -r backupf2fs.
  13. If previous step didn’t produce any error, reboot your phone and check if it’s boot succesfully. If yes, you can safely remove data.tar file from your SD card.
  14. Done. You have migrated to f2fs without loosing your data!

Author: NovaFusion

22 Responses
  • El Oso says:

    Cool!

  • Leandro Sousa says:

    I can’t restore the data
    Error: tar: seek failure: Value too large for defined data type

    • Elmario says:

      Maybe your tar file is corrupt? What filesystem does you SD card use? If it grew to more than 4GB FAT couldn’t handle it.

    • kiiverk says:

      I had the same problem, it seems to be bug with “tar” large file support >2GB
      To avoid that error, data.tar file must be <2GB.
      If already deleted your /data partition then its needed to "repair" the data.tar
      For that i needed to split it to two files.
      There is multiple ways to do this but i used PC as intermediary so first transfer data.tar to PC:
      adb pull /external_sd/data.tar C:\data.tar
      Then made two copies of data.tar and deleted half data from one and exactly another half from other tar so both were less than 2GB. (used 7zip in windows)
      Put data back to phone:
      adb push C:\data1.tar /external_sd/data1.tar
      adb push C:\data2.tar /external_sd/data2.tar
      wipe /data partition again
      And do step 12. which is now slightly modified:
      cd /external_sd && tar -xvf data1.tar -C /data/ && tar -xvf data2.tar -C /data/ && cd /data && mv data backupf2fs && rm -r media && cd backupf2fs && mv * ../ && cd .. && rm -r backupf2fs
      reboot recovery
      install latest soft again
      wipe dalvik
      To avoid this problem the data.tar should be already generated less than <2GB or splitted.

    • kiiverk says:

      +1, I managed to fix this error but my post does not appear here, tried two times.

    • Leandro Sousa says:

      The problem is the tar file is bigger than 2gb

    • Ashus says:

      Well you have to “adb pull” the data.tar to the PC, edit it using 7zip and remove stuff already successfully extracted (in my case the /data/app dir). Then rename it to data2.tar and “adb push” it back. Now just run the extract command again, but on this new file (after done extracting the first one).

  • T3seR says:

    I install the ADB on PC, sansung drivers, i mont the external SD and data but, the pc can’t connect on cell and the pront show msng: “error. device not found”

  • osssman says:

    Thanks 🙂
    Can you please add another guide for the ones who doesn’t really know how to use adb ?

    P.S you are doing an amazing job, keep going

    • Evi1M4chine says:

      adb is like [ssh]. A remote log-in. You log in to a [CLI shell] of your phone. Usually [ash], but you can enter [bash] to use that too. So by learning the basics of working on a Linux shell with a file system, [man pages] and the [GNU utilities], you know how to do everything. It’s also extremely useful if you want to do actual work with a computer (instead of playing with colorful clickables and consuming information), without being a programmer. (See: [shell scripting]). As in: Automating your work away, then just put your feet up and watch it do its work, only asking you when really necessary. Like a computer should. 🙂
      (Look up all the terms in square brackets. Then read the sentence again. This allows you to judge properly what you need and what you don’t. 🙂

  • Elmario says:

    Well, i completed the whole procedure succesfully, but my phone won’t boot after data is back on f2fs partition. It’s claiming ‘Encryption unsuccessful’, but i don’t even have encryption enabled. I also wiped cache before booting into system. I did not boot system in between steps. Every step completed without any error.

  • Bipsen says:

    Worked perfectly

  • Radek Nemec says:

    Why is important to remove “media” folder?

  • Elmario says:

    Is this supposed to work with Carbon at all, yet? (Just for data partition?)

  • iman says:

    commands dosen’t work for me .
    cd /external_sd
    i use cd /extSdCard and it work but
    tar -cvf data.tar /data/* dosen’t work it says
    tar: /data/*: No such file or directory
    tar: error exit delayed from previous errors

  • iman says:

    i try again and it work i don’t access adb in superuser.
    now everything is ok

  • Guest says:

    Thanks for this great tutorial. Everything worked fine.

    One suggestion: Add a link to ADB tools for users not nowing anything about ADB or where to find it.
    I used ADB from here: http://forum.xda-developers.com/showthread.php?t=2588979

  • c2lhu says:

    Hey is it possible to save my stuff with Titanium Backup and restore them after the reformat???

    Anyone done it?

  • Leave a Reply