[Q] How do I edit/restore the mmcblk0 partition.

Search This thread

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
I have used esfdisk and fdisk and determined my boot loops are caused by a corrupted partition: mmcblk0. The size is incorrect, 30539776 and should be 30535680. As a result other partitions are overlapped, e.i: e2fsck:

* Device or resource busy while trying to open /dev/block/mmcblk0p37
Filesystem mounted or opened exclusively by another program?

* e2fsck: Superblock invalid, trying backup blocks...
2fsck: Bad magic number in super-block while trying to open /dev/block/mmcblk0p24

The size of all other partitions are correct but maligned. I believe if I can correct partition mmcblk0, the others will not overlap. Does anyone have the savvy to show me how? I've tried sdparted with no success. Thanks
 

donkeykong1

Senior Member
Aug 6, 2012
3,901
2,133
Sesvete, Zagreb
I have used esfdisk and fdisk and determined my boot loops are caused by a corrupted partition: mmcblk0. The size is incorrect, 30539776 and should be 30535680. As a result other partitions are overlapped, e.i: e2fsck:

* Device or resource busy while trying to open /dev/block/mmcblk0p37
Filesystem mounted or opened exclusively by another program?

* e2fsck: Superblock invalid, trying backup blocks...
2fsck: Bad magic number in super-block while trying to open /dev/block/mmcblk0p24

The size of all other partitions are correct but maligned. I believe if I can correct partition mmcblk0, the others will not overlap. Does anyone have the savvy to show me how? I've tried sdparted with no success. Thanks
I think you need to be s-off in order to edit mmcblk artitions. If you are s-off you can push the partition with dd comand in fastboot but but you need non corrupted one
 

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Seems logical. I've been trying to gain S-OFF for days, but on my mac, adb recognizes the device as offline, using various roms. I'm going to use a pc today and attempt to apply firewater or rumrunner. I suppose getting an uncorrupted partition wouldn't be difficult if I could get one donated here. Otherwise, a disk editor (sdparted) might also work.

Thanks for your interest.
 

donkeykong1

Senior Member
Aug 6, 2012
3,901
2,133
Sesvete, Zagreb
Seems logical. I've been trying to gain S-OFF for days, but on my mac, adb recognizes the device as offline, using various roms. I'm going to use a pc today and attempt to apply firewater or rumrunner. I suppose getting an uncorrupted partition wouldn't be difficult if I could get one donated here. Otherwise, a disk editor (sdparted) might also work.

Thanks for your interest.
I could send you my partition, that's the least of your priblems. I had corrupted mmcblk09 and it took me around 1 minute to flash a good one with dd. But I'm s-off
 

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Yes you can! Ican probably install it using sdparted without gaining s-off. If you could provide the mmcblk0, I'll at least have that to work with. I've installed mmcblk0p27 using sdparted with success. Thanks!

Here's the code from user harshdev in another forum: while in custom recovery:
Code:
adb push mmcblk0p19_repaired.img /tmp/

adb shell dd if=/tmp/mmcblk0p19_repaired.img of=/dev/block/mmcblk0p19

adb reboot bootloader
 
Last edited:

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
@donkeykong1
Here's my fdisk readout on mmcblk0. How does this compare to yours:
~ # fdisk /dev/block/mmcblk0

The number of cylinders for this disk is set to 3817472.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: deleting partitions after 60

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/block/mmcblk0: 31.2 GB, 31272730624 bytes
1 heads, 16 sectors/track, 3817472 cylinders, total 61079552 sectors
Units = sectors of 1 * 512 = 512 bytes
isk /dev/block/mmcblk0: 31.2 GB, 31272730624 bytes
1 heads, 16 sectors/track, 3817472 cylinders, total 61079552 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 256 128 4d Unknown
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 257 768 256 51 Unknown
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 769 262110 130671 5d Unknown
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 262111 61079550 30408720 5 Extended ------------------------------> should be 1mb
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 262112 262143 16 5a Unknown
/dev/block/mmcblk0p6 262145 262656 256 73 Unknown
/dev/block/mmcblk0p7 262658 293812 15577+ 5b Unknown
/dev/block/mmcblk0p8 293814 294325 256 5c Unknown
/dev/block/mmcblk0p9 294327 296374 1024 45 Unknown
/dev/block/mmcblk0p10 296376 296887 256 47 Unknown
/dev/block/mmcblk0p11 296889 300984 2048 46 Unknown
/dev/block/mmcblk0p12 300986 305146 2080+ 4c Unknown
/dev/block/mmcblk0p13 305148 315387 5120 34 Unknown
/dev/block/mmcblk0p14 315389 317436 1024 36 Unknown
/dev/block/mmcblk0p15 317438 319485 1024 0 Empty
/dev/block/mmcblk0p16 319487 442368 61441 50 Unknown
/dev/block/mmcblk0p17 442370 458750 8190+ 74 Unknown
/dev/block/mmcblk0p18 458752 524287 32768 0 Empty
/dev/block/mmcblk0p19 524289 526333 1022+ 76 Unknown
/dev/block/mmcblk0p20 526335 534526 4096 4a Unknown
/dev/block/mmcblk0p21 534528 542719 4096 4b Unknown
/dev/block/mmcblk0p22 542721 583680 20480 19 Unknown
/dev/block/mmcblk0p23 583682 583689 4 0 Empty
/dev/block/mmcblk0p24 583691 584202 256 23 Unknown
/dev/block/mmcblk0p25 584204 584235 16 0 Empty
/dev/block/mmcblk0p26 584237 586797 1280+ 0 Empty
/dev/block/mmcblk0p27 586799 586926 64 0 Empty
/dev/block/mmcblk0p28 586928 588975 1024 0 Empty
/dev/block/mmcblk0p29 588977 786431 98727+ 0 Empty
/dev/block/mmcblk0p30 786433 894973 54270+ 0 Empty
/dev/block/mmcblk0p31 894975 1048575 76800+ 77 Unknown
/dev/block/mmcblk0p32 1048577 1245182 98303 0 Empty
/dev/block/mmcblk0p33 1245184 1277951 16384 48 Unknown
/dev/block/mmcblk0p34 1277953 1310719 16383+ 71 Unknown
/dev/block/mmcblk0p35 1310721 5111806 1900543 83 Linux
/dev/block/mmcblk0p36 5111808 6422526 655359+ 83 Linux
/dev/block/mmcblk0p37 6422528 60948479 27262976 83 Linux
 
Last edited:

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,741
7,571
53
Beirut
No luck editing the size of mmcblk0p4. Edits won't stay and reverts back.

Anyone know how to do this?

I'm pretty sure you won't be able to change your partition layout without S-OFF, but aren't you jumping the gun a little? (and potentially bricking your device completely!!)

Why don't you first explain what the problem is.

BTW, on the m7_u/ul the only EXT partitions are
/dev/block/mmcblk0p35 /system
/dev/block/mmcblk0p36 /cache
/dev/block/mmcblk0p37 /data

so you can only use e2fsck on these partitions, all the others are RAW partitions.

please post a
1) "fastboot getvar all" (excluding IMEI and s/n)
2) what custom recovery (and version) you are using (cause looks like you're on CWM, and you should probably be using TWRP)
3) what ROM are you using/want to use
4) what is the problem
 

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Right! I need to gain s-off for this to stick. The device was soft bricked when I acquired it and is unable to run sense and cm10.1 without boot looping. I have gained a only slight improvements. I've installed an original/compatible RUU sense and it boot loops like the others. Only cm11 (aosb_kk_1.3.6_m7) runs but with crippled resources, i.e., no gps, no phone radio, no google sync or location sync, widget won't stay after reboot, etc, etc. The version main: is not shown, the imei or phone hardversion is not present in phone info. I'm using the latest TWRP.

There are overlapping partitions in 1,2,3 and 4. I had hoped that parted would repair this, but returns the error: You can't have overlapping partitions.

Partition 1 does not end on cylinder boundary
Partition 1: sector 0 greater than maximum 16
Partition 2 does not end on cylinder boundary
Partition 2: sector 0 greater than maximum 16
Partition 3 does not end on cylinder boundary
Partition 3: sector 0 greater than maximum 16
Partition 5: sector 0 greater than maximum 16
Partition 6: sector 0 greater than maximum 16
Partition 7: sector 0 greater than maximum 16
Partition 8: sector 0 greater than maximum 16
Partition 9: sector 0 greater than maximum 16
Partition 10: sector 0 greater than maximum 16
Partition 11: sector 0 greater than maximum 16
Partition 12: sector 0 greater than maximum 16
Partition 13: sector 0 greater than maximum 16
Partition 14: sector 0 greater than maximum 16
Partition 16: sector 0 greater than maximum 16
Partition 17: sector 0 greater than maximum 16
Partition 19: sector 0 greater than maximum 16
Partition 20: sector 0 greater than maximum 16
Partition 21: sector 0 greater than maximum 16
Partition 22: sector 0 greater than maximum 16
Partition 24: sector 0 greater than maximum 16
Partition 31: sector 0 greater than maximum 16
Partition 33: sector 0 greater than maximum 16
Partition 34: sector 0 greater than maximum 16
Partition 35: sector 0 greater than maximum 16
Partition 36: sector 0 greater than maximum 16
Partition 37: sector 0 greater than maximum 16
Partition 38: sector 0 greater than maximum 16
Warning: partition 5 overlaps partition 38
Partition 39: sector 0 greater than maximum 16
Warning: partition 6 overlaps partition 39
Partition 40: sector 0 greater than maximum 16
Warning: partition 7 overlaps partition 40
Partition 41: sector 0 greater than maximum 16
Warning: partition 8 overlaps partition 41
Partition 42: sector 0 greater than maximum 16
Warning: partition 9 overlaps partition 42
Partition 43: sector 0 greater than maximum 16
Warning: partition 10 overlaps partition 43
Partition 44: sector 0 greater than maximum 16
Warning: partition 11 overlaps partition 44
Partition 45: sector 0 greater than maximum 16
Warning: partition 12 overlaps partition 45
Partition 46: sector 0 greater than maximum 16
Warning: partition 13 overlaps partition 46
Partition 47: sector 0 greater than maximum 16
Warning: partition 14 overlaps partition 47
Partition 49: sector 0 greater than maximum 16
Warning: partition 16 overlaps partition 49
Partition 50: sector 0 greater than maximum 16
Warning: partition 17 overlaps partition 50
Partition 52: sector 0 greater than maximum 16
Warning: partition 19 overlaps partition 52
Partition 53: sector 0 greater than maximum 16
Warning: partition 20 overlaps partition 53
Partition 54: sector 0 greater than maximum 16
Warning: partition 21 overlaps partition 54
Partition 55: sector 0 greater than maximum 16
Warning: partition 22 overlaps partition 55
Partition 57: sector 0 greater than maximum 16
Warning: partition 24 overlaps partition 57

~ # cat /proc/partitions
major minor #blocks name

179 0 30539776 mmcblk0
179 1 128 mmcblk0p1
179 2 256 mmcblk0p2
179 3 130671 mmcblk0p3
179 4 1 mmcblk0p4

These are stock values:

179 0 30535680 mmcblk0
179 1 128 mmcblk0p1 sbl1
179 2 256 mmcblk0p2 sbl2
179 3 130671 mmcblk0p3 pg1fs
179 4 1 mmcblk0p4 ?
179 5 16 mmcblk0p5 board_info

I've managed to recover mmcblk0p4 since my previous posts. Here's my getvar:

INFOversion: 0.5
INFOversion-bootloader: 1.55.0000
INFOversion-baseband: 4A.19.3263.13
INFOversion-cpld: None
INFOversion-microp: None
INFOversion-main:
INFOversion-misc: PVT SHIP S-ON
INFOserialno: XXXXXXXXXX
INFOimei: XXXXXXXXXXXX
INFOmeid: 00000000000000
INFOproduct: m7_ul
INFOplatform: HBOOT-8064
INFOmodelid: PN0712000
INFOcidnum: CWS__001
INFObattery-status: good
INFObattery-voltage: 4323mV
INFOpartition-layout: Generic
INFOsecurity: on
INFObuild-mode: SHIP
INFOboot-mode: FASTBOOT
INFOcommitno-bootloader: dirty-2da61e5e88
INFOhbootpreupdate: 11
INFOgencheckpt: 0

Thanks for your reply. Admittedly, I'm no dev and I sometimes get lost trying to wrap my head around all this!
 
Last edited:

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,741
7,571
53
Beirut
INFOversion-bootloader: 1.55.0000
INFOversion-baseband: 4A.19.3263.13
INFOversion-main:
INFOversion-misc: PVT SHIP S-ON
INFOproduct: m7_ul
INFOmodelid: PN0712000
INFOcidnum: CWS__001

well, i haven't run parted/gparted/etc. too risky, way too easy to fully brick your device, but i can tell you that the Start/End/Size/Id of all your partitions are exactly the same as mine, except p4, which was due to the overall size difference (but which didn't affect all the other partitions!!!)

Have you tried this ruu: http://androidruu.com/getdownload.p...13_10.38j.1157.04_release_334235_signed_2.exe
 

clsA

Senior Member
Aug 28, 2010
9,912
3,535
Central Florida
Have to agree with nkk71 here. You have a normal AT&T phone, it should be easy to RUU back to stock from your current settings.

relock bootloader
fastboot oem lock
Run the 3.17.502.3 RUU and you should be all set
 

davidrol

Senior Member
Aug 24, 2009
316
43
Brooksville, FL
Installing an RUU didn't solve restoring all partitions, only a small portion. The upper (1-5) is where the overlap occurred and RUU's dont' effect those partitions, at all. I deleted mmcblk0p4, because it was way too large and should be 1MB. After, a few restarts and 3 attempts at gaining s-off with firewater, the phone now functions correctly! I have tested and confirm a working GPS, phone radio recognizing sim, google sync, etc, etc. The imei and broadband version show correctly in phone info. I cant explain or fully understand why it's fully working. I will examine the partitions again and post the results.

BTW, I haven't tried installing a sense rom (current Android Revolution) to check for the constant boot loops I was getting.

Next step would be to sim unlock and test phone reception and signal strength.

I thank you all for your assistance.
 

nkk71

Inactive Recognized Developer / Contributor
May 26, 2010
8,741
7,571
53
Beirut
Installing an RUU didn't solve restoring all partitions, only a small portion. The upper (1-5) is where the overlap occurred and RUU's dont' effect those partitions, at all. I deleted mmcblk0p4, because it was way too large and should be 1MB. After, a few restarts and 3 attempts at gaining s-off with firewater, the phone now functions correctly! I have tested and confirm a working GPS, phone radio recognizing sim, google sync, etc, etc. The imei and broadband version show correctly in phone info. I cant explain or fully understand why it's fully working. I will examine the partitions again and post the results.

BTW, I haven't tried installing a sense rom (current Android Revolution) to check for the constant boot loops I was getting.

Next step would be to sim unlock and test phone reception and signal strength.

I thank you all for your assistance.

hmm, interesting, I've never seen that done before, but just for info:
fdisk -ul
Code:
...
/dev/block/mmcblk0p4 262111 61071358 30404624 5 Extended
...
the rest are exactly like the ones you posted earlier.

but if you actually "dd" the partition, you'll get a 1KB (not MB) file, which starting ot offset 0x200 (ie 1 block) shows the HTC-BOARD-INFO from p5

so seems p4 is only 1 block plus some kind of container for the rest of the partitions.


Anyway, very glad that worked out for :good:

PS: and you were able to change the partition layout with S-ON.... didn't / don't think that's possible