[SCRIPT] Fix partition table for Android 4.4


It is file manager build in that allows you to flash ROMs,gapps ... But this time you just open it and not install anything.

Navigate to file manager (it will moint sdcard read/write),connect phone to PC and then execute script.
Like I said, how easy can it be if you know what the other one means or what to look for.
fixed my issue, thanks for your help
 
I don't understand how to run this, going into CWM how do I have access to ADB? No devices is listed in CWMR.
Adb must be downloaded on your pc (find it on google)...once installed, you can type from terminal (cmd.exe if you're using Windows) "adb" to initialize it or "Adb devices" to see if your phone is connected (realizing that you have installed Adb with correct driver).

You can follow Micha's instructions after that (boot into recovery-->sys1-->install zip-->choose zip from storage/sdcard-->type the command lines of Micha
 
Adb must be downloaded on your pc (find it on google)...once installed, you can type from terminal (cmd.exe if you're using Windows) "adb" to initialize it or "Adb devices" to see if your phone is connected (realizing that you have installed Adb with correct driver).

You can follow Micha's instructions after that (boot into recovery-->sys1-->install zip-->choose zip from storage/sdcard-->type the command lines of Micha

Choosing zip portion I don't understand, adb don't detect any devices when I'm in recovery. When in the ROM everything is OK.

EDIT: Got it! Need to install ADB for recovery mode.
 
Last edited:
Hi guys, I'm getting the following error when running the script in recovery

~ # /tmp/repartition.sh
/tmp/repartition.sh
check environment
/sbin/mount
/sbin/umount
/sbin/parted
/sbin/tune2fs
/sbin/e2fsck
dump old table
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
/tmp/repartition.sh: line 115: can't create /sdcard/parted_06-19-2014-2320B76C60C7F141928401B04022588A: nonexistent directory
Failed dumping table
~ #

Any ideas?
 
You could use the mount manager from CWM :)

Thanks M1cha. The mount manager from CWM worked perfectly.
Executed the script without a hitch after mounting the sdcard, flashed CyanogenMod 11.0 then MIUI development ROM and installed GAPPS.
Thanks again :)
 
Hi,micha, can I enlarge the data partion by take space from the virtrual SDcard ? I installed a lot of Apps, and now the data partion is too small, I cannnot install new app or upgrade my installled apps.
will the following code work? I know I should back up my data cause the storage is touched.
Code:
change_table() {
    ui_print "parted: delete"
    parted -s /dev/block/mmcblk0 rm 23 || return 1 # system
    parted -s /dev/block/mmcblk0 rm 24 || return 1 # system1
    parted -s /dev/block/mmcblk0 rm 25 || return 1 # cache
    parted -s /dev/block/mmcblk0 rm 26 || return 1 # userdata
    parted -s /dev/block/mmcblk0 rm 27 || return 1 # storage

    ui_print "parted: create"
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 336MB 1176MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 1176MB 2016MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2016MB 2419MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2419MB 8081MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 8081MB 31269MB || return 1

    ui_print "parted: name"
    parted -s /dev/block/mmcblk0 name 23 system || return 1
    parted -s /dev/block/mmcblk0 name 24 system1 || return 1
    parted -s /dev/block/mmcblk0 name 25 cache || return 1
    parted -s /dev/block/mmcblk0 name 26 userdata || return 1
    parted -s /dev/block/mmcblk0 name 27 storage || return 1
   
    return 0
}
 
Last edited:
@M1cha @linuxx
How should I edit the "repartition.sh" file so that I may be able to enter custom system & system 1 partition sizes, (for example 1.5 GB for System and 1 GB for System-1)
And one more thing, you have set the partition type as ext-2 in your "repartition.sh" file, can I change it to ext-4 if I want??

Thanks,
GuseppiGuliano
 
Last edited:
@M1cha @linuxx
How should I edit the "repartition.sh" file so that I may be able to enter custom system & system 1 partition sizes, (for example 1.5 GB for System and 1 GB for System-1)
And one more thing, you have set the partition type as ext-2 in your "repartition.sh" file, can I change it to ext-4 if I want??

Thanks,
GuseppiGuliano
After partitioning the filesystems gets converted to ext4 already.
 
@M1cha
You did not tell me how to edit the "repartition.sh" file if I want the System1 partition to be 1.5 GB and System2 partition 1 GB!
Please reply quickly, I'm waiting for it since yesterday! :)

Thanks,
Guseppiguliano
 
@M1cha
You did not tell me how to edit the "repartition.sh" file if I want the System1 partition to be 1.5 GB and System2 partition 1 GB!
Please reply quickly, I'm waiting for it since yesterday! :)

Thanks,
Guseppiguliano
sry, I didn't know I'm a live supporter :D
You have to edit these lines:

Code:
ui_print "parted: create"
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 336MB 1176MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 1176MB 2016MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2016MB 2419MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2419MB 5570MB || return 1

these are just from-to values.
you can view your current partition table with this command to get an idea about which values you want to choose:
parted -s /dev/block/mmcblk0 print

Since you want 1.5 and 1gb(why? even full gapps will fit into 700-800mb) you may want to reduce the sdcard size and give it back to userdata.
 
  • Like
Reactions: GuseppiGuliano
sry, I didn't know I'm a live supporter :D
You have to edit these lines:

Code:
ui_print "parted: create"
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 336MB 1176MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 1176MB 2016MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2016MB 2419MB || return 1
    parted -s /dev/block/mmcblk0 mkpartfs primary ext2 2419MB 5570MB || return 1

these are just from-to values.
you can view your current partition table with this command to get an idea about which values you want to choose:
parted -s /dev/block/mmcblk0 print

Since you want 1.5 and 1gb(why? even full gapps will fit into 700-800mb) you may want to reduce the sdcard size and give it back to userdata.
Thanks for the quick reply man, but I want to ask one more thing:
I have taken a full backup using your recovery CWM 6.0.4.8 of both the System 1 and System 2. Will anything happen if I restore both the Systems after executing the script ("repartition.sh")

Thanks,
GuseppiGuliano
 
Thanks for the quick reply man, but I want to ask one more thing:
I have taken a full backup using your recovery CWM 6.0.4.8 of both the System 1 and System 2. Will anything happen if I restore both the Systems after executing the script ("repartition.sh")

Thanks,
GuseppiGuliano
No because CWM restores files into partitions(by name) so it doesn't matter how big they are or which number they have.

BTW never touch anything <=aboot(9). If you have low level restore you can go down to sbl3(5) :p
and backup your m9kefs* partitions :)
 
@M1cha
I did not understand a single freaking word of this:
BTW never touch anything <=aboot(9). If you have low level restore you can go down to sbl3(5) :p
and backup your m9kefs* partitions :)
clear.png
LOL :D
 
@M1cha
I did not understand a single freaking word of this:

LOL :D
Let me check my M1cha<->English dictionary :D
If you dump the partition table you'll see that the partitions have numbers.
and the partitions 3-9 are important to boot to bootloader.
That's why you shouldn't resize them or anything else :p

But if you have a way to use QHSUSB_DLOAD(via shorting), you could change 6-9, too :p
 
Let me check my M1cha<->English dictionary :D
If you dump the partition table you'll see that the partitions have numbers.
and the partitions 3-9 are important to boot to bootloader.
That's why you shouldn't resize them or anything else :p

But if you have a way to use QHSUSB_DLOAD(via shorting), you could change 6-9, too :p
I told u to commit geek language to aosp so phone will translate it
9yre6a5a.jpg


Sent from my mi²s
 
Hi guys, I tried to apply the repartition script with the instructions from OP and this happened. Did I something wrong? Thanks for your help ;) I have Xiaomi Mi2S 32Gb with MIUI on both systems.

fco507.jpg
 
Yes, like more people did including myself.

Before applying the script, go into recovery. In there follow the same steps you would do when installing a zip from your sdcard. Only the last step, the actual selection of the zip you are not able to complete as you simply do not have a zip file to install.

By going through these steps you are actually mounting your sdcard what is needed to make the script work.

From here you can simply run the script as you did before and it should work.
 
  • Like
Reactions: silverbath