READ THIS FIRST: i wrote a script that automagically partitions the sdcard. get it here.
if you still want to partition manually, read on.
i did this with a BLANK 8gb card and a fresh rom install, so i had no data to lose..be careful. i take no responsibility for what happens to your phone, sdcard, data, sanity, etc if you follow these instructions. remember to backup your sdcard to your pc before you begin.
technically, you don't need adb for this, as you can partition your card in the recovery console on the g1(...not the terminal app) using the commands in this post. however, once you wipe your sdcard, you may want some way of getting a new rom onto the phone. ;p
these instructions apply to both, the windows command prompt and the mac terminal.
just about any size and/or class of sdcard will work, but you will want to use a class 6 cause it's wicked fast. 16gb transcend sdcards seem to be giving some people trouble and throwing "ERROR: input/output error during write on /dev/block/mmcblk0" when trying to partition. use them at your own peril.
the example in this thread is for MY sdcard...YOUR sdcard will be different and the partition sizes may vary. apply ur information(sdcard size, partition size) when appropriate. following the instructions in this post will erase ALL DATA on the sdcard before creating new partitions.
read the ENTIRE post VERY carefully BEFORE proceeding or asking questions...
note #1: all typed commands are in bold. adb/console commands in black. windows prompt commands in green.
note #2: if all else fails...remove all partitions and create new. this seems to solve 99.9% of non-hardware related problems.
note #3: if note #2 fails...try 'mklabel msdos'. see below for more info.
note to ext3/ext4 fs users: parted does NOT support CREATING ext3/ext4 partitions..you MUST create with ext2 and upgrade. also, parted CAN RESIZE ext3 partitions, but with restrictions. check out the table on the features page, of their website. i will NOT go into resizing partitions in this post as there are many variations...
need to backup your ext partition?
note: these backup commands must be run while phone is booted, not recovery.
to backup your ext partition to your current directory: adb pull /system/sd/ %CD%\sdbackup
to restore back to sdcard: adb push %CD%\sdbackup /system/sd
having issues? please post the following when asking for help:
output from the following commands
parted /dev/block/mmcblk0 print
parted /dev/block/mmcblk0 check 1, if any.
parted /dev/block/mmcblk0 check 2, if any.
parted /dev/block/mmcblk0 check 3, if any.
what rom are you using?
what brand/size/class sdcard?
can you see fat32 partition on the phone? ie. through andExplorer or similar..
g1 with cm-recovery-1.4
sdcard <--class 6 recommended(adata makes good ones...they max out the g1 hw in terms of speed)
rooted rom with ext3/4 support & swap capability <--recommend CyanogenMod
fingas(or toes if you're this guy)
part i - prepare the sdcard:
boot your g1 into recovery (using home + power)
drop to console (alt + x)
open windows command prompt and enter:
now at the # prompt enter:
you are now in parted...hopefully. if not, check your typing, start over, do more research, or give up.
to find out the size of your sdcard & the partitions that it contains, enter:
you may receive a message from the program:the error says it all.. ;PCode:"No Implementation: Partition 1 isn't aligned to cylinder boundaries. This is still unsupported."
not sure what this means exactly(besides our partitions being out of alignment), but it is not good for our purposes.
also, if your "Partition Table" is reported as being "loop", i suggest repairing with the following procedure as well since it seems to be causing some problems too.
to fix, type:
it may give you some guff about:
answer y to the 'yes/no'..Code:Warning: The existing disk label on /dev/block/mmcblk0 will be destroyed and all data on this disk will be lost. Do you want to continue? parted: invalid token: msdos
confirm with: msdosCode:New disk label type?
you should get something like:
or, if your sdcard is new/empty you'll get:Code:print print Model: Unknown (unknown) Disk /dev/block/mmcblk0: 7969MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 512B 7469MB 7469MB primary fat32 lba 2 7469MB 7969MB 500MB primary ext2
if no numbered partitions come up, move onto next step. if not, delete ALL partitions that you see with the rm command. it has the format: rm <partition number>.Code:print print Model: Unknown (unknown) Disk /dev/block/mmcblk0: 7969MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags
in this case:
the fourth line in the 'print' command output shows you the total size of sdcard in MB(or GB if you card is large)..mine says: Disk /dev/block/mmcblk0: 7969MB
use this number(XXXXMB) and do some simple math to get the size of your partitions.
7969MB - 32MB linux-swap = 7937MB32MB seems to be alright size for swap, though it can be lower depending on your sdcard size.
7937MB - 500MB ext2 = 7437MB fat32
500 MB is a good round number for the ext2 partition...no need for more.
that leaves us with 7437MB for fat32 storage.
part ii - create partitions:
for a2sd & swap to work properly, partitions MUST be created in this order: fat32, ext2, linux-swap
the command to create partitions is mkpartfs...command format is:
mkpartfs <partition type> <fs type> <start> <end>
note#1: the <start>/<end> numbers in the following section correspond to the italicized numbers above. your partition information will most likely be different.
note#2: by default parted assumes ur using MB as the units in commands. say you have a card that is LARGE(like 16GB) and want a partition of 12GB...all you do is use the proper units(ie. mkpartfs primary fat32 0 12GB) and parted will oblige. you can use decimals as well...if you want a similar setup to my calculations above, you would have a fat32 partition of 15.4GB(ie. mkpartfs primary fat32 0 15.4GB), 500MB ext2, and 32MB swap
now we create the partitions:
mkpartfs primary fat32 0 7437
mkpartfs primary ext2 7437 7937
mkpartfs primary linux-swap 7937 7969
to check out our handy work, enter:
output should be similar to:
to exit parted type:Code:print print Model: Unknown (unknown) Disk /dev/block/mmcblk0: 7969MB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 512B 7437MB 7437MB primary fat32 lba 2 7437MB 7937MB 500MB primary ext2 3 7937MB 7969MB 32.2MB primary linux-swap(v1)
after quitting you may receive a message containing:
no need to worry. fyi, fstab is a file that keeps track of disks & partitions in *nix. more info on fstab can be found here.Code:Information: You may need to update /etc/fstab.
part iii - convert ext2 to ext3/ext4:
parted will not create ext3/ext4 partitions...see beginning of post
to upgrade, enter:
you now have journaling(aka ext3)! if ext3 is all you want, skip next two commands.
you want ext4?
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
e2fsck -fpDC0 /dev/block/mmcblk0p2
part iv - copy rom to sdcard and install, enable swap:
open another win cmd prompt, enter:#####
adb shell mount /sdcard
adb push /update-path/update.zip /sdcard
in original cmd prompt, enter:
wipe data (alt + w) <--this one is optional, but i like fresh installs
install rom (alt + s)
to enable swap, see this page.
note: you do not need to enable swap if your rom does it automagically.
all told, i end up with:
cyanogen-v22.214.171.124 running faster than ever!
hope this wasn't too painful.
btw, you could use a live cd, but i think this is easier and maybe a little more fun!