Working with ext2 images under Windows
My HTC HD2 running on Android from SD card had been working well for some time until it could not boot to Android one day (booting to Windows Mobile was still fine). Obviously I could redownload the same Android build, but this would mean loss of text messages, applications, call history and any other data not backed up or synchronized with Google server. In an attempt to salvage these data, I looked at the Android folder on the SD card and notice the following files:
data.img: contains user data such as text messages, applications, etc.
system.ext2 and rootfs.img: Android system files
Although most guides suggest using a Linux live CD such as Ubuntu and use the mount command to mount them as drives, which actually works, I wanted to do the same in Windows. My first try is to use Daemon Tools. This obviously has no chance of success, as the tool is meant to mount CD/DVD images, and not disk images, not to mention the Ext2 filesystem used by Android. I then tried various Windows tools to open/mount Linux images, and summarized the results in the following table. Take note that the image may be easily damaged if mounted by a tool not supporting it, or if not unmounted properly. If you want to try this, remember to back up first!
data.img
|
rootfs.img
|
system.ext2
|
|
R
|
R
|
R
|
|
X
|
R
|
R
|
|
X
|
RW
|
RW
|
|
X
|
RW
|
RW
|
|
R
|
X
|
X
|
|
X
|
R
|
R
|
Legend
X=failed
R=read-only access
RW=read/write access
You may need the Ext2 driver for Windows for some of the tools to work. Also read this tutorial on using IMDisk.
Looking at the table, Ext2Explore does the best by supporting all 3 images, albeit with read-only access. GizMo and ImDisk supportĀ read/write access for rootfs.img and system.ext2 (with IMDisk being more stable), but not for data.img, where most of the user data stays. DiskInternal Linux Reader supports data.img in read-only mode, but not the other two images.
So what is so special about data.img? Some websites say it is using YAFFS2 filesystem, which only applies for phones with Android on ROM. Since my Android is on SD card, I believe data.img still uses ext2, perhaps with some special format causing most Windows tools to fail mounting it.
Extending system.ext2
My next challenge is to use Windows to extend my system.ext2 as I want to add some fonts and background images and my system.ext2 does not have enough space. This time, despite finding no Windows tools that provide read/write access to data.img, I find a set of tools from xda-developers that does the job. The author compiled the source code of dd, dumpe2fs, e2fsck, mke2fs and resize2fs to run under Windows and built a user interface for it using Tclkit:
However, the TopoResize app is poorly written and crashes all the time. I resorted to resizing the image using the command line tools mentioned above:
The set of command line tools I used can be downloaded here. Next thing on my wishlist is to open data.img read/write on Windows; if anyone knows of a way, do leave a comment here.