MOD + Tutorial for Re-partitioning Storage of MTK6589 + Flash through CWM/TWRP

Search This thread

keanu_ritz

Senior Member
Jul 10, 2013
172
472
SANGLI
Tutorial/Guide for Re-partitioning MTK6589 + Increase your System & Data Partitions + Flash through CWM/TWRP + no need to use SPFlashTool

Part 1 :- To Flash existing modified EBR files through CWM/TWRP

There are plenty of guides for re-partitioning mtk devices, so why this one?
Well almost all of them suggest to use SPFlashTool to flash the "EBR" Files.

But we can do that by using CWM/TWRP (Custom Recoveries) as well!!!!!
no need to use SPFlashTool!
no need to format the Internal SDCard through PC!!

Just take your modified "EBR" files and put them into a Flashable Zip.

Edit the "updater-script" file to include the following lines.


Code:
[FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]package_extract_file("EBR1", "/dev/ebr1"); 
#put the name of your EBR1 file in place of "EBR1"
package_extract_file("EBR2", "/dev/ebr2"); 
#put the name of your EBR2 file in place of "EBR2"[/COLOR][/SIZE][/FONT]

Note :-
If your device uses both the files then add both the lines and If your device uses only "EBR1" then add only the line of "EBR1".

Now add the following lines to format your "/system" , "/cache" and "/data" partitions.


Code:
[FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]
format("ext4", "EMMC", "/emmc@android", "0", "/system");
format("ext4", "EMMC", "/emmc@cache", "0", "/cache");
format("ext4", "EMMC", "/emmc@usrdata", "0", "/data");
[/COLOR][/SIZE][/FONT]

Note :- If you are going to increase your "/system" partition then you'll have to format the 3 partitions,
and if you just want to increase the "/data" partition then just include the lines for formatting "/cache" and "/data".


now save the "updater-script" file and replace it in the Flashable zip!!

Or , you can use this sample flashable zip file.
download it and put your EBR files in it!!!!
edit the "updater-script" file according to your need and replace it in the Flashable zip!!

copy the Flashable zip file to your external SDCard
reboot to recovery
select install from zip file and choose the flashable zip file
Flash it.

Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
Just Flash any CWM/TWRP Flashable ROM available for your device!!
Wipe Dalvik Cache if you haven't done it already!!
reboot and see for yourself!!!

Disclaimer :-
I will not be in anyway responsible for any damage this might cause to your phone.
if you'll follow the instructions correctly, then everything will be fine.


 
Last edited:

keanu_ritz

Senior Member
Jul 10, 2013
172
472
SANGLI
Part 2 :-

for understanding your MTK device's partitions, first read this excellent guide posted by @tirta.agung --> [Noob Guide] Understanding the Hex value of MTK's MBR/EBR1/EBR2


So How to Increase the system partition? or the data partition?
I'll tell you!!

I use MMX Canvas HD A116 (mt6589)
it has 4GB internal storage distributed as below:
/system = 650mb
/cache = 126mb
/data = 1gb
Internal SDcard = 1.77gb


i wanted to change it to this:- (and i've done it!!!)
/system = 900mb
/cache = 126mb
/data = 2gb
Internal SDCard = remaining space i.e around 536mb



Note :- First please read the above mentioned guide, otherwise you won't understand this!!


let me try to make it simple to you
this is the hex format of "EBR1" & "EBR2"

EBR1 of MMX A116 (mt6589) :-
00 00 00 00 83 00 00 00 00 08 02 00 00 50 14 00 --> Partition 5 /system 650MB
00 00 00 00 83 00 00 00 00 58 16 00 00 f0 03 00 --> Partition 6 /cache 126MB
00 00 00 00 83 00 00 00 00 48 1a 00 00 00 20 00 --> Partition 7 /data 1GB
00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> points to ebr2

EBR2 of MMX A116 (mt6589) :-
00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff --> partition 8 Internal SDCard
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



Note :-
numbers in red --> Offset of partition

numbers in DarkOrange --> Size of Partition



Now if you notice carefully these partitions are continuous/contiguous.

133120 + 1331200 = 1464320
1464320 + 258048 = 1722368


i.e no.of sectors before partition + the length of the partition = no.of sectors before the next partition

// 133120 = no.of sectors before "/system" partition i.e "/system" starts from sector no. 133121
// 1331200 = the length of "/system" i.e "/system" is of 1331200 sectors.
// 1464320 = no.of sectors before "/cache" partition i.e "/cache" starts from sector no. 1464321
// and so on



The last line in EBR1 points to EBR2.
(This one --> 00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff )

and the First line in EBR2 is the one for the partition of Internal SDCard.
(This one --> 00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff )

Even after reading many guides, I haven't found a proper explanation of this anywhere.
in one of them it states that,



D = (A + B) - C
where,
A = no.of sectors before "/data"
B = size of "/data"
C = offset of EBR2
D = offset part in EBR2

E = MaxValue - (A + B)
where,
MaxValue = FFFFFFFF (Hex) = 4294967295 (in decimal)
A = no.of sectors before "/data"
B = size of "/data"
E = Size part in EBR2

A = 00 48 1a 00 --> 001a4800 --> 1722368 //offset of "/data"
B = 00 00 20 00 --> 00200000 --> 2097152 //size of "/data"
C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?

Note :-
in Red --> Hex values in little endian
in Orange --> Hex values in big endian
in Blue --> Decimal values


D = (A+B) - C = (1722368 + 2097152) - 111616 = 3707904

E = MaxValue - (A+B) = 4294967295 - (1722368 + 2097152) = 4291147775

D = 3707904 = 00389400 = 00 94 38 00

E = 4291147775 = ffc5b7ff = ff b7 c5 ff




so now you've got a good idea of what the values in "EBR" files mean, haven't you!!
Now here comes the Important part i.e how to modify the partition sizes.


I wanted "/system" = 900mb , so





So we get "00 20 1C 00" as the value for 900mb
(note-down these new values as we'll need to use them later)

now as we've increased the size of system we need to change the offset of the next partition so that there won't be any overlapping/corruption of partitions.

and how do we do that --> "no.of sectors before partition + the length of the partition = no.of sectors before the next partition"
i.e 133120 + 1843200 = 1976320 //new offset of "/cache"



decimal value --> 1976320
Hex value in big endian --> 001E2800
Hex value in little endian --> 00 28 1E 00


So we get "00 28 1E 00" as the value for sectors before "/cache"
i don't want to change size of "/cache" so it remains same i.e "00 f0 03 00"

now we need to offset the "/data" partition
("no.of sectors before partition + the length of the partition = no.of sectors before the next partition")
1976320 + 258048 = 2234368 // the number of sectors before "/data" partition



decimal value --> 2234368
Hex value in big endian --> 00221800
Hex value in little endian --> 00 18 22 00


So we get "00 18 22 00" as the value for sectors before "/data"

now i want to make my "/data" to 2gb i.e 2048mb





So we get "00 00 40 00" as the value for 2048mb

The last line in EBR1 Points to EBR2 so don't make any changes to it!!!

So now our modified EBR1 Becomes like this:-
00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


now we need to offset the Internal SDCard's partition which is in EBR2





calculate new D & E :-

D = (A+B) - C
where,
A = no.of sectors before "/data"
B = size of "/data"
C = offset of EBR2


E = MaxValue - (A+B)
where,
MaxValue = FFFFFFFF (Hex) = 4294967295 (Decimal)
A = no.of sectors before "/data"
B = size of "/data"


A = 00 18 22 00 --> 00221800 --> 2234368 //offset of "/data"
B = 00 00 40 00 --> 00400000 --> 4194304 //size of "/data"
C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?


D = (A+B) - C = (2234368 + 4194304) - 111616 = 6317056

E = MaxValue - (A+B) = 4294967295 - (2234368 + 4194304) = 4288538623


D = 6317056 = 00606400 = 00 64 60 00

E = 4288538623 = FF9DE7FF = ff e7 9d ff






That's it, now we've got all the values ,it's time to put them into the EBR Files.
So this is the result of our modification:-
Modified EBR1 :-
00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


Modified EBR2 :-
00 00 00 00 83 00 00 00 00 64 60 00 ff e7 9d ff --> internal sdcard


To edit "EBR" files :-
Open your ERB1 & EBR2 files in hex editor and replace the respective values with our modified values.
save the files and put them into a flashable zip and flash through CWM/TWRP or whatever custom recovery that you use!!!!

Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
Just Flash any CWM/TWRP Flashable ROM available for your device!!
Wipe Dalvik Cache if you haven't done it already!!
reboot and see for yourself!!!




Screenshots :-


Disclaimer :-
I will not be in anyway responsible for any damage this might cause to your phone.
if you'll follow the instructions correctly, then everything will be fine.
 
Last edited:

j_svas

Senior Member
May 28, 2006
442
54
Pune
Great detailed guide, Thank you. One question, is that also possible to increase Ram too? :)

Sent from my Micromax A116i using XDA Premium 4 mobile app
 

gregferns

Senior Member
Sep 19, 2009
1,191
136
Mumbai
Xiaomi Poco F1
OnePlus Nord
Thanks for this guide... It will definitely be good...

One question - I presume this remains permanent till you modify partitions again, or till you flash a rom that allows you to modify the partitions as well right ??

I had modified my partition to /data being 2.5gb from one of the earlier methods and never looked back since... It really helps when you dont have to bother about moving apps around to fit into the given space....

Good work dude.... cheers

Greg
 

gregferns

Senior Member
Sep 19, 2009
1,191
136
Mumbai
Xiaomi Poco F1
OnePlus Nord
@keanu_ritz

Hi.

Original sizes are
/system = 650mb
/cache = 126mb
/data = 1gb
Internal SDcard = 1.77gb

I want it changed to below
/system = 700mb
/cache = 126mb
/data = 2gb
Internal SDCard = remaining space i.e around 536mb

Basically you had made /system= 900mb i want 200mb of that moved to Internal SDCard...

Can you please do that for me ??

ALso i have a 64GB card with around 1.5gb or 2gb sd-ext.... just for your info.

regards
Greg
 

keanu_ritz

Senior Member
Jul 10, 2013
172
472
SANGLI
@keanu_ritz

Hi.

Original sizes are
/system = 650mb
/cache = 126mb
/data = 1gb
Internal SDcard = 1.77gb

I want it changed to below
/system = 700mb
/cache = 126mb
/data = 2gb
Internal SDCard = remaining space i.e around 536mb

Basically you had made /system= 900mb i want 200mb of that moved to Internal SDCard...

Can you please do that for me ??

ALso i have a 64GB card with around 1.5gb or 2gb sd-ext.... just for your info.

regards
Greg

take complete backup of your phone before you try this.
you will have to flash a new ROM after you flash this and you can't/shouldn't restore your old CWM/TWRP backup.

attaching your requested file.
 

Attachments

  • RiTz_Mod_4_gregferns.zip
    237.9 KB · Views: 523

900supersport

Member
Jul 7, 2012
40
14
Thanks for the great tutorial

I've successfully edited my ebr files (cube U65GT) to increase my internal storage from 2GB to 6GB with commensurate decrease in internal sdcard. I flashed this via a CWM update including formatting cache and usrdata. The tablet started as expected taking me through the normal set-up. When I look at the internal sdcard the size has reduced by 4 gig as expected but the data is still there. This seems wrong to me. Any ideas?

Brian
 

keanu_ritz

Senior Member
Jul 10, 2013
172
472
SANGLI
Thanks for the great tutorial

I've successfully edited my ebr files (cube U65GT) to increase my internal storage from 2GB to 6GB with commensurate decrease in internal sdcard. I flashed this via a CWM update including formatting cache and usrdata. The tablet started as expected taking me through the normal set-up. When I look at the internal sdcard the size has reduced by 4 gig as expected but the data is still there. This seems wrong to me. Any ideas?

Brian

There's nothing wrong with it, the data is still there b'coz you've just resized the internal sdcard but you haven't formatted it.
If you don't format the internal sdcard and just resize it, then you should only lose that data which was present on the resized portion of your storage space!!
 

900supersport

Member
Jul 7, 2012
40
14
Thanks, I thought the following would have formatted it.

Code:
ui_print (" Formatting 'cache' and 'data' partitions "); 
format("ext4", "EMMC", "/emmc@cache", "0", "/cache"); 
format("ext4", "EMMC", "/emmc@usrdata", "0", "/data"); 
ui_print(" Finished Formatting!! ");
 

spandrd

Senior Member
Jun 17, 2014
59
15
android mmcblk0p6 size changed, but system size not changed.....

Well....... i did the similar procedure using your sample zip script also, as well as using Flash Tool for my MT6592 (MTK6592)........ but, although with DiskInfoPro, I see that "android mmcblk0p6" size has changed from earlier 800 MB to new 1.2 GB....... but when I see with Link2SD or MTK Droid tool.......... system partition appears same as earlier, i.e. 800 MB (exactly 787 MB in link 2 sd).......

Is it that System Size cannot be changed....... it is only like some mount point / shortcut, which appears as system in my set (Intex Aqua Octa Core) running Jellybean 4.2.2??

RELEVANT to this........... is that WHEN I ATTEMPT MTK Droid Backup, I find system.ext4.img as 819200 KB & system.ext4.tar (zip) as 645140 KB. What is new system size then - not changed prhps?

Kindly revert / advise.
 
Last edited:

keanu_ritz

Senior Member
Jul 10, 2013
172
472
SANGLI
Well....... i did the similar procedure using your sample zip script also, as well as using Flash Tool for my MT6592 (MTK6592)........ but, although with DiskInfoPro, I see that "android mmcblk0p6" size has changed from earlier 800 MB to new 1.2 GB....... but when I see with Link2SD or MTK Droid tool.......... system partition appears same as earlier, i.e. 800 MB (exactly 787 MB in link 2 sd).......

Is it that System Size cannot be changed....... it is only like some mount point / shortcut, which appears as system in my set (Intex Aqua Octa Core) running Jellybean 4.2.2??

RELEVANT to this........... is that WHEN I ATTEMPT MTK Droid Backup, I find system.ext4.img as 819200 KB & system.ext4.tar (zip) as 645140 KB. What is new system size then - not changed prhps?

Kindly revert / advise.

The size of "system" partition can be changed, for proof look at the screenshots that I've attached in post no.2 of this thread!!

try using the "Partition Table" App and see what size it shows.

please tell me the exact steps that you performed and did you restore your earlier backup or did you flash a new ROM.
it's very important that after flashing the partition mod, you should flash a new ROM!! never restore your old backup!!

or give me your original and modified "EBR" files , so that i can check them!!
 
Last edited:
  • Like
Reactions: spandrd

spandrd

Senior Member
Jun 17, 2014
59
15
reg modified system partition size.....

Dear Ritz,

As advised, i've taken screenshots for Partition-Table-App details & attached with EBRs - original & modified. (same details are reflected using link2sd as well).

However, I only did factory reset so far & installed apps-from-GO-Backup. I have NOT restored clockworkmod-backup.

Further, what is confusing me is that why "DiskInfoPro" app shows mmcblk0p6 (co-related to "android" / "system" partition, as per attached MTK Droid pic).......... is 1.2 GB while system size is still 787 MB only............. same showing in catproc pic as well.....

Further, as my device is "unsupported yet", so i don't know if i should think of flashing any other ROM zip of any other MTK6592 phone, .......or if in case of errors / problems thereupon, i can restore stock rom with simple SP Flash Tool flashing of all my all-partitions-readbacks taken.....


The size of "system" partition can be changed, for proof look at the screenshots that I've attached in post no.2 of this thread!!

try using the "Partition Table" App and see what size it shows.

please tell me the exact steps that you performed and did you restore your earlier backup or did you flash a new ROM.
it's very important that after flashing the partition mod, you should flash a new ROM!! never restore your old backup!!

or give me your original and modified "EBR" files , so that i can check them!!
 

vismaiy

Senior Member
May 7, 2012
498
125
mumbai
Xiaomi Poco F1
Google Pixel 5a
Hello sir! Thanks for your mod, I have a request here. Can you provide me mod with these sizes
System-1gb
Data-2gb
And the rest which suits you.
I am too scared to do it myself bcoz it's my primary phone and I can't risk it to brick. I am already using your 900mb mod ;) thanks for your work!

Sent from my Micromax A116i using XDA Premium 4 mobile app
 

leo.riv

Senior Member
Jul 14, 2013
845
342
@keanu_ritz

I want to changed This

/system = 1 GB
/cache = 200 MB
/data = 2.2 GB
Internal SD Card = remaining space

OR

/system = 1 GB
/cache = 126 MB
/data = 2.3 GB
Internal SD Card = remaining space

Please can you do that for me ??
 

Top Liked Posts

  • There are no posts matching your filters.
  • 20
    Part 2 :-

    for understanding your MTK device's partitions, first read this excellent guide posted by @tirta.agung --> [Noob Guide] Understanding the Hex value of MTK's MBR/EBR1/EBR2


    So How to Increase the system partition? or the data partition?
    I'll tell you!!

    I use MMX Canvas HD A116 (mt6589)
    it has 4GB internal storage distributed as below:
    /system = 650mb
    /cache = 126mb
    /data = 1gb
    Internal SDcard = 1.77gb


    i wanted to change it to this:- (and i've done it!!!)
    /system = 900mb
    /cache = 126mb
    /data = 2gb
    Internal SDCard = remaining space i.e around 536mb



    Note :- First please read the above mentioned guide, otherwise you won't understand this!!


    let me try to make it simple to you
    this is the hex format of "EBR1" & "EBR2"

    EBR1 of MMX A116 (mt6589) :-
    00 00 00 00 83 00 00 00 00 08 02 00 00 50 14 00 --> Partition 5 /system 650MB
    00 00 00 00 83 00 00 00 00 58 16 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 48 1a 00 00 00 20 00 --> Partition 7 /data 1GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> points to ebr2

    EBR2 of MMX A116 (mt6589) :-
    00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff --> partition 8 Internal SDCard
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00



    Note :-
    numbers in red --> Offset of partition

    numbers in DarkOrange --> Size of Partition



    Now if you notice carefully these partitions are continuous/contiguous.

    133120 + 1331200 = 1464320
    1464320 + 258048 = 1722368


    i.e no.of sectors before partition + the length of the partition = no.of sectors before the next partition

    // 133120 = no.of sectors before "/system" partition i.e "/system" starts from sector no. 133121
    // 1331200 = the length of "/system" i.e "/system" is of 1331200 sectors.
    // 1464320 = no.of sectors before "/cache" partition i.e "/cache" starts from sector no. 1464321
    // and so on



    The last line in EBR1 points to EBR2.
    (This one --> 00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff )

    and the First line in EBR2 is the one for the partition of Internal SDCard.
    (This one --> 00 00 00 00 83 00 00 00 00 94 38 00 ff b7 c5 ff )

    Even after reading many guides, I haven't found a proper explanation of this anywhere.
    in one of them it states that,



    D = (A + B) - C
    where,
    A = no.of sectors before "/data"
    B = size of "/data"
    C = offset of EBR2
    D = offset part in EBR2

    E = MaxValue - (A + B)
    where,
    MaxValue = FFFFFFFF (Hex) = 4294967295 (in decimal)
    A = no.of sectors before "/data"
    B = size of "/data"
    E = Size part in EBR2

    A = 00 48 1a 00 --> 001a4800 --> 1722368 //offset of "/data"
    B = 00 00 20 00 --> 00200000 --> 2097152 //size of "/data"
    C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
    Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?

    Note :-
    in Red --> Hex values in little endian
    in Orange --> Hex values in big endian
    in Blue --> Decimal values


    D = (A+B) - C = (1722368 + 2097152) - 111616 = 3707904

    E = MaxValue - (A+B) = 4294967295 - (1722368 + 2097152) = 4291147775

    D = 3707904 = 00389400 = 00 94 38 00

    E = 4291147775 = ffc5b7ff = ff b7 c5 ff




    so now you've got a good idea of what the values in "EBR" files mean, haven't you!!
    Now here comes the Important part i.e how to modify the partition sizes.


    I wanted "/system" = 900mb , so





    So we get "00 20 1C 00" as the value for 900mb
    (note-down these new values as we'll need to use them later)

    now as we've increased the size of system we need to change the offset of the next partition so that there won't be any overlapping/corruption of partitions.

    and how do we do that --> "no.of sectors before partition + the length of the partition = no.of sectors before the next partition"
    i.e 133120 + 1843200 = 1976320 //new offset of "/cache"



    decimal value --> 1976320
    Hex value in big endian --> 001E2800
    Hex value in little endian --> 00 28 1E 00


    So we get "00 28 1E 00" as the value for sectors before "/cache"
    i don't want to change size of "/cache" so it remains same i.e "00 f0 03 00"

    now we need to offset the "/data" partition
    ("no.of sectors before partition + the length of the partition = no.of sectors before the next partition")
    1976320 + 258048 = 2234368 // the number of sectors before "/data" partition



    decimal value --> 2234368
    Hex value in big endian --> 00221800
    Hex value in little endian --> 00 18 22 00


    So we get "00 18 22 00" as the value for sectors before "/data"

    now i want to make my "/data" to 2gb i.e 2048mb





    So we get "00 00 40 00" as the value for 2048mb

    The last line in EBR1 Points to EBR2 so don't make any changes to it!!!

    So now our modified EBR1 Becomes like this:-
    00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
    00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


    now we need to offset the Internal SDCard's partition which is in EBR2





    calculate new D & E :-

    D = (A+B) - C
    where,
    A = no.of sectors before "/data"
    B = size of "/data"
    C = offset of EBR2


    E = MaxValue - (A+B)
    where,
    MaxValue = FFFFFFFF (Hex) = 4294967295 (Decimal)
    A = no.of sectors before "/data"
    B = size of "/data"


    A = 00 18 22 00 --> 00221800 --> 2234368 //offset of "/data"
    B = 00 00 40 00 --> 00400000 --> 4194304 //size of "/data"
    C = 00 b4 01 00 --> 0001b400 --> 111616 //offset of ebr2
    Max Value = FF FF FF FF --> ffffffff --> 4294967295 //?


    D = (A+B) - C = (2234368 + 4194304) - 111616 = 6317056

    E = MaxValue - (A+B) = 4294967295 - (2234368 + 4194304) = 4288538623


    D = 6317056 = 00606400 = 00 64 60 00

    E = 4288538623 = FF9DE7FF = ff e7 9d ff






    That's it, now we've got all the values ,it's time to put them into the EBR Files.
    So this is the result of our modification:-
    Modified EBR1 :-
    00 00 00 00 83 00 00 00 00 08 02 00 00 20 1c 00 --> Partition 5 /system 900MB
    00 00 00 00 83 00 00 00 00 28 1E 00 00 f0 03 00 --> Partition 6 /cache 126MB
    00 00 00 00 83 00 00 00 00 18 22 00 00 00 40 00 --> Partition 7 /data 2GB
    00 00 00 00 05 00 00 00 00 b4 01 00 ff ff ff ff --> Link to ebr2


    Modified EBR2 :-
    00 00 00 00 83 00 00 00 00 64 60 00 ff e7 9d ff --> internal sdcard


    To edit "EBR" files :-
    Open your ERB1 & EBR2 files in hex editor and replace the respective values with our modified values.
    save the files and put them into a flashable zip and flash through CWM/TWRP or whatever custom recovery that you use!!!!

    Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
    Just Flash any CWM/TWRP Flashable ROM available for your device!!
    Wipe Dalvik Cache if you haven't done it already!!
    reboot and see for yourself!!!




    Screenshots :-


    Disclaimer :-
    I will not be in anyway responsible for any damage this might cause to your phone.
    if you'll follow the instructions correctly, then everything will be fine.
    18
    Tutorial/Guide for Re-partitioning MTK6589 + Increase your System & Data Partitions + Flash through CWM/TWRP + no need to use SPFlashTool

    Part 1 :- To Flash existing modified EBR files through CWM/TWRP

    There are plenty of guides for re-partitioning mtk devices, so why this one?
    Well almost all of them suggest to use SPFlashTool to flash the "EBR" Files.

    But we can do that by using CWM/TWRP (Custom Recoveries) as well!!!!!
    no need to use SPFlashTool!
    no need to format the Internal SDCard through PC!!

    Just take your modified "EBR" files and put them into a Flashable Zip.

    Edit the "updater-script" file to include the following lines.


    Code:
    [FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]package_extract_file("EBR1", "/dev/ebr1"); 
    #put the name of your EBR1 file in place of "EBR1"
    package_extract_file("EBR2", "/dev/ebr2"); 
    #put the name of your EBR2 file in place of "EBR2"[/COLOR][/SIZE][/FONT]

    Note :-
    If your device uses both the files then add both the lines and If your device uses only "EBR1" then add only the line of "EBR1".

    Now add the following lines to format your "/system" , "/cache" and "/data" partitions.


    Code:
    [FONT="Comic Sans MS"][SIZE="3"][COLOR="Red"]
    format("ext4", "EMMC", "/emmc@android", "0", "/system");
    format("ext4", "EMMC", "/emmc@cache", "0", "/cache");
    format("ext4", "EMMC", "/emmc@usrdata", "0", "/data");
    [/COLOR][/SIZE][/FONT]

    Note :- If you are going to increase your "/system" partition then you'll have to format the 3 partitions,
    and if you just want to increase the "/data" partition then just include the lines for formatting "/cache" and "/data".


    now save the "updater-script" file and replace it in the Flashable zip!!

    Or , you can use this sample flashable zip file.
    download it and put your EBR files in it!!!!
    edit the "updater-script" file according to your need and replace it in the Flashable zip!!

    copy the Flashable zip file to your external SDCard
    reboot to recovery
    select install from zip file and choose the flashable zip file
    Flash it.

    Remember after flashing the EBR files do not restore your previous CWM/TWRP Backup.
    Just Flash any CWM/TWRP Flashable ROM available for your device!!
    Wipe Dalvik Cache if you haven't done it already!!
    reboot and see for yourself!!!

    Disclaimer :-
    I will not be in anyway responsible for any damage this might cause to your phone.
    if you'll follow the instructions correctly, then everything will be fine.


    10
    Mods :-

    Mod 1 :- RiTz_partition_mod_a116.zip
    /system = 900mb
    /data = 2gb
    Internal SDCard = 536mb


    Revert to stock/Original partition sizes :-
    RiTz_partition_mod_Revert_a116.zip

    If you want them resized according to your need then you can request it here or use this tutorial to do it yourself!!!
    4
    I know some people seem to be allergic to hex so I have put together the attached spreadsheet that should help.

    Enter your values and the size you want in the cells highlighted green and read out the required values in yellow.

    Brian
    3
    @keanu_ritz

    Hi.

    Original sizes are
    /system = 650mb
    /cache = 126mb
    /data = 1gb
    Internal SDcard = 1.77gb

    I want it changed to below
    /system = 700mb
    /cache = 126mb
    /data = 2gb
    Internal SDCard = remaining space i.e around 536mb

    Basically you had made /system= 900mb i want 200mb of that moved to Internal SDCard...

    Can you please do that for me ??

    ALso i have a 64GB card with around 1.5gb or 2gb sd-ext.... just for your info.

    regards
    Greg

    take complete backup of your phone before you try this.
    you will have to flash a new ROM after you flash this and you can't/shouldn't restore your old CWM/TWRP backup.

    attaching your requested file.