[myTouch 4G Q&A, Help & Troubleshooting] neidlinger:
taken from

Here

How to manually partition your SD card for Android Apps2SD

Taylor Wimberly on Aug 21, 2009 at 9:27 pm119 comments

5share0share4 42

How to manually partition your SD card for Android Apps2SD

Update: You might also want to check out the Amon_RA recovery image which will automatically partition your SD card.

This article is for people with rooted Android phones. Everyone else please ignore. There are dozens of ways to partition your SD card and I would like to share the one that has worked for me every time. I prefer to manually partition my SD card because it gives me complete control.

Requirements before getting started:

Cyanogen Recovery Image v1.4 or greater (Easy to install with the 1-click hack)

SD Card (Class 6 suggested): A-DATA has good prices on Amazon (4GB, 8GB, 16GB)

Android Device Bridge(ADB): Comes with the Android SDK.

Android build that supports Apps2SD: I suggest Cyanogen’s latest stable release (Does Apps2SD automatically)

These instructions apply to both the Windows command prompt and the Mac terminal. As you can see from my screens, I was using Windows Vista. You can partition your SD card at any time, but you might as well do it before you flash a new build of Android. As always, back up your data when performing any hacks. Partitioning your SD card will erase all data on it. I split this guide into 9 steps, but it is not as difficult as it looks. Read the whole thing before starting.

All commands you need to type are in bold (my comments are in parenthesis). If you do not know how to use ADB, leave a comment for help or read ADB for Dummies over at XDA.

Step 1: Connect your phone to your computer via USB. Reboot into recovery mode.

Command:

adb shell reboot recovery

(this will reboot your phone into Cyanogen’s recovery image. Or power on phone when holding home button)

Command:

adb shell

(type this after your phone has booted and on the recovery screen. it should take you to a # prompt)

Step 2: Open parted to partition your SD card.

Command:

parted /dev/block/mmcblk0

(opens parted and mounts your SD card)

Step 3: Check the size and partitions of your SD card. The print command will display this info. You can see the size of my SD card is 7969 MB (8 GB). I have 1 partition which is fat32. If your SD card is blank and no partitions are listed, you can skip to Step 5.

Command:

print

(displays SD card information)

Step 4: Remove all existing partitions. If you have multiple partitions, remove each one at a time.

Command:

rm 1

(deletes partition number 1)

Command:

rm 2

(if needed. keep going till all partitions are removed)

Command:

print

(check when you are done to make sure all partitions are removed)

Step 5: Create your new partitions. You can make these any size, but the most common setup is 32 MB linux-swap partition, 512 MB ext2 partition, and remaining free space as a fat32 partition. In order to work properly, the partitions must be created in this order: fat32, ext2, linux-swap.

The linux-swap partition is used for a swap file on some builds. Not all builds use linux-swap, but I create one just in case I ever need it.

The ext2 partition is where your apps will be installed. I use 512 MB which gives me plenty of room but you can go larger like 1024 MB if you want. Parted only creates ext2 partitions and we can convert them to ext3 or ext4 later.

When using the Linux command mkpartfs, you must tell it where to start and and end each partition. This can be done by taking the total SD card size and subtracting the linux-swap then ext2 partition sizes. See the following example for my 8 GB card.

Command:

mkpartfs primary fat32 0 7425

(start is 0 and end is Total C)

Command:

mkpartfs primary ext2 7425 7937

(start is Total C and end is Total B)

Command:

mkpartfs primary linux-swap 7937 7969

(start is Total B and end is Total A)

Partition sizes for a 8 GB SD card.

Partition sizes for a 8 GB SD card.

Step 6: Check the sizes of your partitions. Use the command print again to display the partition sizes. If you made any mistakes you can return to Step 4 and remove them.

command:

print

(displays your partition information)

Step 7: Exit parted and upgrade your ext2 file system to ext3. For most users this is the final step. We suggest all users upgrade to ext3. Its main advantage over ext2 is journaling which improves reliability and eliminates the need to check the file system after an unclean shutdown.

command:

quit

(exit parted and return to # prompt)

command:

upgrade_fs

(script to upgrade from ext2 to ext3)

Step 8 (Optional): If you wish, you can upgrade your ext3 partition to ext4. Skip to Step 9 is you wish to use ext3. I asked Cyanogen what file system he uses and he tweeted ext4. The file system offers enhancements like delayed allocation. See Wikipedia for more info on ext4.

command:

tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2

(enter this command from the # prompt)

command:

e2fsck -fpDC0 /dev/block/mmcblk0p2

(run e2fsck after tune2fs. wait for the file check to finish)

Step 9: Finished. Check your work with print.

command:

parted /dev/block/mmcblk0

(open parted again)

command:

print

(check all your system partitions and their sizes)

command:

quit

(exit parted)

command:

reboot

(reboot your system to the operating system)