For those of us that love installing apps and tinkering around with Android on our HD2's, 256MB of "Device" memory simply isn't enough! This fix will increase the size of the data.img file so that there will be more free space available when it's mounted. This is especially beneficial for users running on Android 2.1! See the attached picture!

Download the data.img file corresponding to your build or resize your own by using the instructions at the bottom of this post.

Manually edit data.img if you want a different size or use a different build!

I wrote this tutorial using a European HD2, 8GB microSD card, DarkStone's Froyo_v1 and a laptop running Ubuntu 10.04, your experience may vary.

Requirements:

Desktop/Laptop running some form of Linux. IMPORTANT NOTE: Both, a PC and a Mac, can resize the .img file but not modify (specifically - run resize2fs) the ext2 file system that Android uses. I was in a hurry to post the resizing instructions and didn't fully test the procedure on a PC. Currently, this procedure is only possible on a Linux based operating system. I apologize if your time was wasted.

Procedure:
1. UnZip Android or your present data.img file to your Home Folder. Or a folder of your liking (or even on your memory card!), just remember to cd before you do the following:
2. Open Terminal and Copy&Paste (Ctrl+C, Ctrl+Shift+V) this:

Code:

dd if=/dev/zero bs=1M count=XXX >> data.img

where XXX is the amount, in MB, by which data.img should be increased by.
My filesize started out as 256MB and I wanted a total of 512MB. That would mean I needed a extra 256MB, so I executed this:

Code:

dd if=/dev/zero bs=1M count=256 >> data.img

3. Run a file system check and file system resizer

Code:

e2fsck -f data.img
resize2fs data.img
e2fsck -f data.img

if prompted, press "y" for "yes"

4. Copy all of the Android files onto your SD card, put it into your phone, and run CLRCAD.exe and HARET.exe!

Don't know how to cd?
If you're running a modern build of Linux you can just mount your SD card (phone or cardreader), open File Browser and paste "dd if=/dev/zero bs=1M count=XXX >> " into your open Terminal. This way you can just drag and drop the file into Terminal rather than typing out the file location!

Mounting:
If you're switching between builds and need to copy more than just your apps (apps are easily backed up by ASTRO File Manager - found on the Android Market), mount your data.img file and copy/backup the relevant data before moving on!Linux:

Code:

mount -o loop data.img /mnt/data

you can put your apps into the AndroidApps folder before booting for them to be auto-installed

just writes zeros to the end of the data.img...
shouldn't this work with a used file too?

I was thinking that too...
I tried it at least 3 times, but Android still displayed 0.00 MB free memory (heh heh, i know )
Maybe because the system registers the size of the mount after the initial boot and never bothers checking it?!?

XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality.Are you a developer?