[SCRIPT] Fix partition table for Android 4.4


C:\adb>adb devices
List of devices attached
4e3f727 recovery

C:\adb> adb push repartition.sh /tmp
739 KB/s (3031 bytes in 0.004s)

C:\adb> adb shell chmod 0777 /tmp/repartition.sh

C:\adb>adb shell sh /tmp/repartition.sh

Sent from my nexus 7

/tmp/repartition.sh: line 115: can't create /sdcard/parted_04-07-2014-B678725235 05AD164B0B3D2D0CB382CF: nonexistent directory Failed dumping table

Thanks for the answer but this is my problem.
 
Just want to share my experience...


I tried this but modified script to get my own partition size:

840mb system
3mb system1
430 cache
8gb userdata

everything worked great! but I forgot to reboot into recovery before flashing anything... so I got stuck at MI logo.

I solved this problem by using fastboot command:

fastboot boot recovery.img


where recovery.img was on the same folder as fastboot.exe on my pc and was pulled out from cwm-recovery.zip


I post it because I was trying to find the solution without testpoint + Miflash as suggested m1cha and looking into fastboot commands there was the solution.


Hope it can help anybody with same problem.
 
  • Like
Reactions: cbpbxecmecmbeh
Tried using the script, but I got the following errors:
cmd.png
I can't boot into my phone now, CWM gives error messages pretty much all the time now. Does anyone know what to do? Would hate to have to use my phone as a paperweight now :(

My PC runs Windows 8 x64 and the phone is a Xiaomi Mi2 (16GB).
 
Tried using the script, but I got the following errors:
View attachment 7671
I can't boot into my phone now, CWM gives error messages pretty much all the time now. Does anyone know what to do? Would hate to have to use my phone as a paperweight now :(

My PC runs Windows 8 x64 and the phone is a Xiaomi Mi2 (16GB).

Try using fastboot to flash recovery again and boot into it. Then follow this guide to do it manually.

http://xiaomi.eu/community/threads/mi2s-extending-size-of-storage-partition.21391/
 
Tried using the script, but I got the following errors:
View attachment 7671
I can't boot into my phone now, CWM gives error messages pretty much all the time now. Does anyone know what to do? Would hate to have to use my phone as a paperweight now :(

My PC runs Windows 8 x64 and the phone is a Xiaomi Mi2 (16GB).
Goooooood your phone is gone...
Do this:
1- Miflash
Boot into cwm (latest)
From adb run : reboot dload
It will reboot into a black screen
Install and open up miflash
Run it (if asked phone is already in download mode)
Miflash will rewrite partitions table and all partitions

2-Fastboot packages (not sure it will fix it)
Boot into bootloader
Use any fastboot package that you can find in this forum to recover your phone.


Try using fastboot to flash recovery again and boot into it. Then follow this guide to do it manually.

http://xiaomi.eu/community/threads/mi2s-extending-size-of-storage-partition.21391/
His partition table is gone. He needs to rewrite it. This way won't work

Sent from my mi2
 
  • Like
Reactions: P-Sign
Goooooood your phone is gone...
Do this:
1- Miflash
Boot into cwm (latest)
From adb run : reboot dload
It will reboot into a black screen
Install and open up miflash
Run it (if asked phone is already in download mode)
Miflash will rewrite partitions table and all partitions

2-Fastboot packages (not sure it will fix it)
Boot into bootloader
Use any fastboot package that you can find in this forum to recover your phone.



His partition table is gone. He needs to rewrite it. This way won't work

Sent from my mi2
Got an error using MiFlash, a file was missing. Can't boot at all right now.

Will try the fastboot tomorrow.
 
D:\DOwnloads>adb shell /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-14-2014-3D5E05C1A9
1E04ED484D20B0BC3732DA: nonexistent directory
Failed dumping table

Anything wrong????
 
OK got it Working...
Need to Mount SDCARD....

though its dangerous...

D:\DOwnloads>adb shell
~ # parted /dev/block/mmcblk0
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) print
print
print
Model: MMC SEM32G (sd/mmc)
Disk /dev/block/mmcblk0: 31.3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number Start End Size File system Name Flags
1 17.4kB 89.1MB 89.1MB fat16 modem
2 89.1MB 178MB 89.1MB fat16 modem1
3 178MB 179MB 524kB sbl1
4 179MB 179MB 524kB sbl2
5 179MB 180MB 1049kB sbl3
6 180MB 181MB 1049kB rpm
7 181MB 182MB 1049kB tz
8 182MB 183MB 524kB DDR
9 183MB 187MB 4194kB aboot
10 187MB 188MB 1049kB misc
11 188MB 191MB 2990kB logo
12 191MB 192MB 799kB m9kefs1
13 192MB 193MB 799kB m9kefs2
14 193MB 193MB 1024B m9kefsc
15 193MB 201MB 8501kB bk1
16 201MB 202MB 799kB m9kefs3
17 202MB 268MB 66.3MB bk2
18 268MB 284MB 15.7MB boot
19 284MB 300MB 15.7MB boot1
20 300MB 316MB 15.7MB recovery
21 316MB 327MB 11.5MB bk3
22 327MB 336MB 8389kB ext4 persist
23 336MB 1176MB 840MB ext2 system
24 1176MB 2016MB 840MB ext4 system1
25 2016MB 2419MB 403MB ext4 cache
26 2419MB 5570MB 3151MB ext4 userdata
27 5570MB 31.3GB 25.7GB ext4 storage

(parted)
 
D:\DOwnloads>adb shell /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-14-2014-3D5E05C1A9
1E04ED484D20B0BC3732DA: nonexistent directory
Failed dumping table

Anything wrong????
got the same problem...how to mount sdcard?
 
So un-tick some permissions (which?) of /sdcard?

OMG,just open build in file manager (inside recovery) and execute script.

If you want I can provide you modified script,with modified values even if you want but please try what I told you first.
 
XperianPRO, everything is easy when you know what you are looking for.
I had the SD moutning issue when I manually modified the partition tables issue as well in the past so this one triggered my attention. ( running unmodified now as the script didnt work for me )

inside recovery ( CWM) I do not see a file manager or leave alone build.
so probably I am looking at the wrong spot and maybe Gonewild as well.
 
XperianPRO, everything is easy when you know what you are looking for.
I had the SD moutning issue when I manually modified the partition tables issue as well in the past so this one triggered my attention. ( running unmodified now as the script didnt work for me )

inside recovery ( CWM) I do not see a file manager or leave alone build.
so probably I am looking at the wrong spot and maybe Gonewild as well.
just go to recovery-->open system1-->open install zip-->open choose zip from /storage/sdcard (this mount)-->use micha instructions
 
XperianPRO, everything is easy when you know what you are looking for.
I had the SD moutning issue when I manually modified the partition tables issue as well in the past so this one triggered my attention. ( running unmodified now as the script didnt work for me )

inside recovery ( CWM) I do not see a file manager or leave alone build.
so probably I am l
 
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.