LineageOS › Forums › Forum for Common Topics (Generic Topics for all Devices) › TWRP – Team Win Recovery Guides › How to Take NANDROID Backup on TWRP Recovery
- April 29, 2016 at 5:51 PM #3202
If you are looking to take a NANDROID backup on your Android device using TWRP recovery then I will simplify your worries and tell you in simple step-by-step guide with screenshots how exactly you can do that. After finishing this I believe there is no need for you to come and do this again and again. Imagine how simple is this!
What is a NANDROID backup ???
When you are going to flash a custom ROM on your phone everywhere people are shouting take a NANDROID backup… take a NANDROID backup… what exactly is that? The name is there from the CWM days as far as I know. Basically the phone has an internal storage or even the microSD cards which are basically NAND flash storages. As we are dealing with Android, I guess some developer have named the storage backup process to NANDroid backup.
Basically a NANDROID backup means creating a backup of all the required partitions on your Android device. Android has a partitioned layout which has a boot partition, recovery partition, system partition, data partition, cache partition etc. When we take a NANDROID backup we are actually copying all the data in each partitions as a single file. you know what I mean to say… I mean the boot partition will be captured in a single file called boot.img, similarly the system partition in system.img and so on. This way the backup and even the restoration process gets much easier for the end user.
If you are looking to have a complete backup of your Files, Contacts, Messages so that they can be accessible and can be synchronized with other ROMs too then definitely this is not the Backup Guide you are looking for. Below is the link for the same:
How to Backup All of Your Data on Any Android device
This feature is mostly missing on stock Android devices and you will only get it on CWM, Philz, TWRP or Cyanogen recoveries.
What is the benefit of having a NANDROID backup ???
you can think of a NANDROID backup as a SNAPSHOT of your current phone’s state. Lets say you have installed many apps on your phone, have many messages, contacts, etc… everything will be there as it is. So, you have the state of your phone on a given point in the time line. Basically this is ONLY helpful if you are trying a new Custom ROM which is buggy but you want to fall back again to your old ROM whether it be stock or any custom ROM.
The reason being, you are keeping all the backup data as a single file which can only be read by the recovery and to restore only. You cannot extract any other data lying in those backup files.CAUTION:
A nandroid backup will not be helpful if you are planning to migrate to a different ROM permanently. What I mean to say is, lets say you are flashing a Custom ROM which you already know that is stable and you can carry on using the new ROM then this nandroid backup will not be helpful. Instead you need to use Titanium Backup or Backup all data individually and then migrate all the data to the new ROM.
How to take NANDROID backup from TWRP recovery:
Enough theory… I am impatient now. Show me how to take a NANDROID backup or whatever you call it, just show me how to do it. Here it goes:STEP 1:
Go ahead and reboot your device to recovery mode. So, now you must be on the TWRP home screen.
Now, on the TWRP home screen click on the Backup touch button.
Below is a screenshot of the TWRP home screen marked on the Backup button which you have to select to create a nandroid backup.
On the Backup screen, select all the partitions which you want to keep and then swipe the touch button at the bottom of the screen to take backup of the complete ROM with your data. But before that you should read all the things that I have mentioned because it is really worth the reading. Trust me, this is the place you need to be more careful and alert before you execute anything.TIPS:
– The boot and system partitions are the basic backups needed to boot the system and hence are the must needs.
– Just to help you understand, A NANDROID backup is only helpful when you have the current Data partition which contains all the Applications, Messages, Contacts etc. Otherwise you can always flash the same Custom ROM from a zip file and go back to the initial stage but you will miss the current data.
– The Cache partition is just an add-on, without which there will be no impact and the system will re-generate the cache from the data that you have. If you have the cache partition the system will boot faster that’s it.
– The PDS partition basically keeps your IMEI, modem information and all which does not affected as part of a custom ROM flashing. But it is always a good idea to have this for the first time you backup.
Here goes a screenshot with some extra areas selected by me:
Wohoo… there are many things you have marked on one screen which are just scaring. Don’t worry there are simple things which you must observe before taking a backup otherwise your backup may FAIL.
– First of all see the options covered under the red rectangular box. Make sure you have done the same thing before taking a backup.
– Enable compression option will save some space by compressing the data. Don’t panic… even after compressing your data does not change and the Restore algorithm knows how to uncompress and extract the data.
– Don’t check the Skip MD5 generation during backup option. This is useful when you will go for a restore. Basically the MD5 hash data will confirm the backup that you have is really valid and not corrupted in-between.
– Definitely don’t check the Disable Free Space check option. If you will check this option then the TWRP will not check how much size you are taking backup and how muxh space you have on your phone or microSD card. See the example below to understand more on this:
– See the Storage: Internal Storage (2417) that I have marked on red with an oval box. Basically it says that I have 2417 MB of space left on my phone. If you see closely to the data partition that I am going to take a backup itself is of 5422 MB (marked on a blue box) which anyway is not going to fit in my phone’s storage. This is where you need to be careful and make some space before you take the backup. If you disable the Free Space Chcek option then you will face problem here.
Now if everything is OK then go ahead and take a backup. Move the backup from your phone or SD card to a PC or some cloud space. Now have fun and feel free to leave a reply if you are facing any problem.
If you want to know how to wipe data using a TWRP recovery then move on to the below link:
How to Clean/Wipe Data using TWRP on any Android PhoneApril 2, 2017 at 7:13 PM #16628
On my Lenovo K3 Note, apart from Boot (16MB), System (2169MB), Data (5584MB) and Cache (0MB);
I can see many more partitions like: Logo (8MB), Nvram (5MB), Recovery (16MB), Uboot (0MB), Proinfo (3MB), Protect (0MB), Parametr (0MB), Secro (6MB), Tee (10MB), Frp (8MB).
And there is no PDS partition as you have mentioned. Can you please tell me what these extra partitions are for and which all should I select in my Nandroid backup?April 3, 2017 at 2:25 AM #16674
I saw these many partitions in an android device for the first time.
I can see there are some partitions with 0MB size which may not have anything in it
I will recommend to have a backup of all the partitions (including those empty partitions) for the first time and keep all the files in a PC or some cloud storage for future access.
Next time onward you can have only the /boot, /system and the /data partition backed up.
Also, while wiping you need to take care that you should never clean any partition other than the /system, /data and /cache partition or sometimes the /boot partition. I don’t see a reason to clean any other partition before going for a ROM upgrade unless the ROM developer has some special instruction to clean any of those other partitions you mentioned.April 3, 2017 at 12:10 PM #16690
Thanks Shibaa. Will keep those points in mind. Right now I’m struggling to free up space on internal storage as I’ve only 800 MB left :(. Is it possible to backup each partition separately and then move it to PC/cloud or do I need to back them all up at once?April 4, 2017 at 12:21 PM #16749
Here are some more updates. To overcome the problem of free space, I first uninstalled quite a few applications, deleted photos, videos and app associated folders. By that I managed to get around 2 GB free space. So I went on and took backup of Boot and System. Moved it from TWRP/BACKUPS/K50 folder to my PC.
Then I added an 8GB SD card to phone. Then in Settings > Storage & USB > SD Card I got an option / menu item to “Format as Internal Storage”. After formatting I got an menu item to Migrate Data (from internal storage to SD Card). When I tried migrating, it gave an error like, migration failed, data remains at old location. But when I check the size of internal storage and SD card I could see following: Screenshot_2016-12-22-07-26-55-695.jpeg
So I could see that data was moved and now there was sufficient space on internal storage to backup my data partition. So I went ahead and backed up all remaining partitions. That finished successfully. But when I rebooted the phone and tried to find the file from windows explorer I could not find anything under TWRP/BACKUPS/K50 folder. I rebooted into recovery and checked the contents of /sdcard and noticed that it was having only TWRP folder (and 1 more folder related to CWM, as I had installed it last week). All other folders were missing. Then I realized that in recovery mode it was showing the contents of internal storage but when the phone is booted completely it shows the contents of external SD card and there is no way I can access the folders on internal storage now. 🙁
So I tried moving my data back to internal storage and again got the same error but this time it actually didn’t move the data :|.
Then I thought I should mount the external SD card in TWRP and then move the backup from internal storage to external SD card. But for some reason TWRP is not allowing me to select external SD card under mount option (though it is present there). Do you know what could be the reason?
Meanwhile I noticed that the backup that I had taken of all other partitions was deleted (probably during moving data from external SD to internal storage). So I’ve again taken backup of all partitions excluding data (and system & boot) but its still on internal storage and I can’t access it from PC.
I even tried using
adb shell ls sdcard/TWRP/BACKUPS/K50command to see what I get, but got it empty.
So how do I get the remaining back up on my PC?April 7, 2017 at 7:37 AM #16902
It is absolutely possible to take backup of one partition at a time.
Can you confirm if you can access the phone storage when you are in TWRP recovery?
Just connect the phone to your PC while you in TWRP recovery. You should see the phone storage in your Widows explorer (it must be connected in MTP mode). If you can’t see the phone storage when you are in TWRP mode, then just go to mount in TWRP and check if enable MTP or similar settings related to MTP is enabled !!
You can operate the TWRP flawlessly (as far as I understand) while accessing your phone storage. All at the same time !
Just backup one partition from TWRP, and see if it reflects immediately in the MTP storage on the PC end. If things are fine, then you are done.
Let me know how this one goes.April 7, 2017 at 12:40 PM #16924
Thanks for the clarification. But I managed to copy the backup to PC using
adb pullin recovery mdoe. Earlier I was trying it after booting my phone normally and thats where it was not able to see the contents of internal storage. Once I used
adb pullin recovery mode I was able to access it.
I was not aware of MTP mode in TWRP, otherwise I would have used that 🙂
Meanwhile my current problem is that Lineage OS installation is failing. Please check this post: //www.cyanogenmods.org/forums/topic/lenovo-k3-note-lineage-14-1-nougat-7-1-rom/#post-16834April 7, 2017 at 10:33 PM #16951
Have you checked the follow-up comment for your problem: //www.cyanogenmods.org/forums/topic/lenovo-k3-note-lineage-14-1-nougat-7-1-rom/#post-16909
It’s just a matter of updater-script modification trick. I hope you will be able to do that.
December 12, 2018 at 1:47 AM #62962
- This reply was modified 8 months, 1 week ago by shibaa987.
Luis Alexander Jimenez AlmaguerParticipant
I have a Samsung S4 mini GT-I9190 and I also had several partitions and none of them in .zip format.
Can I restore later from that files?
You must be logged in to reply to this topic.