Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,770,471 Members 42,057 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
seal.s
Old
#21  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Apr 2014
Thanks for your mod,
Can you provide me please

system = 1 GB
cache = 126 MB
data = 2.4 GB
Internal SD Card = Remaining space
 
KumarAnup
Old
#22  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Apr 2014
Location: Gorakhpur
Hello sir can you create a new mod with these configuration
/system =1.2gb
/cache=200mb
/data=2gb
/internal SD card=remaining space
Thank you...
Sent from my C2305 using XDA Free mobile app
 
spandrd
Old
#23  
Member
Thanks Meter 6
Posts: 35
Join Date: Jun 2014
Default internal / phone storage damaged error....

Dear friend.............

EBRs are working for me as read from various sources & modified. BUT............. whenever I reboot, it says "internal / phone storage damaged"...... which makes me to FORMAT INTERNAL STORAGE AGAIN-n-AGAIN. Same is happening in MTK6592 as well as my MTK6589 phones.........

DO you have any idea of the resolution........... ?? )


Further, I tried "system" re-partitioning for MT6592.......... but it never worked. There is something different for MT6592 perhaps..........!!



Quote:
Originally Posted by keanu_ritz View Post
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






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 //?




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.
 
spandrd
Old
#24  
Member
Thanks Meter 6
Posts: 35
Join Date: Jun 2014
Default pl. extend it to "system partition" re-sizing......

You are right 900supersport........ your utility is excellent..... & worked fine. Thanx.

However, can it be expanded to do "system partition re-sizing" as well..........? I wish to do it for MT-6592...... which has somewhat differing EBR than as reqd. in the link: http://forum.xda-developers.com/show....php?t=2771318

I didn't try it for MT6589... as it already had 1 GB System size. But, MT6592 came with 787 MB (prhps 800 MB) system size only.... which causes some problems if I de-odex my ROM using "android-tuner".... which asks for atleast 25% free system memory.

I think... it leads to repeated internal-storage corruption.. + could be problematic, if I (try to) install any custom ROM in future.... !!

Quote:
Originally Posted by 900supersport View Post
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
 
spandrd
Old
#25  
Member
Thanks Meter 6
Posts: 35
Join Date: Jun 2014
Default not worked for MT6592..... system re-partitionig / re-sizing

Tried a lot for "system-partition" resizing for MT6592....... but it doesn't boot thereafter.......


Further, "0xffffffff (A+B)" doesn't apply for its EBRs prhps....... (however, I did consider it for making new EBRs which is working.)

please update for MT6592 also........

attached my EBRs (original / new) & scatter file as-well-as Blocks-Map also for your reference.


Quote:
Originally Posted by keanu_ritz View Post
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






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 //?




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.
Attached Thumbnails
Click image for larger version

Name:	Blocks Map-Intex Aqua Octa Core_SELF.jpg
Views:	40
Size:	145.4 KB
ID:	2864453  
Attached Files
File Type: zip EBRs-MT6592 - data partition resized_7 GB.zip - [Click for QR Code] (1.8 KB, 5 views)
 
900supersport
Old
#26  
Member
Thanks Meter 14
Posts: 36
Join Date: Jul 2012
Quote:
Originally Posted by spandrd View Post
You are right 900supersport........ your utility is excellent..... & worked fine. Thanx.

However, can it be expanded to do "system partition re-sizing" as well..........? I wish to do it for MT-6592...... which has somewhat differing EBR than as reqd. in the link: http://forum.xda-developers.com/show....php?t=2771318

I didn't try it for MT6589... as it already had 1 GB System size. But, MT6592 came with 787 MB (prhps 800 MB) system size only.... which causes some problems if I de-odex my ROM using "android-tuner".... which asks for atleast 25% free system memory.

I think... it leads to repeated internal-storage corruption.. + could be problematic, if I (try to) install any custom ROM in future.... !!
I'll get around to looking at system, though so far I have had no need myself. I have however created a python script that will work either in windows (you will need to install python from python.org), or linux that will create updated EBR files for you.
Attached Files
File Type: zip ebr.py.zip - [Click for QR Code] (1.8 KB, 10 views)
 
gregferns
Old
#27  
Senior Member
Thanks Meter 67
Posts: 637
Join Date: Sep 2009
Location: Mumbai
Quote:
@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.
ATTACHED FILES
File Type: zip RiTz_Mod_4_gregferns.zip - [Click for QR Code] (237.9 KB, 9 views)


Quote:
Originally Posted by keanu_ritz View Post
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.
@keanu_ritz
Hi.

What size would you think be best for having lots of apps on internal using ART and not DALVIK.

Can you recommend and give me a zip file please?

thanks in advance.
Greg
 
lolik1313
Old
(Last edited by lolik1313; 5th August 2014 at 02:59 AM.) Reason: success
#28  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Aug 2014
Default [ask] repartition mtk6589

simple question, what we need just edit the EBR1 and EBR2 file? no need to edit MBR file ?

and how can u got the size of 900MB to bytes ??

and what is the risk if i wrong calculated the EBR1 and EBR2 file ? since i'm not good at this but i want to try.

thanks for your great tutorial.



yes, i succeed repartitioning my internal storage,,, thanks for your tutorial.
 
ufh1
Old
#29  
Junior Member
Thanks Meter 0
Posts: 23
Join Date: May 2010
Hi, I have a chinese device with MT6589, that is identical to General Mobile Discovery and similar to A116.

I used repartition utility meant for a different chip and now phone is in bootloop. Surely my internal partitions are messed up.

Can I use your RiTz_partition_mod_a116.zip to flash and correct the problem. I have a rom to install once problem is rectified. I also have CWM installed and working.

Phone has 4gb rom, had 1 GB internal memory that I wanted to maximize and 1.5 gb was showing as internal phone storage that I had no use of.

Please help. Also where do EBR1, EBR2 and MBR come from, I have no idea where to get these for my phone, I do have a nandroid backup of stock rom available but could not find these files in it.

Hex editing looks scary but I have no files to edit, all this EBR and Hex editing is new to me, trying to read as much as possible to gain an understanding before embarking on fixing the phone.


Regards

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes