Remove All Ads from XDA

need help with partitioning (SDK ADB TOOLS) trying to get internal to 5GB

21 posts
Thanks Meter: 6
By RyanFabbro, Junior Member on 21st October 2011, 11:10 PM
Post Reply Email Thread
ok so ive been messing with the partitions of the phone for a little while messing things up quite a bit (supprized i havent bricked yet lol)

so the screen shot is the default way the partitions are set.

i've tried deleting partition 2 & 3 using
rm 2
rm 3
then i try to make the partitions like

mkpartfs primary ext4 538 5638 userdata
mkpartfs primary fat32 5638 15.9GB media
i get errors and then my storage isnt accessable so i re root with one click and try agian.

what im trying to do is make internal storage around 5GBs

can anyone help me out with this?

it has to be possible i've read that the whole 16gbs of the phone is all the same chip so it has to be possible to partition it differentlly and i think #1 is the like were CWM is so i dont want to risk deleting that partition without knowing exactally what im doing.

any help would be appreciated

links tips anything

Attached Thumbnails
Click image for larger version

Name:	Capture.jpg
Views:	1608
Size:	35.5 KB
ID:	757054  
22nd October 2011, 12:31 AM |#2  
Senior Member
Flag Amsterdam
Thanks Meter: 56
I don't know if it's possible but it would be really interesting if it would.

I'm having issues replicating your situation which makes it hard to help you profoundly, which errors are you getting?

And, wouldn't it be better to use mkpart instead of mkpartfs?

The Following User Says Thank You to frutelaken For This Useful Post: [ View ] Gift frutelaken Ad-Free
22nd October 2011, 01:23 AM |#3  
OP Junior Member
Thanks Meter: 6
well im new to SDK and tools like this is the first thing ive tried with it im not familliar with all the commands and stuff. but im about to mess with some more stuff and ill try your suggestion

i may be new to android but im not new to computers, i learn quickly and this is the first thing i need to get going before i move forward

were can i get commands and stuff for trying this

facts i know -

the whole 16 gb's of the phones memory is 1 chip, partitioned (by default into 3 partitions)
though not specifically specified -
1. system (i assume recovery and stuff thats not safe to mess with)
2. internal memory (app contacts ect..)
3. external memory (sd card)

since its all one 16gb chip it is possible to re-partition it IE
without messing with option 1

say combine 2 & 3 or make 2 (internal) bigger and 3 (sdcard) smaller

i just need to learn the proper commands and once i have figured this out i will share

the reason i want this -

being able to have say 5 gbs of internal storage, will ensure i will never run out of space for apps games and what not that leave aprox. 10 gbs left for sd card
wich is MORE then enough for my music pictures docs and whatnot

and thus doing this i wouldnt have to move apps to sd with say apps 2 sd or anything and it would leave my external storage cleaner not putting a bunch of misc folders on it

this is getting pretty long so ill wrap it up for now
22nd October 2011, 01:54 AM |#4  
OP Junior Member
Thanks Meter: 6
these are the only 2 things remotely close to what im trying to do


in simple easy to understand terms what im trying to accomplish is
(refer to pic in 1st post)
1. delete 2 and 3
2. remake 2 so its along the lines of
2   538MB  5868MB  ????MB  ext4           userdata
3. and 3 like...
3   5868MB  15.9GB   10??GB    fat32      media
so i need to delete ext4 userdata and fat32 media and re create them with my own defined storage

abd messed up with the sdk update so im done for the night hurting my head trying to get this working so ill be back on it tomorrow, please any help or refrence would be appreciated
22nd October 2011, 03:38 AM |#5  
Senior Member
Flag Amsterdam
Thanks Meter: 56
Alright so after a few hours of trying I managed to resize all the partitions using Parted. However, it seems that either Android is recreating the partitions or that the internal memory values aren't being read correctly in Android itself.

Know that the first partition contains your system files (ROM, kernel). The second partitions is the /data folder which is basically what is removed when you do a factory reset.

The parted output (after several commando's) is the following (PS: I would've resized my pictures if it wasn't 5AM, sorry):

Unfortunately my Android shows this:

And after a reboot, parted does this:

So now basically I'm not sure if my internal memory has been altered to 2GB and that the Android readings are wrong, or that Android has a safe mechanism and reverts these changes after reboot. Someone with more insight needs to answer that question. I'm leaning towards the latter, unfortunately. Maybe there's a flag somewhere that has be changed (if it were that simple).

Tips to you; make sure you are in your recovery mode when using parted, otherwise you won't be able to access the partitions.

Use (in parted)

resize 3 2612MB 15.9GB - to resize your third partition and shrink it with 1GB
rm 2 - to remove secondary partition (parted can't access ext4)
mkpartfs 2 primary ext2 538 2612 - to make the secondary partition (= internal memory?) 2GB.

Then quit parted and upgrade your ext2 to ext3 and then ext4.

ext2 - ext3:

tune2fs -j /dev/block/mmcblk0p2
ext3 - ext4
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p2
e2fsck -fpDC0 /dev/block/mmcblk0p2
Check parted again and you'll see your updated info... until the next reboot.

Anyone else willing to share some knowledge?

The Following User Says Thank You to frutelaken For This Useful Post: [ View ] Gift frutelaken Ad-Free
22nd October 2011, 03:57 AM |#6  
simms22's Avatar
Recognized Contributor - R.I.P
Thanks Meter: 26,916
maybe this will help you figure it out..
its a post i made on 2years and 3 months ago for partitioning an sd card, in the G1, through the recovery(there was a terminal included in the recovery then) of the phone. maybe itll help you put this puzzle together with some hints. good luck!
The Following User Says Thank You to simms22 For This Useful Post: [ View ] Gift simms22 Ad-Free
22nd October 2011, 06:40 PM |#7  
OP Junior Member
Thanks Meter: 6
well its progress, atleast were getting somewere. i have a few things to do firste then i have to get my adb working agian and ill get right back on this,

so you were able to resize it but theres a safty precaution prenting it from applying upon reset? hmm ok ill check that out ill do your method above just give me a little while to get around to it.

oh and should i boot into ubuntu doing this? or is windows ok?
22nd October 2011, 07:10 PM |#8  
Senior Member
Flag Amsterdam
Thanks Meter: 56
You can continue using Windows. If you run "adb shell", adb 'connects' to the shell of your device anyway (which is Linux-based).

If your adb isn't working, make sure you're not in the bootloader menu because that's fastboot. Being in the recovery is the ideal environment to mess around with your phone.

Maybe the fat32 partition (sdcard) has to be removed as well, I just resized it because I figured that since it exists already, it shouldn't be deleted.

Good luck and keep me/us updated

22nd October 2011, 08:15 PM |#9  
Senior Member
Flag Amsterdam
Thanks Meter: 56
Alright a small addition;

Unfortunately I need my phone tonight and tomorrow so I can't mess around with it, so I'll leave you some things to look at and maybe they can help us further.

I've been digging through the filesystem and found partition specification files in /sys/block/mmcblk0/ and sys/devices/mmcblk0. It are directories that contain the classification of devices.

I pulled them to take a closer look and what I found was rather interesting.

It contains 3 folders, one for each partition. Inside those folders are the specifications for the partition. Let me tell you that I'm not sure how Android treats these files (ergo; are they static and loaded on reboot, causing the revert of the partitions - or dynamic and created somehow else).

Here's a quick rundown of the files, I'll use mmcblk0p2 because that's the internal memory, same logic applies to mmcblk0p1 and 3:

-r--r--r--    1 root     root          4096 Oct 22 18:52 alignment_offset
-r--r--r--    1 root     root          4096 Oct 22 18:52 dev
-r--r--r--    1 root     root          4096 Oct 22 18:52 discard_alignment
drwxr-xr-x    2 root     root             0 Oct 22 18:52 holders
-r--r--r--    1 root     root          4096 Oct 22 18:52 inflight
-r--r--r--    1 root     root          4096 Oct 22 18:52 partition
-r--r--r--    1 root     root          4096 Oct 22 18:52 partition_name
drwxr-xr-x    2 root     root             0 Oct 22 18:52 power
-r--r--r--    1 root     root          4096 Oct 22 18:52 size
-r--r--r--    1 root     root          4096 Oct 22 18:52 start
-r--r--r--    1 root     root          4096 Oct 22 18:52 stat
lrwxrwxrwx    1 root     root             0 Oct 22 18:52 subsystem -> ../../../../../../../../../class/block
-rw-r--r--    1 root     root          4096 Oct 22 18:52 uevent
There's a start and size file. The size file contents are:


2097152 is equal to 1GB, it is the sector size. Multiplying this value by 2 would set the size to 2GB.

If that is done, I would assume that the value mmcblk0p3/start has to be shifted by 2097152 and the size reduced by 2097152, if that makes sense to you.

There's also a weird symlink to a subsystem, /class/block, of which I can list and cat its contents but I have no idea how to access it properly, can't cp it either. Looks like Android protects this area somehow. Basically it contains copies (or originals?!!) of the files in /sys/block.

I know that in the Linux kernel all three classification directories (sys/block, sys/class, sys/bus) are merged into one place at /sys/subsystem, following the layout of the bus directories. All buses and classes, including the converted block subsystem, will show up there. But unfortunately my knowledge of the Android kernel is far too limited to know what exactly is going on.

So maybe changing the contents of all these files and then using parted to partition the partitions, making them exactly the same as the values that these files imply, could make the changes the the internal memory stick.

Once again, if anyone has another idea, please let us know.

25th October 2011, 05:40 AM |#10  
OP Junior Member
Thanks Meter: 6
well ive done alot of messing around to no avail anyone have any useful info on this matter?
25th October 2011, 06:25 AM |#11  
dpeeps74's Avatar
Senior Member
Flag Austin
Thanks Meter: 196
On the Hero we would use firerat mod. It required a change to recovery for it to work as well as a change to the boot partition. I'm not sure what phone it was developed under but there should be a thread/link in the hero cdma section. Not sure if it will help, but it's purpose was to allocate cache to system for the same purpose on phones without much internal storage.

Sent from my Nexus S 4G
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes