[MOD][EMMC][I9070/P][8/16GB] Internal Memory Repartition

Search This thread

AntaresOne

Recognized Developer
Sep 30, 2013
2,161
17,509
30
Chieti, Italy
www.antaresone.eu
Internal Memory Repartition


Hey guys, after a very long time I show you the way to repartition your internal memory (EMMC).

You can modify partitions as you want, increase data partition to install more apps, increase internal storage for media files...

It's based on a little Linux binary called Parted, it's a part of CWM/TWRP recovery ramdisk.

This means that you can repartition in any recovery of any 4.2/4.3/4.4 ROM.



==========WARNING==========

Operations on EMMC partitions could be EXTREMELY DANGEROUS if you don't understand well what you do.

If you touch wrong partitions (CSPSA, EFS, SBLs...) you can lose your IMEI or hardbrick your device (in this case only JTAG can save you) so...

READ CAREFULLY!!!!!

Responsibility is all yours, but if you follow well this guide you will not risk anything.

Stock partition table is designed to be used in stock ROM, since it uses preload partition to store some system apps and needs bigger system (ROM is heavier than CM-based ones) and bigger cache partitions (more system apps=more dalvik-cache).

This mod is compatible with any ROM except stock and stock-based.


This is the stock partition table:

4vlg14.png


You can touch ONLY:
Kernel2
SYSTEM
DATAFS
CACHEFS
HIDDEN
FOTA
UMS

Kernel2 is the backup of stock kernel, we don't need it.

SYSTEM is the /system partition (where the ROM is installed/stored).

DATAFS is /data partition (default 1.97 GB where are stored installed apps, Android settings, contacts, messages... User data).

CACHEFS is /cache partition (art/dalvik-cache is stored here, together with recovery logs/temporary files. In stock ROM here is stored also CSC. If you repartition to the minimum (at least 5 MB needed for recovery) you need to put dalvik.vm.dexopt.data-only=1 flag in system/build.prop

HIDDEN is /preload partition (some Samsung TouchWiz system apps are stored here and symlinked with /system/app. This is a swap partition on MIUI v5, CM10.2 and all CM11/Omni 4.4 builds (these 4.4 before 15 June), also every custom ROM based on Canjica device tree 4.3/4.4 (always before 15 June), resize it to the minimum (128 KB to format it as EXT2).

FOTA is Firmware Over The Air, so is needed to get OTA updates while on stock ROM, can be directly deleted.

UMS is the internal storage (3.96 GB one), you can repartition this to have less/more space, or repartition to the minimum (8 MB or less, you will need to swap internal/external storages).

Parted commands useful for us:

rm (to delete a partition)
mkpart primary (to make a partition)
format (to format a partition, only in ext2)
name (to rename a partition)

For an extended list/explanation of commands, type "help" without quotes


Let's go!

First make a nandroid backup of your current ROM, to be restored after repartition

If you touch UMS you will lose all the content of /sdcard (internal storage), so make a backup first!


You need a Linux distro or Windows with ADB configured.

Reboot device in recovery and connect to USB, then open ADB and write:

Code:
adb shell
parted /dev/block/mmcblk0

You can choose to display partitions as Gigabytes, Megabytes, Kilobytes (suggested), or Bytes by "unit **" command, where ** can be gb/mb/kb or b

Now type "print" to display partition table.

Parted create new partitions by following "Number", for example SYSTEM is 3, CACHEFS is 4 and DATAFS is 5 (for other partitions is the same), so when you create new partitions, you need to make them in order!! For example:

SYSTEM is 3 and its size is from 105906KB to 747635KB

CACHEFS is 4 and its size is from 2895118KB to 3215983KB

DATAFS is 5 and its size is from 747635KB to 2895118KB

The "end" of a partition is the "start" of the next partition

As you can see, DATAFS is between SYSTEM and CACHEFS. This means that after you create SYSTEM, you need to calculate new DATAFS size that you want and then first create CACHEFS (at the end of calculated DATAFS size) then create DATAFS from the end of SYSTEM to the start of CACHEFS.

To understand more:

We will resize now CACHEFS from 320864 KB to 5000 KB gaining 315864 KB for DATAFS:

Unmount /cache from recovery first!

Code:
rm 4 (to delete CACHEFS)

rm 5 (to delete DATAFS)

calculate now the new size of DATAFS, in this case add 315864 KB to DATAFS end: 2895118+315864=3210982 KB

calculate now the new end of CACHEFS, in this case add 5000 KB to 3210982 KB: 3210982+5000=3260982 KB

mkpart primary 3210982 (end of DATAFS and start of CACHEFS) 3260982 (end of CACHEFS, start of the next partition)
Now we made a new partition, its number is 4. Do: name 4 CACHEFS

It's time to make new DATAFS partition: from the end of SYSTEM to the start of CACHEFS
mkpart primary  747635 (end of SYSTEM and start of DATAFS) 3210982 (end of DATAFS and start of CACHEFS)
New partition has number 5, name it DATAFS by name 5 DATAFS

Basically the method is this, you can apply it to partitions listed above.

Remember to reboot recovery, go in Mounts and storage then (depending on what partitions you touched in Parted, excluding /preload) do the appropriate formats after repartition. Now you're ready to restore your nandroid backup (needs to have less size than new partitions) or install a ROM.

I suggest an useful program to check partition size on Android, Partition Table

If you touch HIDDEN partition and you are on 4.2 ROM or 4.4 builds after 15 June:

Code:
format
y
9
ext2

If you repartition UMS to the minimum, you will need to swap internal and external storages (MicroSD card will be the new internal storage):

On 4.2 open system/etc/vold.fstab and replace the content with this:
Code:
# MicroSD as internal storage
dev_mount sdcard0 /storage/sdcard0 auto /devices/sdi0/mmc_host/mmc1/mmc1

# UMS as external storage
dev_mount sdcard1 /storage/sdcard1 8 /devices/sdi2/mmc_host/mmc0/mmc0 nonremovable,encryptable

# usbdisk
dev_mount usbdisk0 /storage/usbdisk0 auto /devices/platform/msm_hsusb_host.0

On 4.3 ROMs open system/build.prop and add these lines at the end of the file:
Code:
persist.sys.vold.switchexternal=1
ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1

On 4.4 ROMs just open NovaThor Settings and enable "Swap Storages"

To restore original partition table flash stock ROM through Odin with "Repartition" enabled and correct PIT file for your model, in attachment (extract zip), soon CHN pits too

I know that it's difficult to understand well the first times, but think at me that I developed this method, a lot of testing and bricks on bricks :D

If you found this useful, you can support me at least by pressing "Thanks" or considering to offer me a beer, a coffee... Any kind of support will be very appreciated :cool:
 

Attachments

  • GT-I9070_EUR_XX_8G.zip
    1 KB · Views: 1,265
  • GT-I9070_EUR_XX_16G.zip
    1 KB · Views: 774
  • GT-I9070P_EUR_XX_8G.zip
    1 KB · Views: 342
  • GT-I9070P_EUR_XX_16G.zip
    1 KB · Views: 268
Last edited:

tasosf

Senior Member
Jul 10, 2010
61
9
So, I want to shrink UMS (let's say by 1GB) and use it in DATAFS.
What would be the command sequence?

Thank you,
Tasos
 
  • Like
Reactions: #Henkate

AntaresOne

Recognized Developer
Sep 30, 2013
2,161
17,509
30
Chieti, Italy
www.antaresone.eu
So, I want to shrink UMS (let's say by 1GB) and use it in DATAFS.
What would be the command sequence?

Thank you,
Tasos

All what you should know it's wrote in the OP.

You can make our way... rm anything after Kernel2, calculate datafs+1024MB more and make again all partitions, name and format them. Read again and well the OP for clarifications, it's all wrote there

Inviato dal mio GT-I9505
 
  • Like
Reactions: Toni5830

tasosf

Senior Member
Jul 10, 2010
61
9
Command "format" didnt work for me
Instead i used "mkfs <number> ext2" (however it asks about number and filesystem later) and i think "mkpartfs primary ext2 <start> <end>" could be the easiest as it create partition and format it in the same moment so its not needed to remember later

Format didn't work for me either. I formatted everything through TWRP to ext4.
So, this method works! I now have 3GB for data so to have all the apps installed in the internal storage and not the internal sd card (ums). This way all apps are faster because ums is formatted as fat 32 in order to be recognised on Windows.
One tricky thing was that you have to mkpart from low numbers to high, regardless if you leave for a moment organ intermediate megabytes. The system always gives the next available number to the partition you make. It may not make sense how I try to explain it, but keep it in mind when you try it.

Sent from my GT-I9070 using XDA Free mobile app
 
I do exactly opposite thing as made smaller DATAFS, SYSTEM and CACHEFS to have bigger UMS. Its googd that Kernel2, HIDDEN and Fota are after "more" important partitions, so we can get rid of them and get lot of space
The system always gives the next available number to the partition you make. It may not make sense how I try to explain it, but keep it in mind when you try it.
Yep, its important to not make mistakes, coz who wants to do something few times?
 

tasosf

Senior Member
Jul 10, 2010
61
9
I do exactly opposite thing as made smaller DATAFS, SYSTEM and CACHEFS to have bigger UMS. Its googd that Kernel2, HIDDEN and Fota are after "more" important partitions, so we can get rid of them and get lot of space

How come you want to have bigger UMS? Not all apps can be installed there and DATAFS gets full very easily. Also, it's fat32 which creates some problems by itself.


Sent from my GT-I9070 using XDA Free mobile app
 

TheSteve87

Senior Member
Mar 14, 2014
110
24
i'd really like to repartition my phone's memory but i fear i'm gonna screw everything up :D

i see a coming soon "pit zone" in the second post, does that mean that there is an automatic way to repartition the internal memory without directly using commands?
 

AntaresOne

Recognized Developer
Sep 30, 2013
2,161
17,509
30
Chieti, Italy
www.antaresone.eu
You need to use "format" command in ext2 only for HIDDEN partition that it's unneeded on custom ROMs.

For other partitions (SYSTEM, CACHEFS, DATAFS) format through recovery mode (automatically formatted in ext4), and for UMS through Android.

Yes, the PIT zone will have PIT files ready to be flashed to autorepartition along with a kernel that brings you CWM recovery to install/restore your ROM after repartition.

Inviato dal mio GT-I9505
 
  • Like
Reactions: TheSteve87

TheSteve87

Senior Member
Mar 14, 2014
110
24
You need to use "format" command in ext2 only for HIDDEN partition that it's unneeded on custom ROMs.

For other partitions (SYSTEM, CACHEFS, DATAFS) format through recovery mode (automatically formatted in ext4), and for UMS through Android.

Yes, the PIT zone will have PIT files ready to be flashed to autorepartition along with a kernel that brings you CWM recovery to install/restore your ROM after repartition.

Inviato dal mio GT-I9505

i will definitely wait for the pit files then :D all i'm looking for is to get rid of those useless partitions like FOTA, Kernel2 etc. just to have more space on the internal memory for apps
 

anil.xda

Member
May 17, 2013
22
3
A complicated by well explained method for partition........But i am a bit afraid to use .... Can u help out with the step for my issue...?

My Phone: S Advance
(Rooted with the help of http://xdaforums.com/showthread.php?t=2087424)
RAM= 768 MB RAM,
ROM= 2 GB //*Note phone shows this as device storage, Pl correct if I am wrong*//
Internal=16 GB (user available=11.31 GB), //*Note phone shows this as USB storage, Pl correct if I am wrong*//
external micro SD card = Nil

I want to increase the RAM Or ROM so that my mobile should not lags/hangs

I feel that mobile is slow mainly due to less RAM......pl correct if I am wrong

I want to use the the 1GB/2GB/3GB/4GB out of Internal 16 GB to increase the size of ROM from 2GB to 3GB/4GB or RAM from 768 MB to 1GB/2GB/3GB/4GB more.....

Pl help me out with the specific steps.....

Thanks a lot @AntaresOne
 

Sami Kabir

Senior Member
Oct 3, 2012
2,233
1,410
@anil.xda

Yes, just 768 MB of RAM is one of the biggest performance limiting factors of this phone but sadly you can't just "increase it". You'll have to use something like a zRAM or a SWAP script. But this is just a workaround - and it too has some drawbacks I think.

Sent from my GT-I9070
 
  • Like
Reactions: anil.xda

Top Liked Posts

  • There are no posts matching your filters.
  • 33
    Internal Memory Repartition


    Hey guys, after a very long time I show you the way to repartition your internal memory (EMMC).

    You can modify partitions as you want, increase data partition to install more apps, increase internal storage for media files...

    It's based on a little Linux binary called Parted, it's a part of CWM/TWRP recovery ramdisk.

    This means that you can repartition in any recovery of any 4.2/4.3/4.4 ROM.



    ==========WARNING==========

    Operations on EMMC partitions could be EXTREMELY DANGEROUS if you don't understand well what you do.

    If you touch wrong partitions (CSPSA, EFS, SBLs...) you can lose your IMEI or hardbrick your device (in this case only JTAG can save you) so...

    READ CAREFULLY!!!!!

    Responsibility is all yours, but if you follow well this guide you will not risk anything.

    Stock partition table is designed to be used in stock ROM, since it uses preload partition to store some system apps and needs bigger system (ROM is heavier than CM-based ones) and bigger cache partitions (more system apps=more dalvik-cache).

    This mod is compatible with any ROM except stock and stock-based.


    This is the stock partition table:

    4vlg14.png


    You can touch ONLY:
    Kernel2
    SYSTEM
    DATAFS
    CACHEFS
    HIDDEN
    FOTA
    UMS

    Kernel2 is the backup of stock kernel, we don't need it.

    SYSTEM is the /system partition (where the ROM is installed/stored).

    DATAFS is /data partition (default 1.97 GB where are stored installed apps, Android settings, contacts, messages... User data).

    CACHEFS is /cache partition (art/dalvik-cache is stored here, together with recovery logs/temporary files. In stock ROM here is stored also CSC. If you repartition to the minimum (at least 5 MB needed for recovery) you need to put dalvik.vm.dexopt.data-only=1 flag in system/build.prop

    HIDDEN is /preload partition (some Samsung TouchWiz system apps are stored here and symlinked with /system/app. This is a swap partition on MIUI v5, CM10.2 and all CM11/Omni 4.4 builds (these 4.4 before 15 June), also every custom ROM based on Canjica device tree 4.3/4.4 (always before 15 June), resize it to the minimum (128 KB to format it as EXT2).

    FOTA is Firmware Over The Air, so is needed to get OTA updates while on stock ROM, can be directly deleted.

    UMS is the internal storage (3.96 GB one), you can repartition this to have less/more space, or repartition to the minimum (8 MB or less, you will need to swap internal/external storages).

    Parted commands useful for us:

    rm (to delete a partition)
    mkpart primary (to make a partition)
    format (to format a partition, only in ext2)
    name (to rename a partition)

    For an extended list/explanation of commands, type "help" without quotes


    Let's go!

    First make a nandroid backup of your current ROM, to be restored after repartition

    If you touch UMS you will lose all the content of /sdcard (internal storage), so make a backup first!


    You need a Linux distro or Windows with ADB configured.

    Reboot device in recovery and connect to USB, then open ADB and write:

    Code:
    adb shell
    parted /dev/block/mmcblk0

    You can choose to display partitions as Gigabytes, Megabytes, Kilobytes (suggested), or Bytes by "unit **" command, where ** can be gb/mb/kb or b

    Now type "print" to display partition table.

    Parted create new partitions by following "Number", for example SYSTEM is 3, CACHEFS is 4 and DATAFS is 5 (for other partitions is the same), so when you create new partitions, you need to make them in order!! For example:

    SYSTEM is 3 and its size is from 105906KB to 747635KB

    CACHEFS is 4 and its size is from 2895118KB to 3215983KB

    DATAFS is 5 and its size is from 747635KB to 2895118KB

    The "end" of a partition is the "start" of the next partition

    As you can see, DATAFS is between SYSTEM and CACHEFS. This means that after you create SYSTEM, you need to calculate new DATAFS size that you want and then first create CACHEFS (at the end of calculated DATAFS size) then create DATAFS from the end of SYSTEM to the start of CACHEFS.

    To understand more:

    We will resize now CACHEFS from 320864 KB to 5000 KB gaining 315864 KB for DATAFS:

    Unmount /cache from recovery first!

    Code:
    rm 4 (to delete CACHEFS)
    
    rm 5 (to delete DATAFS)
    
    calculate now the new size of DATAFS, in this case add 315864 KB to DATAFS end: 2895118+315864=3210982 KB
    
    calculate now the new end of CACHEFS, in this case add 5000 KB to 3210982 KB: 3210982+5000=3260982 KB
    
    mkpart primary 3210982 (end of DATAFS and start of CACHEFS) 3260982 (end of CACHEFS, start of the next partition)
    Now we made a new partition, its number is 4. Do: name 4 CACHEFS
    
    It's time to make new DATAFS partition: from the end of SYSTEM to the start of CACHEFS
    mkpart primary  747635 (end of SYSTEM and start of DATAFS) 3210982 (end of DATAFS and start of CACHEFS)
    New partition has number 5, name it DATAFS by name 5 DATAFS

    Basically the method is this, you can apply it to partitions listed above.

    Remember to reboot recovery, go in Mounts and storage then (depending on what partitions you touched in Parted, excluding /preload) do the appropriate formats after repartition. Now you're ready to restore your nandroid backup (needs to have less size than new partitions) or install a ROM.

    I suggest an useful program to check partition size on Android, Partition Table

    If you touch HIDDEN partition and you are on 4.2 ROM or 4.4 builds after 15 June:

    Code:
    format
    y
    9
    ext2

    If you repartition UMS to the minimum, you will need to swap internal and external storages (MicroSD card will be the new internal storage):

    On 4.2 open system/etc/vold.fstab and replace the content with this:
    Code:
    # MicroSD as internal storage
    dev_mount sdcard0 /storage/sdcard0 auto /devices/sdi0/mmc_host/mmc1/mmc1
    
    # UMS as external storage
    dev_mount sdcard1 /storage/sdcard1 8 /devices/sdi2/mmc_host/mmc0/mmc0 nonremovable,encryptable
    
    # usbdisk
    dev_mount usbdisk0 /storage/usbdisk0 auto /devices/platform/msm_hsusb_host.0

    On 4.3 ROMs open system/build.prop and add these lines at the end of the file:
    Code:
    persist.sys.vold.switchexternal=1
    ro.vold.switchablepair=/storage/sdcard0,/storage/sdcard1

    On 4.4 ROMs just open NovaThor Settings and enable "Swap Storages"

    To restore original partition table flash stock ROM through Odin with "Repartition" enabled and correct PIT file for your model, in attachment (extract zip), soon CHN pits too

    I know that it's difficult to understand well the first times, but think at me that I developed this method, a lot of testing and bricks on bricks :D

    If you found this useful, you can support me at least by pressing "Thanks" or considering to offer me a beer, a coffee... Any kind of support will be very appreciated :cool:
    9
    Another reserved just in case!!
    7
    Reserved for "The PIT Zone" (soon available!) :cool:
    3
    new way to partition just by flashing a zip!!! and your data is not wiped! :)