[Xiaomi Redmi 2 Guides, News, & Discussion] jsidney96:
Here is a guide to resize and repartition your redmi 2 emmc

Download and uncompress the attached View attachment 4162703 file

Download attached View attachment 4162702

Download latest twrp

Reeboot to bootloader(fastboot) and flash latest twrp

fastboot flash recovery twrp-3.1.1-0-wt88047.img

boot to the new twrp

fastboot boot twrp-3.1.1-0-wt88047.img

Copy the "parted" binary into your sdcard.

Use your file manager make new directory parted in sd card aand copy parted executable there.

now connect with adb:

adb shell

Change directory to external_sd/parted/ (where we copied the parted binary)

cd external_sd/parted/

Give permission to execute:

chmod +x parted

Use blkid to list out devices. My emmc is listed as

"/dev/block/mmcblk0" it should be same on all other devices too, its ok even if it is different

blkid

View attachment 4162723

now use parted command

./parted /dev/block/mmcblk0

Use option

p

to printout partition table

View attachment 4162725

we need to remove all partitions starting from 23 and recreate them. But when we recreate , everything except system and userdata should have the exact same number of sectors that they had before otherwise it wont boot.

use

u

to change units type in when it asks the unit

s

(for sectors)

here are the dfault sector sizes.... they should be same when we recreate them

24 655360s cache

25 6553 persist

26 65536s recovery

27 1024s keystore

28 64s config

29 131072s oem

View attachment 4162728

now remove all partitions upto system .

unmount /system and /data and /cache from twrp mounts menu before proceeding

rm 30
rm 29
rm 28
rm 27
rm 26
rm 25
rm 24
rm 23

View attachment 4162729

now we need to recreate partition table , first is system

syntax:

mkpart system ext4 [start sector] [end sector]

start sector is the end sector of the previous partition +1

for me its :

461919s+1s=461920s

each sector is 512B so calculate how many sectors you want.

for me resizing system to 1.2GB

1.2GB*1024*1024*1024=1288490188.8bytes

1288490188.8bytes/512bytes=2516582.4sectors

round it up 2516583s

end sector= required number of sectors +start sector -1s

=2516583s+461920s -1s =2978503s -1s

so my command is :

mkpart system 461920s 2978502s

due to bug in this parted name of partition was not set....

set it manually:

name 23 system

now create cache partion:

use p (print partition table) to find out start sectors

end sector=start sector+655360s -1s (refer table i posted, or your default partition table)

=2978503s+655360s-1s=3633862s

use:

mkpart cache 2978503s 3633862s

rename partition:

name 24 cache

similar way create persist:

end sector=start sector + 65536s -1s

mkpart persist 3633863s 3699398s

name persist:

name 25 persist

create recovery:

end sector=start sector + 65536s -1s

mkpart recovery 3699399s 3764934s

name 26 recovery

create partition keystore :

end sector=start sector + 1024s -1s

mkpart keystore 3764935s 3765958s

name 27 keystore

create partition config:

end sector=start sector + 64s -1s

mkpart config 3765959s 3766022s

name 28 config

create partition oem :

end sector =startsector + 131072s -1s

mkpart oem 3766023s 3897094s

name 29 oem

now create the last partition userdata ... userdata will shrink by as much as you increased in your system:

mkpart userdata 3897095s 100%

name 30 userdata

exit parted by typing

q

format the partitions /system(23) /cache(24) /persist(25) /userdata(30) :

make_ext4fs /dev/block/mmcblk0p23
make_ext4fs /dev/block/mmcblk0p24
make_ext4fs /dev/block/mmcblk0p25
make_ext4fs /dev/block/mmcblk0p30

run parted again and use p ,your partition table should look similar to this:

./parted /dev/block/mmcblk0

Use option

p

to printout partition table

View attachment 4162739

exit parted by typing

q

use command:

reboot bootloader

to boot into bootloader/fastboot

flash recovery:

fastboot flash recovery twrp-3.1.1-0-wt88047.img

flash persist:

fastboot flash persist persist.img

booot to recovery and reboot recovery:

fastboot boot twrp-3.1.1-0-wt88047.img

now you can flash any custom rom

please remember that some custom roms have a fixed system size and therefore you will have to resize the partition after installing rom from the twrp wipe menu/repair partition menu

Download links:

twrp: https://dl.twrp.me/wt88047/

parted: see attachment

persist: see attachment

Hope this helps :)

To revert to stock partition table :

download attachment extract and flash via fastboot:

View attachment 4162967

fastboot flash partition gpt_both0.bin