• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

[wt88047] Redmi 2 -Resize system partition

Search This thread

jsidney96

Senior Member
Feb 17, 2017
112
62
kozhikkode
Here is a guide to resize and repartition your redmi 2 emmc

Download and uncompress the attached View attachment parted.zip file
Download attached View attachment persist.img
Download latest twrp

Reeboot to bootloader(fastboot) and flash latest twrp

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

boot to the new twrp

Code:
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:

Code:
adb shell

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

Code:
cd external_sd/parted/

Give permission to execute:
Code:
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

Code:
blkid
View attachment 4162723
now use parted command

Code:
./parted /dev/block/mmcblk0
Use option
Code:
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
Code:
u
to change units type in when it asks the unit
Code:
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

Code:
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 :
Code:
mkpart system  461920s 2978502s

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

Code:
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:
Code:
mkpart cache  2978503s  3633862s

rename partition:

Code:
name 24 cache


similar way create persist:
end sector=start sector + 65536s -1s

Code:
mkpart persist 3633863s 3699398s

name persist:

Code:
name 25 persist


create recovery:
end sector=start sector + 65536s -1s


Code:
mkpart recovery 3699399s 3764934s
Code:
name 26 recovery

create partition keystore :
end sector=start sector + 1024s -1s

Code:
mkpart keystore 3764935s  3765958s

Code:
name 27 keystore

create partition config:
end sector=start sector + 64s -1s

Code:
mkpart config 3765959s 3766022s
Code:
name 28 config

create partition oem :
end sector =startsector + 131072s -1s

Code:
mkpart oem 3766023s 3897094s
Code:
name 29 oem

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

Code:
mkpart userdata 3897095s 100%
Code:
name 30 userdata

exit parted by typing
Code:
q

format the partitions /system(23) /cache(24) /persist(25) /userdata(30) :
Code:
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:
Code:
./parted /dev/block/mmcblk0
Use option
Code:
p
to printout partition table

View attachment 4162739

exit parted by typing
Code:
q

use command:
Code:
reboot bootloader
to boot into bootloader/fastboot

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

flash persist:
Code:
fastboot flash persist persist.img

booot to recovery and reboot recovery:

Code:
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 gpt_both0.zip
Code:
fastboot flash partition gpt_both0.bin
 
Last edited:

inunxelex

Senior Member
Mar 15, 2008
370
186

jriosa

Member
May 28, 2017
11
0
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)

This is the result:
Code:
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
Code:
~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
p
Model: MMC HAG2e (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 67.1MB 134MB 67.1MB fat16 modem
2 134MB 135MB 524kB sbl1
3 135MB 135MB 524kB sbl1bak
4 135MB 136MB 1049kB aboot
5 136MB 137MB 1049kB abootbak
6 137MB 138MB 524kB rpm
7 138MB 138MB 524kB rpmbak
8 138MB 139MB 524kB tz
9 139MB 139MB 524kB tzbak
10 139MB 140MB 524kB hyp
11 140MB 141MB 524kB hypbak
12 141MB 142MB 1049kB pad
13 142MB 143MB 1573kB modemst1
14 143MB 145MB 1573kB modemst2
15 145MB 146MB 1049kB misc
16 146MB 146MB 1024B fsc
17 146MB 146MB 8192B ssd
18 146MB 156MB 10.5MB splash
19 201MB 201MB 32.8kB DDR
20 201MB 203MB 1573kB fsg
21 203MB 203MB 16.4kB sec
22 203MB 237MB 33.6MB boot
23 237MB 1310MB 1074MB system
24 1310MB 1646MB 336MB cache
25 1646MB 1679MB 33.6MB ext4 persist
26 1679MB 1713MB 33.6MB recovery
27 1745MB 1745MB 524kB keystore
28 1745MB 1745MB 32.8kB config
29 1745MB 1812MB 67.1MB oem
30 1879MB 15.8GB 13.9GB userdata
Code:
(parted) rm 30                                                            
rm 30
(parted) rm 29                                                            
rm 29
(parted) rm 28                                                            
rm 28
(parted) rm 27                                                            
rm 27
(parted) rm 26                                                            
rm 26
(parted) rm 25                                                            
rm 25
(parted) rm 24                                                            
rm 24
(parted) rm 23                                                            
rm 23
(parted) mkpart system 461920s 2978502s
mkpart system 461920s 2978502s
Warning: You requested a partition from 461920s to 2978502s.
The closest location we can manage is 3345504s to 3345504s.
Is this still acceptable to you?
Yes/No? Yes

I think that rm 30, ... rm 23 dose not delete de partitions

Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s                                
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]                
(parted) name 26 recovery


[email protected] ~/Descargas/Redmi 2 $ adb shell
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
~ # blkid
/dev/block/mmcblk0p25: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="00BC-614E" TYPE="vfat"
/dev/block/mmcblk1p1: UUID="62E9-39D9" TYPE="vfat"
~ # mount -a
mount: mounting /dev/block/mmcblk0p23 on /system failed: Invalid argument
mount: mounting /dev/block/mmcblk0p30 on /data failed: Invalid argument
mount: mounting /dev/block/mmcblk0p24 on /cache failed: Invalid argument
mount: mounting /dev/block/mmcblk0p25 on /persist failed: Invalid argument

mount: mounting /usb_otg on auto failed: No such file or directory
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd
/dev/block/mmcblk0p1 64.0M 44.6M 19.4M 70% /firmware
~ # umount /firmware/
~ # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 944.7M 188.0K 944.6M 0% /dev
tmpfs 944.7M 344.0K 944.4M 0% /tmp
/dev/block/mmcblk1p1 29.0G 14.9G 14.0G 52% /external_sd

Do you think how can I format the disk and regenerate partitions to install a new rom?

Best regards, Julio.
 
Last edited:

ViDroidL

Member
Nov 7, 2014
20
17
Jakarta Timur
Back to default

I execute the 1.5gb system partition file on post, and work... after i flash custom rom based lineage os, my system partition is back to default, how to fix it ? i repair via wipe menu partition it doesn't work...

help, :confused:

or what rom support custom partition ??
 

jsidney96

Senior Member
Feb 17, 2017
112
62
kozhikkode
Hello I try to follow your guide to try to format my internal sd and try to install a new rom (nor only boots withe fastboot)

This is the result:
Code:
~ # blkid

Code:
~ # parted /dev/block/mmcblk0

Code:
(parted) rm 30                                                            
rm 30
(parted) rm 29                                                            
rm 29
(parted) rm 28                                                            
rm 28
(parted) rm 27                                                            
rm 27
(parted) rm 26                                                            
rm 26
(parted) rm 25                                                            
rm 25
(parted) rm 24                                                            
rm 24
(parted) rm 23                                                            
rm 23


I think that rm 30, ... rm 23 dose not delete de partitions

Another error is
Code:
name 25 persist
(parted) mkpart recovery 3699399s 3764934s                                
mkpart recovery 3699399s 3764934s
[B]Error: Unable to satisfy all constraints on the partition.[/B]                
(parted) name 26 recovery




Do you think how can I format the disk and regenerate partitions to install a new rom?

Best regards, Julio.

I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom
 

jriosa

Member
May 28, 2017
11
0
I dont understand what your problem is.... Reduce the quotings and please concentrate on your problem... To fix your partitiontable you can flash the gpt_both0.bin or flash a fastboot rom

Hello, thanks for your help.

I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result
target reported max download size of 268435456 bytes
sending 'partition' (33 KB)...
OKAY [ 0.005s]
writing 'partition'...
FAILED (remote: failed to write partition)
finished. total time: 0.027s

I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.

I do not know how can I unlock the internal disk and format the disk and install a new operating system.

Best regards.

Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:

A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard

But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.
 
Last edited:

capstayn

Member
Jul 14, 2016
5
0
Hi, I am in the same situation as @jriosa, with a redmi 2. Moreover, when using parted, having rooted and given permissions, the commands
Code:
rm <partition_number>
even though they don't throw any error, don't remove the targeted partitions.

Is there anything we could do to unbrick our phones? Any help will be really appreciated. Thanks!
 

jsidney96

Senior Member
Feb 17, 2017
112
62
kozhikkode
Hello, thanks for your help.

I have download wt86047_images_5.9.24_20150917.0000.1_4.4_cn version from xiaomi, in the images folder exists the gpt_both0.bin to try to restore the partition disk in my internal sd.
I execute this command in my computer
Code:
fastboot flash partition gpt_both0.bin
and this is the result


I think that the partitions in my internal sd disk is protected and I can not modify and reinstall any OS in this disk.

I do not know how can I unlock the internal disk and format the disk and install a new operating system.

Best regards.

Hello again , I have seen this url http://en.miui.com/thread-439425-1-1.html and say that:

A lot of Redmi 2 prime phones get "encryption failure" / "failed to write partition" after upgrading to miui 8 and the only solution is to change the memory chip/motherboard

But I think that it is a problem of software. Bootloader is locked and I can not modify the structure of disk, and I can not unlocked the bootloader and reformat the disk too. The result is the phone is dead, and I can not use it.

I dont have a solution for this problem, i dont have a wt86047 :(
 

Avinash539

New member
Sep 16, 2018
4
0
My Redmi 2 sdcard and otg not working can it done by only internal storage.
I have tried and from 23 to 29 I have removed but 30 userdata is not removing giving error that first unmount it, when I will unmount it then parted directory will not be accessible.
What to do is there any way without ext sdcard or otg.
Pls help.
 
Last edited:

Ezenh87

New member
Jan 22, 2020
3
0
I used the "fastboot flash partition gpt_both0.bin" code and mi phone got black screen without recovery or fastbtoot boot...just black screen. What can I do?

This is the Console log:
fastboot flash partition gpt_both0.bin
Sending 'partition' (33 KB) OKAY [ 0.011s]
Writing 'partition' OKAY [ 0.046s]
Finished. Total time: 0.061s
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    Here is a guide to resize and repartition your redmi 2 emmc

    Download and uncompress the attached View attachment parted.zip file
    Download attached View attachment persist.img
    Download latest twrp

    Reeboot to bootloader(fastboot) and flash latest twrp

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

    boot to the new twrp

    Code:
    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:

    Code:
    adb shell

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

    Code:
    cd external_sd/parted/

    Give permission to execute:
    Code:
    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

    Code:
    blkid
    View attachment 4162723
    now use parted command

    Code:
    ./parted /dev/block/mmcblk0
    Use option
    Code:
    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
    Code:
    u
    to change units type in when it asks the unit
    Code:
    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

    Code:
    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 :
    Code:
    mkpart system  461920s 2978502s

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

    Code:
    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:
    Code:
    mkpart cache  2978503s  3633862s

    rename partition:

    Code:
    name 24 cache


    similar way create persist:
    end sector=start sector + 65536s -1s

    Code:
    mkpart persist 3633863s 3699398s

    name persist:

    Code:
    name 25 persist


    create recovery:
    end sector=start sector + 65536s -1s


    Code:
    mkpart recovery 3699399s 3764934s
    Code:
    name 26 recovery

    create partition keystore :
    end sector=start sector + 1024s -1s

    Code:
    mkpart keystore 3764935s  3765958s

    Code:
    name 27 keystore

    create partition config:
    end sector=start sector + 64s -1s

    Code:
    mkpart config 3765959s 3766022s
    Code:
    name 28 config

    create partition oem :
    end sector =startsector + 131072s -1s

    Code:
    mkpart oem 3766023s 3897094s
    Code:
    name 29 oem

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

    Code:
    mkpart userdata 3897095s 100%
    Code:
    name 30 userdata

    exit parted by typing
    Code:
    q

    format the partitions /system(23) /cache(24) /persist(25) /userdata(30) :
    Code:
    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:
    Code:
    ./parted /dev/block/mmcblk0
    Use option
    Code:
    p
    to printout partition table

    View attachment 4162739

    exit parted by typing
    Code:
    q

    use command:
    Code:
    reboot bootloader
    to boot into bootloader/fastboot

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

    flash persist:
    Code:
    fastboot flash persist persist.img

    booot to recovery and reboot recovery:

    Code:
    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 gpt_both0.zip
    Code:
    fastboot flash partition gpt_both0.bin
    3
    resize system partition to 1,5gb using fastboot, run partition.bat

    download
    2
    @OP, how to revert back to default system partition? Via fastboot rom or ...? Thank you for providing the method bro!

    i have updated the post to include reverting instructions....
    yes flashing the full fastboot stock rom will revert your partition table to default.
    2
    Will this work on the 8gb model? I mean, is not too big for it?, if it is, can you make a smaller version for 8gb devices?

    Thanks
    yes, but i think 1.5gb is small for 64bit rom

    Do i need to reinstall rom after i did system repartition used this method bro?

    sure, and all your data will be lost