Extracting files from a nandroid backup using unyaffs
I recently upgraded my G1 phone to the latest Cyanogen build (5.x). Since the upgrade instructions recommend wiping user data, I made a “nandroid” backup first, using the handy Amon_RA recovery image. I’ve gotten pretty familiar with the Android filesystem layout, and was confident I could restore anything I really missed (such as my wpa_supplicant.conf with all of my WiFi credentials).
It wasn’t until I finished with the upgrade that I realized the backup wasn’t trivial to work with. It’s a raw yaffs2 flash image, which can’t be simply mounted on a loop device. After messing around for a bit with the nandsim module, mtd-utils and the yaffs2 kernel module, I realized there was a much simpler way: the unassuming unyaffs. It says that it can only extract images created by mkyaffs2image, but apparently the images in the nandroid backup are created this way (or otherwise compatible with unyaffs).
So I downloaded and built unyaffs:
svn checkout http://unyaffs.googlecode.com/svn/trunk/ unyaffs
cd unyaffs
gcc -o unyaffs unyaffs.c
and then ran it on the backup image:
mkdir g1data && cd g1data # unyaffs extracts into the current directory
~/src/android/unyaffs/unyaffs /media/G1data/nandroid/HT839GZ23983/BCDS-20100529-1311/data.img
At which point I could restore files one by one, e.g.:
adb push /tmp/g1data/misc/wifi/wpa_supplicant.conf /data/misc/wifi/
After toggling WiFi off and then back on, all of my credentials were restored. I was able to restore preferences for various applications in the same way.
Hi Matt, thanks for sharing some details of your findings.
I am intrigued, why are you using wpa_supplicant.conf on your phone ? Is it just for convenience because you have many credentials and use the same file in other system(s) ? Or some other reason ? Just curious.
Another question, do you feel the newer 5.x ROM is faster than the stock one or the previous CM ones ?
Fabian Rodriguez
June 2, 2010 at 01:04
wpa_supplicant.conf is the standard place where Android stores WiFi credentials.
Performance varies widely depending on background tasks, settings and the like. I’m finding it roughly equivalent to 4.x in my usual setup (i.e. not very fast), but it was significantly faster when it was freshly installed.
Matt Zimmerman
June 2, 2010 at 08:11
Hi Matt,
Can you share with me the nandsim and nandwrite binaries and also the nanddump binary compiled for android architecture if possible.
I am planning to create a physical copy of NAND memory of Nexus One for which I need access to the above files.
Your help would be highly appreciated.
Also it would be great if you van reply me on apurva.rustagi@ymail.com
Apurva Rustagi
July 12, 2010 at 02:01
hey there, so then is it possible to recover lost text messages from nandroid backup that refuses to load? if so can you email me the instructions? rcortez88@gmail.com
chris
September 23, 2010 at 03:21
thanks for that tip, I was able to get into my backup files like a charm. it’s obviously a one way tool by the name of it, is there a tool that would repack stuff into my backups or is that way too complex to do?
monkeyman
January 10, 2011 at 20:29
[…] https://mdzlog.alcor.net/2010/05/29/extracting-files-from-a-nandroid-backup-using-unyaffs/ […]
Extract files from nandroid backup « pete harris
March 15, 2011 at 18:44
Thanks for this.
Unyaffs was installed on my phone so I did a “adb shell” and extracted the image file on the sdcard. Then it was easy to recover my wpa_supplicant file.
lars
October 7, 2011 at 18:49
[…] there's a (tricky) way : How to extract the files of Nandroid backup on Windows Extracting files from a nandroid backup using unyaffs We'll see | Matt Zimmerman Recovering data from nandroid backup – Andrzej […]
Extract CWM Backup? - Android Forums
November 8, 2011 at 07:50
Thank you very much for this tip. It almost saves lives!
Dalton
January 22, 2012 at 19:06
[…] quick search on Google points to these instructions on extracting files from a Nandroid […]
extract files HTC rom | XL-UAT
March 9, 2015 at 09:59