This guide is is for users with rooted Android phones. There are many ways to partition your phone SD card and I would like to share the one that works perfectly.
I would like to thank Androidandme for this guide
Requirements before getting started:
* Cyanogen Recovery Image v1.4 or greater.
* 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. 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.
All commands you need to type are in bold. 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)
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)
Other Android Hacking Guides:
Root T Mobile G1 or myTouch 3G
Install .apk Files on your Android phone