Android OS Forum banner
1 - 9 of 9 Posts

·
Registered
Joined
·
32 Posts
Information:
What is this? Our phones contain a partition mounted as /preinstall which contains some game demos and video tutorials. After rooted, I could delete these (useless to me) apps and data but I still had no way to use the (now) empty space. After some research, I learned that /data, /preinstall, and /cache all reside in a nand block device called movinand. Using a port of parted (linked below), repartitioned this block device and shrunk /preinstall as small as I could. I then added this empty space to the /data partition making it approx 3.5GB.

WARNING: DO NOT ATTEMPT THIS UNLESS YOU HAVE MULTIPLE BACKUPS. If not done properly, you may render your device UNUSABLE and possibly irreparable!

DISCLAIMER: I did not port or develop any of these programs or methods. I am very new at this so expect some things in this tut to be not completely obvious, inconsistent, or even completely wrong


Prerequisites:
1) Working ADB connection (http://developer.and...ex.html]Android SDK[/url]
2) ClockWorkMod (I used KnightCrusader's)
3) Download this archive and save it to your sdcard

Preparation:

1) reboot into recovery
2) open cmd in the directory with adb.exe
3) type adb shell (if your prompt is $ instead of # then type su -> enter)
4) backup your movinand with this
Code:
dd if=/dev/block/mmcblk0 of=/sdcard/mmcblk0.bin bs=4096
This can take 5-15 mins. This backup file should be approx 2.25GB
5) In CWM mounts menu, Mount USB Storage
6) On your PC, copy mmcblk0.bin from your sdcard to your pc. Then delete mmcblk0.bin from the sdcard. If you haven't already done it, copy parted.tar to your sdcard
7) In CWM, go back to main menu and enter backup restore menu and do a full backup

Instructions:

1) From the adb shell, run this
Code:
cd /sbin<br />
tar -xf /sdcard/parted.tar
Permissions should already be set
2) Run this
Code:
parted /dev/block/mmcblk0
3) From the parted menu, type print
You should see this:
Code:
Model: MMC M4G1FB (sd/mmc)<br />
Disk /dev/block/mmcblk0: 3959MB<br />
Sector size (logical/physical): 512B/512B<br />
Partition Table: msdos<br />
<br />
Number  Start   End	 Size	Type	 File system  Flags<br />
1	  32.8kB  2357MB  2357MB  primary  fat32<br />
2	  2357MB  3645MB  1288MB  primary  fat32<br />
3	  3645MB  3959MB  315MB   primary  fat16
4) Type resize then Yes to the warning
5) Enter 2 for partition number, 3600MB for Start, and 3645MB for End
6) Type resize then Yes to the warning
7) Enter 1 for partition number, 32.8kB for start, and 3600MB for End
8) Type mkfs 2 fat32
9) Type print and you should now see this:
Code:
Model: MMC M4G1FB (sd/mmc)<br />
Disk /dev/block/mmcblk0: 3959MB<br />
Sector size (logical/physical): 512B/512B<br />
Partition Table: msdos<br />
<br />
Number  Start   End	 Size	Type	 File system  Flags<br />
1	  32.8kB  3600MB  3600MB  primary  fat32		lba<br />
2	  3600MB  3645MB  44.9MB  primary  fat32		lba<br />
3	  3645MB  3959MB  315MB   primary  fat16
10) Type quit

You should be able to reboot now and profit from 3GB /data and nothing in /preinstall


CREDITS:
Found the binaries here

Other Thoughts:

I suppose, we could eliminate mmcblk0p2 altogether but this would require changes to init.rc which I am not capable of ATM. Also, I would expect a factory reset to freeze if it cannot find the /preinstall partition. Thinking more about this... Maybe we could have init.rc create an empty /preinstall folder in root?

Why does /preinstall have to be 44.9MB? Every time I tried to make it smaller, I got an error during format that the partition is too small for FAT32 or FAT16
 

·
Android Beginner
Joined
·
95 Posts
Looks like it worked. I removed /preinstall and gave it all to /data, and recompiled a new kernel with all mention of /preinstall removed from it. Booted up, and it shows 3.2GB for data when I look in Applications.

The only weird thing was, when I removed /preinstall, I figured it would renumber /cache as mmcblk0p1, but it didn't... it stayed mmcblk0p2.... which is a good surprise, cause now I don't have to adjust the mount points for /cache anywhere else.

I am going to test the phone a bit today before I release the kernel I made and the instructions for completely removing /preinstall.
 

·
Registered
Joined
·
91 Posts
Looks like it worked. I removed /preinstall and gave it all to /data, and recompiled a new kernel with all mention of /preinstall removed from it. Booted up, and it shows 3.2GB for data when I look in Applications.

The only weird thing was, when I removed /preinstall, I figured it would renumber /cache as mmcblk0p1, but it didn't... it stayed mmcblk0p2.... which is a good surprise, cause now I don't have to adjust the mount points for /cache anywhere else.

I am going to test the phone a bit today before I release the kernel I made and the instructions for completely removing /preinstall.
Waiting anxiously for this Knight!
 

·
Registered
Joined
·
91 Posts
Has there been any work done on the CWM install zip? Or can KC at least release his kernel? I'd rather not have to do things manually and I'd rather not have the preinstall partition at all.
 

·
Android Beginner
Joined
·
95 Posts
I am not sure if I can do it via a cwm script, since some of the commands are done while in gparted and I am not sure how to script that.

As for the kernel, I can get that to you when I re-install my VM tonight. (I mean, if I really did compile it... since I've been accused of stealing the kernel and making it all up... lol)

As long as you make the dd backup as stated in the OP, if you mess up you can return it back to normal. :)
 
1 - 9 of 9 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top