[Q] Another possible way to Install CWM restore partition - Atrix 4G Q&A, Help & Troubleshooting

UPDATE: Just found information at the following link, see below. Looks like you can't get better backup capability without unlocking the boot loader first. Doing so would destroy the DRM keys (No more Netflix's etc...) Guess I will live with my ROOTED Atrix 4G for now..
http://android.stackexchange.com/questions/15314/cant-boot-to-clockwork-recovery-on-atrix-several-methods-tried
My Atrix 4G phone is currently rooted but does NOT have the bootloader unlocked. I do not plan to (at least for the forseeable future) installing different ROM's but I would like to install (if possible) the CWM restore partition. Unlocking the bootloader wipes the device (backups can be performed to restore the wiped information); likewise, the DRM keys are removed during the bootloader unlocking procedure and there MIGHT be ways to restore them (watching streaming video is important to me).
From what I have read on this forum and others, I should be able to load the CWM restore partition WITHOUT unlocking the bootloader. There are a few methods documented to install the CWM werewithall onto the restore partition BUT would something like the following also work?
From an SSH connection to the rooted phone or an "adb shell" command window (via a USB connection between the Atrix and PC) perform the following:
Backup the current restore partition delivered my Motorola via the following command in case something goes wrong.
dd if=/dev/block/mmcblk0p10 of=/sdcard-ext/recovery.img
Copy the recovery.img file to your PC for additional safe keeping.
Zero out the restore partition before installing the new CWM recovery image.
dd if=/dev/zero of=/dev/block/mmcblk0p10
Copy the new cwm.img image to the recovery partition using the following command:
Note the replacement cwm image file can NOT be larger than 8192 blocks with each block being 512 bytes.
8192 * 512 * 2 = 8,388,608 bytes. If the cwm image is to big, I am not sure if the following dd command would write into the p11 boot partition (NOT good). Verify cwm.img size BEFORE issuing the following DD command.
dd if=/sdcard-ext/cwm.img of=/dev/block/mmcblk0p10
In the avent of a problem, you should be able to restore the original Motorola recovery.img to the /dev/block/mmcblk0p10 partition with the following command:
dd if=/sdcard-ext/recovery.img of=/dev/block/mmcblk0p10
FYI follows are the md5sums from my "Atrix 4g" as delivered original factory boot.img and recovery.img
/mnt/sdcard-ext/root_recovery_orig # cat md5sums.txt
bc6c254bd80bed5a9c0d3c7cd5c77b07 boot.img from /dev/block/mmcblk0p11
7580ad9c3bca264a563c13741162d9b8 recovery.img from /dev/block/mmcblk0p10
/mnt/sdcard-ext/root_recovery_orig # ls -al *.img
----rwxr-x 1 system sdcard_r 8388608 Nov 15 13:20 boot.img
----rwxr-x 1 system sdcard_r 8388608 Nov 15 13:19 recovery.img
I assume the factory LOCKED bootloader located on the first partition /dev/block/mmcblk0p1 does NOT effect booting into the new cwm recovery partition via the "adb reboot recovery" command or by holding the volume down while powering on the phone?
When booting into the new CWM recovery partition, what /dev/block/mmcblk0 partitions are mounted? If any partitions are mounted, are they mounted read-only?
Booting from the content of the CWM recovery partition, can I backup/restore the entire /dev/block/mmcblk0 device (all 18 partitions)? Nothing like creating a full device image (with nothing mounted r/w) for when disaster strikes.
Assuming any of the above is valid, I need get the cwm dd image for somewhere (pointers welcome)
Issuing DD commands can be VERY-VERY-VERY dangerous if done wrong. If you do not understand how dd works, PLEASE do NOT attempt anything you read in this post. Until other forum members comment on this post content, I do NOT plan do anything (neither should anyone else!!!!)
Regards, Ron

Request for info from someone with CWM installed in recovery partition
Could I get someone who has CWM working on their Atrix 4G to please run the following command from the su prompt on the smartphone and post the output.
# fdisk -lu /dev/block/mmcblk0
Also please indicate if you have the bootloader unlocked or not.
Regards Ron
rrolsbe said:
My Atrix 4G phone is currently rooted but does NOT have the bootloader unlocked. I do not plan to (at least for the forseeable future) installing different ROM's but I would like to install (if possible) the CWM restore partition. Unlocking the bootloader wipes the device (backups can be performed to restore the wiped information); likewise, the DRM keys are removed during the bootloader unlocking procedure and there MIGHT be ways to restore them (watching streaming video is important to me).
From what I have read on this forum and others, I should be able to load the CWM restore partition WITHOUT unlocking the bootloader. There are a few methods documented to install the CWM werewithall onto the restore partition BUT would something like the following also work?
From an SSH connection to the rooted phone perform the following:
Backup the current restore partition delivered my Motorola via the following command in case something goes wrong.
dd if=/dev/block/mmcblk0p10 of=/sdcard-ext/recovery.img
Copy the recovery.img file to your PC for additional safe keeping.
Zero out the restore partition before installing the new CWM recovery image.
388,608
dd if=/dev/zero of=/dev/block/mmcblkp10
Copy the new cwm.img image to the recovery partition using the following command:
Note the replacement cwm image file can NOT be larger than 8192 blocks with each block being 512 bytes.
8192 * 512 * 2 = 8,388,608 bytes. If the cwm image is to big, I am not sure if the following dd command would write into the p11 boot partition (NOT good). Verify cwm.img size BEFORE issuing the following DD command.
dd if=/sdcard-ext/cwm.img of=/dev/block/mmcblk0p10
In the avent of a problem, you should be able to restore the original Motorola recovery.img to the /dev/block/mmcblk0p10 partition with the following command:
dd if=/sdcard-ext/recovery.img of=/dev/block/mmcblk0p10
I assume the factory LOCKED bootloader located on the first partition /dev/block/mmcblk0p1 does NOT effect booting into the new cwm recovery partition via the "adb reboot recovery" command or by holding the volume down while powering on the phone?
When booting into the new CWM recovery partition, what /dev/block/mmcblk0 partitions are mounted? If any partitions are mounted, are they mounted read-only?
Booting from the content of the CWM recovery partition, can I backup/restore the entire /dev/block/mmcblk0 device (all 18 partitions)? Nothing like creating a full device image (with nothing mounted r/w) for when disaster strikes.
Assuming any of the above is valid, I need get the cwm dd image for somewhere (pointers welcome)
Issuing DD commands can be VERY-VERY-VERY dangerous if done wrong. If you do not understand how dd works, PLEASE do NOT attempt anything you read in this post. Until other forum members comment on this post content, I do NOT plan do anything (neither should anyone else!!!!)
Regards, Ron
Click to expand...
Click to collapse

Another question/Observation
It might be possible that the factory supplied locked bootloader checks the "Digitial Signature" of the recovery partition before booting into recovery mode is allowed??? If this is true, the signature check of the CWM image would FAIL thus requiring an unlock of the boot loader! Hopefullly, dd'ing the original saved recovery.img back onto the recovery partition would at least get back to factory configuration (IE.. allow booting into factory supplied recovery mode)!!
Again, Thanks for any help regarding this post!
Regards, Ron
rrolsbe said:
Could I get someone who has CWM working on their Atrix 4G to please run the following command from the su prompt on the smartphone and post the output.
# fdisk -lu /dev/block/mmcblk0
Also please indicate if you have the bootloader unlocked or not.
Regards Ron
Click to expand...
Click to collapse

Code:
[B]# fdisk -lu /dev/block/mmcblk0[/b]
Disk /dev/block/mmcblk0: 15.9 GB, 15914762240 bytes
1 heads, 16 sectors/track, 1942720 cylinders, total 31083520 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1024 8191 3584 83 Linux
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 8192 9215 512 83 Linux
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 9216 13311 2048 83 Linux
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 13312 31005695 15496192 5 Extended
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 14336 16383 1024 83 Linux
/dev/block/mmcblk0p6 16384 17407 512 83 Linux
/dev/block/mmcblk0p7 17408 18431 512 83 Linux
/dev/block/mmcblk0p8 18432 20479 1024 83 Linux
/dev/block/mmcblk0p9 20480 24575 2048 83 Linux
/dev/block/mmcblk0p10 24576 40959 8192 83 Linux
/dev/block/mmcblk0p11 40960 57343 8192 83 Linux
/dev/block/mmcblk0p12 57344 712703 327680 83 Linux
/dev/block/mmcblk0p13 712704 2285567 786432 83 Linux
/dev/block/mmcblk0p14 2285568 2326527 20480 83 Linux
/dev/block/mmcblk0p15 2326528 3637247 655360 83 Linux
/dev/block/mmcblk0p16 3637248 7831551 2097152 83 Linux
/dev/block/mmcblk0p17 7831552 8538111 353280 83 Linux
/dev/block/mmcblk0p18 8538112 31005695 11233792 83 Linux
As far as installing custom recovery with locked bootloader goes, I'm pretty sure that won't work, or else someone would've come up with that long long time ago.

Thanks!!
ravilov
Thanks for the information in your post. Since it appears that some owners have replaced their recovery partition with CWM having only rooting, I was hoping that the recovery partition might NOT be signed by Motorola and checked during the recovery boot process. BTW, my Atrix 4G is an International carrier unlocked version. I have another Atrix 4G on order, I might try DD'ing to the recovery partition and if that fails roll back the recovery.img backup. If the recovery partition is actually signed and checked during the boot process, returning the partition bit-for-bit with the original SHOULD revert to factory. From my reading, it some cases the recovery partition is NOT signed even though the bootloader/boot partition IS signed.
Again, Thanks Very Much for your post
Regards, Ron

Related

[Q] Corrupt GPT?

I think after running wrong exit_recovery.zip, I managed to trash partition table/GPT - or some other combination of stupidity - hoping someone can help..
CWM Recovery Log
Starting recovery on Mon Jun 25 21:11:17 2012
can't open /dev/tty0: No such file or directory
framebuffer: fd 3 (1280 x 800)
ClockworkMod Recovery v5.8.2.0
recovery filesystem table
=========================
0 /tmp ramdisk (null) (null) 0
1 /system ext4 /dev/block/mmcblk0p1 (null) 0
2 /cache ext4 /dev/block/mmcblk0p2 (null) 0
3 /misc emmc /dev/block/mmcblk0p3 (null) 0
4 /staging ext3 /dev/block/mmcblk0p4 (null) 0
5 /data ext4 /dev/block/mmcblk0p8 (null) 0
6 /boot emmc /dev/block/mmcblk0p10 (null) 0
7 /recovery emmc /dev/block/mmcblk0p9 (null) 0
W:Unable to get recovery.fstab info for /datadata during fstab generation!
W:Unable to get recovery.fstab info for /emmc during fstab generation!
W:Unable to get recovery.fstab info for /sdcard during fstab generation!
W:Unable to get recovery.fstab info for /sd-ext during fstab generation!
I:Completed outputting fstab.
Irocessing arguments.
...
[recovery session] Fdisk
/tmp # fdisk -l /dev/block/mmcblk0
Disk /dev/block/mmcblk0: 63.5 GB, 63577260032 bytes
4 heads, 16 sectors/track, 1940224 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Disk /dev/block/mmcblk0 doesn't contain a valid partition table
[recovery session] Parted
/tmp # ./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
Error: /dev/block/mmcblk0: unrecognised disk label
Hypothesis
By doing exit recovery opt 1a http://forum.xda-developers.com/showthread.php?t=1514088 I was able to bring up the virtuousprime ROM boot, but virtuous failed (reboot) after trying to format /data.
I dd'd the first 8096 bytes of mmcblk0 and they are all zeros?
From CWM, I am able to mount partitions mmcblk0p1, mmcblk0p3, mmcblk0p5.
So from all that, I am thinking I need to flash MBR, replace GPT on LBA 1? If this is correct, does anyone have a stock GPT for the tf201?
I can then format /data (mmcblk0p8) and I think my ROMs will then work.
kind regs,
Based on the information here: https:// en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_.28LBA_1.29, replacing LBA 1 will only fix the GPT header. Since you said that the first 8096 bytes were all zeros, it would seem that those would fall into LBA 2, 3, etc., corrupting the partition table.
But since you said that CWM can mount your partitions, you might be able to use GPT fdisk's recovery features to fix the problem. I don't know if anyone has compiled it for Android though Please note that the regular fdisk cannot handle GPT, only MBR.
When you said "flash MBR", what exactly do you mean? GPT and MBR are two different partition structures and if you replace either one with the other, the partition table will be lost and you won't be able to mount any partition.
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
I have all the partition offsets and disk size from backup (/sys/devices/platform/sdhci-tegra.3/mmc_host/mmc0/mmc0:0001/block/mmcblk0/..) and know what the partition table should look like; there was no "Partition 9", I made this up because there was 1024 unaccounted bytes after mmcblk0p8 (/data) ends:
Disk size: 1241744336 bytes
Partition 1 (/system): start 74752; End 1123328; Size 1048576
Partition 2 (/cache): start 1123328; End 1999872; Size 876544
Partition 3 (/misc): start 1999872; End 2003968; Size 4096
Partition 4 (/staging): start 2003968; End 3096576; Size 1092608
Partition 5 (/btmac): start 3096576; End 3106816; Size 10240
Partition 6 (/?): start 3106816; End 3107840; Size 1024
Partition 7 (/?): start 3107840; End 3118080; Size 10240
Partition 8 (/data): start 3118080; End 124173312; Size 121055232
Partition 9: start 124173312; End 124174336; Size 1024
Given that /system mounts, I think if I had a stock dump from a tf201 of bytes 0-74752 might also be an alternative - I could verify the GPT table against above before I put it in.
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
damonbrisbane said:
Was thinking about building LBA0 and LBA 1 separately, was going from that Wikipedia article, "...Legacy MBR information is contained in LBA 0, the GPT header is in LBA 1.." and I thought - perhaps naively - that an fdisk command with /mbr option would sort out LBA0, then I worry about GPT in LBA1, but maybe I am confusing fdisk /mbr option with another command (old DOS)?
Click to expand...
Click to collapse
I wouldn't suggest doing that. That would create a hybrid MBR. When a hybrid MBR disk is read using MBR, only the first four partitions can be visible (after redefining the partition table in LBA0). If the disk is read using GPT, all the partitions will be visible. I don't know if Android and Linux prefer MBR over GPT, but if they do, you might lose access to partitions 5-8.
By the way, the '/mbr' option is for the diskpart tool from MSDOS and Windows
damonbrisbane said:
Another option I can think of, comes from reference I see to a "backup GPT" held in last sector of GPT disks? If you look at partition offsets above, there is 1024 bytes at the end where I may get this information - but I think injecting in a dump of those first 74k bytes into mmcblk0 - as above - would be safer.
Click to expand...
Click to collapse
You're absolutely right. I had forgotten about this. Do you happen to know if those mmcblk0p# partitions are visible when the tablet is plugged into a Linux computer? If so, GPT fdisk can restore the partition table and GPT header from the backup GPT.
You would run something like this to restore the backup GPT:
http://paste.kde.org/488054/
EDIT: I found a version of gdisk compiled for Android by meghd00t (http://forum.xda-developers.com/showpost.php?p=24805392&postcount=74). You may be able to restore the backup GPT directly from the tablet
Download link from the post: http://dl.dropbox.com/u/64885133/gptfdisk.zip
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
damonbrisbane said:
Thanks Chen, i plan to try the gptfdisk tonight when I get home from work and can post the result.
One thing i'm not sure about is access mmcblk0 from linux - does this mean I can access the internal mmcblk0 of the tf201 directly through a linux device? Right now I access mmcblk0 solely through adb shell to CWM recovery.
Click to expand...
Click to collapse
No problem There's also an option to backup the GPT header and partition table to file. I'd suggest doing that just in case anything goes wrong.
I'm not entirely sure if the internal memory can be accessed directly from Linux. But from what I've been reading in the forums today, it seems that it might not possible (I'm pretty new to Android).
Hopefully gptfdisk will work via adb shell
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Steps Performed
ADB - Write backup GPT to LBA1 mmcblk0
~ # ./gdisk /dev/block/mmcblk0
GPT fdisk (gdisk) version 0.8.4
Unsupported GPT version in backup header; read 0x00000000, should be
0x00010000
Partition table scan:
MBR: not present
BSD: not present
APM: not present
GPT: not present
Creating new GPT entries.
Command (? for help): r
Recovery/transformation command (? for help): ?
b use backup GPT header (rebuilding main)
c load backup partition table from disk (rebuilding main)
…
? b
Recovery/transformation command (? for help):
? c
Warning! This will probably do weird things if you've converted an MBR to
GPT form and haven't yet saved the GPT! Proceed? (Y/N): Y
Caution! After loading partitions, the CRC doesn't check out!
Recovery/transformation command (? for help): p
Disk /dev/block/mmcblk0: 124174336 sectors, 59.2 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 2E8491CC-AFFC-43B9-B1C4-97D2F258BE1C
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 124174302
Partitions will be aligned on 2048-sector boundaries
Total free space is 75709 sectors (37.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 74752 1123327 512.0 MiB 0700 AP
2 1123328 1999871 428.0 MiB 0700 CC
3 1999872 2003967 2.0 MiB 0700 MC
4 2003968 3096575 533.5 MiB 0700 UP
5 3096576 3106815 5.0 MiB 0700 PR
6 3106816 3107839 512.0 KiB 0700 YU
7 3107840 3118079 5.0 MiB 0700 CA
8 3118080 124173311 57.7 GiB 0700 UA
Recovery/transformation command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/block/mmcblk0.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
~ #
ADB/CWM - Exit recovery and attempt Virtuousprime ROM install
I then did exit recovery as per 1a http://forum.xda-developers.com/showthread.php?t=1514088
Upon reboot Virtuousprime wouldn't go as far as it got before. I went back into adb shell and did wipe data:
Wipe data/factory reset
Formatting /data
Error mounting /data !
Skipping format...
Formatting /cache
Formatting /sd-ext
Formatting /sdcard/.android_secure...
Error mounting /sdcard/.android_secure!
Skipping format...
Data wipe complete
Note the error on /data. Could not format /data either using the CWM mounts and storage menu. I named the partitions I knew about and formatted /data (mmcblk0p8) from adb shell:
Number Start End Size File system Name Flags
1 38.3MB 575MB 537MB ext4 system
2 575MB 1024MB 449MB ext4 cache
3 1024MB 1026MB 2097kB misc
4 1026MB 1585MB 559MB ext3 staging
5 1585MB 1591MB 5243kB fat32 btmac
...
8 1596MB 63.6GB 62.0GB ext4 data
mke2fs -t ext4 /dev/block/mmcblk0p8
I then found that CWM data/factory reset went through without errors:
Wipe data/factory reset
Formatting /data
Formatting /cache
..
Data wipe complete
And subsequently exit recovery and virtuous prime rom have installed OK, tested across reboot and shutdown
Cheers!
damonbrisbane said:
Whew, we're off life support! and more importantly - my wife wont kill me for an Unauthorised Brick to The Birthday Device
Click to expand...
Click to collapse
Haha, I'm glad I was able to help

Unable to Format Partitions in CWM Recovery

I've searched through the all the XS forums and Backup & Restore within CWM Recovery seems to work for everyone, on all the different ICS Based Kernels with Recovery except for me.
I get the error below whenever I try to format my /system partition through recovery; as the Restore tries to format the partition before restoring to it by restores always fail and I'm left with a /system partition that I can't mount. Only through restoring through Flashtool can I get the phone to boot again. Has anyone seen this before or have any idea what the problem is? Someone having a similar issue on the Samsung Galaxy Player had a similar issue and it was down to a corrupt partition table Galaxy Player Problem
Error From Recovery
Code:
Formatting /system...
E: format_volume: make_extf4fs failed on /dev/block/mmcblk0p12
Error formatting /system!
Error mounting /system!
My Partition Table (if it's any use)
Code:
Disk /dev/block/mmcblk0: 31.9 GB, 31910264832 bytes
4 heads, 16 sectors/track, 973824 cylinders, total 62324736 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 4096 2048 f0 Linux/PA-RISC boot
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 * 4097 5120 512 4d Unknown
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 8192 49151 20480 48 Unknown
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 49152 61071359 30511104 5 Extended
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 50176 51199 512 46 Unknown
/dev/block/mmcblk0p6 53248 59391 3072 4a Unknown
/dev/block/mmcblk0p7 61440 67583 3072 4b Unknown
/dev/block/mmcblk0p8 69632 75775 3072 58 Unknown
/dev/block/mmcblk0p9 77824 88063 5120 70 Unknown
/dev/block/mmcblk0p10 90112 106495 8192 83 Linux
/dev/block/mmcblk0p11 106496 139263 16384 f0 Linux/PA-RISC boot
/dev/block/mmcblk0p12 139264 2236415 1048576 83 Linux
/dev/block/mmcblk0p13 2236416 2748415 256000 83 Linux
/dev/block/mmcblk0p14 2748416 6942719 2097152 83 Linux
/dev/block/mmcblk0p15 6942720 61071359 27064320 c Win95 FAT32 (LBA)
I was sondering if anyone had any suggestions, or could at least post their Partition Table to see if I need to sort mine out
(From ADB:
fdisk /dev/block/mmcblk0
U,
P
Then paste it here)
Cheers,
Andy
hello Andy..
mine partition table is just the same with you. but i can restore my backup (which include /system backup) just fine.whick kernel are you on?
It happened to me once. I formated data partition and it worked, don't know why
I've had the same problems with the FXP kernels ( both CM9 & CM10) ,Advanced Stock and SSpeed. I'm starting to wonder if the memory is actually damaged.
It's hit and miss as to which partitions it'll let me format, system and cache almost always fail, data sometimes works,but then frequently won't mount afterwards.
Sent from my LT26i using xda premium
Hi!
I've the same problems.
My phone has a srange behavior... Often can't ormat partitions, can't mount them, but after few retries i can manage it. And it's totally random..
You think is a software memory or a damaged memory ?
I never can't restore a nandroid backup because it give me an error restoring system partition.
Any ideas ?
mrscope said:
Hi!
I've the same problems.
My phone has a srange behavior... Often can't ormat partitions, can't mount them, but after few retries i can manage it. And it's totally random..
You think is a software memory or a damaged memory ?
I never can't restore a nandroid backup because it give me an error restoring system partition.
Any ideas ?
Click to expand...
Click to collapse
I've found a sort of work around. It appears to only be recoveries that use an ICS kernel that give me issues, so I loaded Doom's Advance Stock GB Kernel onto the phone and the recovery on that works flawlessly everytime. (it also has better features than regular CWM Recovery)
All the ICS kernel's that I tried will always successfully back up and restore the boot partition, so I use them to do that. Then restore DoomKernel (advanced restore, restore boot) then do all my backups, restores, and flashing with DooMRecovery. Then you can tidy everything up by moving the ICS Kernel BootPartion image into the DooMRecovery system/data backup folder, then insert the boot.img line from the checksum MD5 file at the start of the ICS MD5 file into the DooMRec MD5 file. (so you have all the correct files in the same folder, with the correct MD5 sum for each of the images in the folder). Then you can do a restore via DoomRecovery if you ever need to.
I grant you it's a bit messy and if the timestamps don't work properly a little confusing, but it does do the job, and it means you can easily swap between ROM's on the go.
sixdaysandy said:
I've found a sort of work around. It appears to only be recoveries that use an ICS kernel that give me issues, so I loaded Doom's Advance Stock GB Kernel onto the phone and the recovery on that works flawlessly everytime. (it also has better features than regular CWM Recovery)
All the ICS kernel's that I tried will always successfully back up and restore the boot partition, so I use them to do that. Then restore DoomKernel (advanced restore, restore boot) then do all my backups, restores, and flashing with DooMRecovery. Then you can tidy everything up by moving the ICS Kernel BootPartion image into the DooMRecovery system/data backup folder, then insert the boot.img line from the checksum MD5 file at the start of the ICS MD5 file into the DooMRec MD5 file. (so you have all the correct files in the same folder, with the correct MD5 sum for each of the images in the folder). Then you can do a restore via DoomRecovery if you ever need to.
I grant you it's a bit messy and if the timestamps don't work properly a little confusing, but it does do the job, and it means you can easily swap between ROM's on the go.
Click to expand...
Click to collapse
I had the same thing last week, couldn't restore a backup form CWM (on Xperia S/FXP CM10 207). Formatting cache and system 'manually' in CWM also failed. /data was OK.
I ended up formatting from adb (mkfs.ext2 -T ext4 /dev.... ) and mounting the partitions through CWM. Then I untarred the different partitions of my CWM-backup and everything was fine.
Is this a problem of CWM or my phone, or ...?
Thanks
Frank
I am having the exact same issue. I cannot -ever- format the cache . So every restore attempt ends in error.
I have rooted stock .55 , with locked bootloader.
Did anybody ever found a fix for this.
I have read the other recovery option but it requires kernel changing and possibly unlocked bootloader.
I created a thread with my issues, here
http://forum.xda-developers.com/showthread.php?t=2163141

[HOWTO] Convert your Optimus G to a Nexus 4 and Back

DISCLAIMER: THIS IS VERY DANGEROUS COMPARED TO A NORMAL ROM FLASH. DO NOT DO THIS IF YOU DON'T KNOW WHAT YOU'RE DOING OTHER THAN FLASHING ROMS.
IF SOMETHING GOES WRONG, YOU HAVE ONLY YOURSELF TO BLAME. YOU HAVE BEEN WARNED.[/B]
To convert to Nexus 4
First off, there are a few issues.
-SDCard doesn't work.
-Capacitive buttons aren't working. No known way to fix it.
First off, lets flash the N4 Rom.
1) Install LGNPST - Use tSilenzio's AutoLGNPST - http://www.oudhitsquad.com/android/LGE/Firmware/Tools/AutoLGNPST-tSilenzio.zip
2) Download the Nexus 4 Image - https://www.androidfilehost.com/?fid=9390248398092765463
3) Rename the extracted .tot file to a .bin file
4) Put the phone in Download mode. Volume Up + Volume Down While inserting USB cable.
5) Open LGNPST and select the phone - Should be Com[Number]
6) In the DLL section, select LGNPST_LS970.dll
7) In the file selection, select the previously renamed Nexus 4 bin file.
8) Start the flashing process and hold your breath.
9) When it hits 67%, your phone should start booting. DO NOT UNPLUG YET.
10) At 85%, an error will occur saying that the phone was unplugged. Ignore it and close LGNPST. The image is fully flashed.
11) Hold Volume Up + Power to put the phone into FASTBOOT mode.
12) Download the recovery from here and place it into your fastboot directory. - http://forum.xda-developers.com/showthread.php?t=2010984
13) Download the following 3 files and place them on the MicroSD card. - http://d-h.st/cFA - http://d-h.st/yUQ - http://d-h.st/0dH
14) While still in fastboot, type "fastboot boot recovery.img" - This will put the phone on the custom recovery. Make sure the SD card is in.
---Here, we're going to fix the partition tables for 16GB of space and replace the backup GPT so that we can't hardbrick from the backup GPT.
15) Run adb shell to get into a root shell in recovery.
16) Copy the modified DD onto the phone
Code:
# cp /external_sd/dd /
# chmod 755 /dd
17) Backup the partition tables incase something goes wrong.
Code:
# /dd if=/dev/block/mmcblk0 of=/external_sd/pgpt8G.img bs=512 count=34
# /dd if=/dev/block/mmcblk0 of=/external_sd/sgpt8G.img bs=512 skip=30777311
18) Unmount the filesystems so that you can overwrite the partition table.
Code:
# umount /data
# umount /cache
19) Make sure nothing is mounted. It should return this (Other than partition size):
Code:
# df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 911.7M 48.0K 911.6M 0% /dev
/dev/block/mmcblk1p1 59.4G 4.8G 54.6G 8% /external_sd
20) Move the partitions to their new locations. This may take a couple minutes.
Code:
# /dd if=/dev/block/mmcblk0 of=/external_sd/DDR bs=512 skip=15267840 count=2015
# /dd if=/external_sd/DDR of=/dev/block/mmcblk0 bs=512 seek=30775296 conv=notrunc
21) Install the new partition tables.
Code:
# /dd if=/external_sd/sgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
# /dd if=/external_sd/pgpt16G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
22) Make sure no errors occurred. Run 'parted /dev/block/mmcblk0' and check that it returns the same as the below.
Code:
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 016G92 (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 524kB 67.6MB 67.1MB fat16 modem
2 67.6MB 68.2MB 524kB sbl1
3 68.2MB 68.7MB 524kB sbl2
4 68.7MB 70.8MB 2097kB sbl3
5 70.8MB 71.3MB 524kB tz
6 71.3MB 94.4MB 23.1MB boot
7 94.4MB 117MB 23.1MB recovery
8 117MB 118MB 799kB m9kefs1
9 118MB 119MB 799kB m9kefs2
10 119MB 120MB 799kB m9kefs3
11 120MB 121MB 524kB rpm
12 121MB 121MB 524kB aboot
13 121MB 122MB 524kB sbl2b
14 122MB 124MB 2097kB sbl3b
15 124MB 124MB 524kB abootb
16 124MB 125MB 524kB rpmb
17 125MB 125MB 524kB tzb
18 125MB 126MB 524kB metadata
19 126MB 143MB 16.8MB misc
20 143MB 159MB 16.8MB ext4 persist
21 159MB 1040MB 881MB ext4 system
22 1040MB 1627MB 587MB ext4 cache
23 1627MB 15.8GB 14.1GB ext4 userdata
24 15.8GB 15.8GB 524kB DDR
25 15.8GB 15.8GB 507kB grow
23) If something different was returned, run the below code to restore the previous partition tables.
Code:
# /dd if=/external_sd/sgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=30777311 conv=notrunc
# /dd if=/external_sd/pgpt8G.img of=/dev/block/mmcblk0 bs=512 seek=0 conv=notrunc
24) Exit the shell and type 'adb reboot bootloader' or reboot the phone while holding Volume Up.
25) Check that you're in fastboot mode and exit the following commands - This will fix the filesystem to take up the entire partition.
Code:
fastboot erase userdata
fastboot format userdata
fastboot -w
26) Boot the phone and update as needed. Then, put this on the phone and flash in recovery.
27) You are now working other than the SD card and Capacitive buttons.
Credits:
http://forum.xda-developers.com/showthread.php?t=2117576
http://forum.xda-developers.com/showthread.php?t=2099784
http://forum.xda-developers.com/showthread.php?t=2160124
http://forum.xda-developers.com/showthread.php?t=2146816
To convert from Nexus 4
This assumes that you have read the Convert to section.
1) Wipe the phone. Go into fastboot mode [Vol Up + Power] and execute the following commands. This is to prevent corrupted data partitions.
Code:
fastboot -w
fastboot format system
fastboot format userdata
fastboot format cache
fastboot format data
fastboot erase system
fastboot erase userdata
fastboot erase cache
fastboot erase data
2) LGNPST back to stock. You will do this twice to fix some issues.
To get into download mode, turn the phone off and hold Vol Up + Vol Down while inserting the USB cable.
3) Download these 2 images. Mar. 8, 2013 and Sept. 29, 2012
4) Flash the Mar. 8, 2013 firmware in LGNPST (See above for how to flash firmware in LGNPST. As before, the phone will start booting at 67% and LGNPST will show an error at 85%. Ignore the error and close LGNPST.
5) Restart the phone in download mode and now flash the Sept. 29, 2012 firmware. If you don't, your /SDCARD may be corrupted and you cant root.
6) Root the phone and unlock the bootloader. See here
7) If that doesn't work, try Teenybin.
8) Some partitions are broken. Go into CWM recovery and open an 'adb shell'.
9) Execute the following code. This will backup the broken partitions and wipe them.
Code:
dd if=/dev/block/mmcblk0p15 of=/sdcard/mmcblk0p15.bak
dd if=/dev/block/mmcblk0p16 of=/sdcard/mmcblk0p16.bak
dd if=/dev/block/mmcblk0p19 of=/sdcard/mmcblk0p19.bak
mke2fs -T ext4 /dev/block/mmcblk0p15
mke2fs -T ext4 /dev/block/mmcblk0p16
mke2fs -T ext4 /dev/block/mmcblk0p19
---You should now be back to stock--- LGNPST again if you want 'True Stock'
Let me know if you see anything wrong and please leave nasty comments at the door.
Ok, granted. This is more about recovering from flashing to Nexus 4 than about flashing to it. Basically, DON'T DO IT, as it doesn't seem to be worth it. We have AOSP and Cyanogen, etc.
I just posted this because I bought a phone that was flashed and went through hours of work fixing it.
Please read this before you think about flashing. http://forum.xda-developers.com/showpost.php?p=36735476&postcount=149
Its not worth it so much now but it was great when first released and it doesn't take that long to revert your phone. I went back and fourth like 5 times and my phone is fine. I think there is a low chance of your phone bricking as long as you follow instructions. The conversion is still a good option to have.
Sent from my LG Optimus G using XDA Premium 4 mobile app
Dr0!dFreek said:
Its not worth it so much now but it was great when first released and it doesn't take that long to revert your phone. I went back and fourth like 5 times and my phone is fine. I think there is a low chance of your phone bricking as long as you follow instructions. The conversion is still a good option to have.
Sent from my LG Optimus G using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Yeah, it seems nice to have the ability to do so, which is why I wrote the guide (and to give a single comprehensive guide that works).
It's nice to have a perfectly working KitKat rom the day its released, which is why I converted (When KK was released), but now, it doesn't seem worth it (We have AOSP). If you want MultiRom and franco kernel (Like I did), then its nice to have, but otherwise, most people don't need it.
alastair53 said:
13) Download the following 3 files and place them on the MicroSD card. - http://d-h.st/cFA - http://d-h.st/yUQ - http://d-h.st/0dH
Click to expand...
Click to collapse
Is this part SPYWARE? the 3 files downloads a exe and is detetected as virus or something.

[Guide] Resizing LG G2 partition size

Resizing LG G2 partition size​Must have: Latest TWRP Recovery, ADB experience and gdisk for arm in attached zip.
Clean /system partition (unused apps, bloatware, garbage and so on...)
Backup everything important from /sdcard.
Reboot to TWRP and connect ADB (if "ADB devices" fails, check windows "Device Management" and install "Android Sooner Single ADB Interface" for your unrecognized phone).
In TWRP backup /system and /data and download /sdcard/TWRP folder via MTP to your PC.
Now it's ADB time:
Code:
[B]# check /system used space (in Mb) and remember it, as we should cut no more than "Available" space:[/B]
adb shell "mount /system"
adb shell "df -m /system"
[B]# un-mount partitions:[/B]
adb shell "umount /system"
adb shell "umount /data"
adb shell "umount /sdcard"
adb shell "umount /cache"
[B]# unzip gdisk in your ADB folder and install it:[/B]
adb push gdisk /sbin
adb shell "chmod 0755 /sbin/gdisk"
[B]# check partitions info:[/B]
adb shell "/sbin/gdisk -l /dev/block/mmcblk0" >gpt.txt
[B]# open new gpt.txt file in your ADB folder
# now you should recalculate your new partitions (30-36) size and position (in sectors)
# partition start-sector should be even, end-sector should be odd
# to make it simplier, use formula: (new size in MB) * 2048 + 1 = (new size in sectors)[/B]
Check my examples:
Code:
default (4.4.2 firmware):
30 819200 6488063 2.7 GiB 0700 system
31 6488064 7733247 608.0 MiB 0700 cache
32 7733248 7897087 80.0 MiB 0700 tombstones
33 7897088 7929855 16.0 MiB 0700 spare
34 7929856 8028159 48.0 MiB 0700 cust
35 8028160 60948479 25.2 GiB 0700 userdata
36 60948480 61071326 60.0 MiB 0700 grow
my mod v1:
(30) 800000 3526297 1.3 GiB system
(31) 3526298 3853977 160 MiB cache
(32) 3853978 3858073 2 MiB tombstones
(33) 3858074 3862169 2 MiB spare
(34) 3862170 3866265 2 MiB cust
(35) 3866266 61067229 27.2 GiB userdata
(36) 61067230 61071326 2 MiB grow
my_mod_v2:
(30) 800000 2897153 1 GiB system
(31) 2897154 3122433 110 MiB cache
(32) --- --- deleted tombstones
(33) --- --- deleted spare
(34) 3122434 3126531 2 MiB cust
(35) 3126532 61071326 27.6 GiB userdata
(36) --- --- deleted grow
Important! It's only mine D802 4.4.2 example. You should calculate your own values, because of your /system used size, /cust size for unlock, etc.
/spare and /grow partitions unused on our phones. /tombstones is obesolete since it mounts from /data, anyway.
After all checks and calculations, let's do the magic:
Code:
[B]# run gdisk:[/B]
adb shell
cd /sbin
gdisk /dev/block/mmcblk0
[B]# no real changes applied to the phone, before "w" command.
# if you did something wrong, exit by "q" command
# you can check youreself with "p" command (partition list with virtual changes you made).
# OK, let's delete our old partitons and create them anew:[/B]
"d" command > enter partition number (for all 30-36 partitons).
"n" command > enter partition number > start > end > code (start & end = new values in sectors, code = 0700)
"c" command > enter partition number > name (system, cache, etc.)
[B]# if all seems fine, and you're pretty sure of youreself:[/B]
"w" command > "Y" answer
[B]# there is no FS on new partitions, so format them:[/B]
mke2fs -t ext4 /dev/block/mmcblk0p30
mke2fs -t ext4 /dev/block/mmcblk0p31
mke2fs -t ext4 /dev/block/mmcblk0p34
mke2fs -t ext4 /dev/block/mmcblk0p35
[B]# there is no point to format others, because they have no fs by default.
# if using kernel with F2FS support (like Dorimanx), you can format some of them as F2FS:[/B]
mkfs.f2fs /dev/block/mmcblk0p35
[B]# to make TWRP realise, horrors we just did - reboot it:[/B]
reboot recovery
[B]# after reboot, we can optimize /userdata a bit (ext4 only), with this:[/B]
adb shell "tune2fs -m 0 /dev/block/platform/msm_sdcc.1/by-name/userdata"
[B]# bring backups from PC to /sdcard via MTP and restore them, as usual
# now you can reboot to your system with custom-sized partitions!
# P.S. If you notice your /sdcard permissions glith a bit after all this - flash "sdcard Fix Permissions script" from [URL="http://forum.xda-developers.com/showthread.php?t=2239421"]this[/URL] thread.[/B]
Good luck.
Awesome :good: this guide will help 16GB user like me to increase data/sdcard partition
Too bad I don't have pc to play around with....
so, stock, user-usable fresh after format on KK4.4 we have 24GB on the /sdcard part. Would we want to use this to go smaller? Would there be a benefit to that? Or would I want to use it to go larger, shrinking my /sdcard
I know it can go both ways, but which are people more interested in here?
rancur3p1c said:
I know it can go both ways, but which are people more interested in here?
Click to expand...
Click to collapse
Who knows? It's not that hard, it takes 5 minutes, it gets you + 1-3 Gib on the phone (without SD-Card support), and it's safe - coz we don't touch bootloader or recovery partitions... It's worth it.
THIS is just pure awesome
I've followed the guide and successfully added almost 2gb to userdata on my 16gb d802
This is my gpt for now
30 791568 4158721 1.6 GiB 0700 system
31 4158722 4306179 72.0 MiB 0700 cache
34 4306180 4310277 2.0 MiB 0700 cust
35 4310278 30777310 12.6 GiB 0700 userdata
And this is my aim, if i have time to do it again
30 791568 3937297 1.5 GiB 0700 system
31 3937298 3961875 12.0 MiB 0700 cache
34 3961876 3965973 2.0 MiB 0700 cust
35 3965974 30777310 12.7 GiB 0700 userdata
Also, i've notice this in the gpt.txt file
Total free space is 230360 sectors (112.5 MiB)
So can we get even more from our phone?
Hello everybody
first of all I ll thank you for your guide Resizing LG G2 partition size.
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
My partition table looks like:
Code:
30 819200 3686401 1.4 GiB 0700 system
31 3686402 4014083 160.0 MiB 0700 cache
34 4014084 4034565 10.0 MiB 0700 cust
35 4034566 30777310 12.8 GiB 0700 userdata
If someone have any idea how I can solve this problem?
Thanks
Chris
I am thinking to try this tool, but I would like to know if flashing kdz will work in case I screw things up, or am I risking to permanently brick the phone?
Okay, going back to stock partitions will fix my problem and my system partition is again 2.7 GB
With the customised partitions i was unable to install neither Resurrection Remix Rom nor Google Edition 1.5. Both return an error in twrp.
Backfisch said:
Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
All partitions seems to be fine. gdisk works perfect without any errors.
Click to expand...
Click to collapse
I have the same problem. Did you fix it by any chance?
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Backfisch said:
But no I have problems with installing a new rom. Everytime I enter twrp I get the message "Can't mount /system". So its impossible for me to install a new rom.
Click to expand...
Click to collapse
Okay, the fix is that you have to restore TWRP backup, in my case CM13 booted all good. But now I have a different problem, the MTP connection is really unstable, disconnects and reconnects for no reason. Same problem using twrp mtp or cm mtp. Tried two different cables, two different pc, and resized the partitions twice using different values. Still no luck. Anyone had any similar experience?
EDIT: Seems my charging port is failing. Many cables have hard time being stable, but some of them work better.
Backfisch said:
Yes, going back to the stock values of the partition using the gdisk again.
Its also import to make sure the partition format works correct. Better format twice....
Click to expand...
Click to collapse
Back when I tried to resize the /system partition, all non-lg rom doesnt install because of that error, and they are the ones that has the most potential of freeing some space
you can only get some space from /cache and other partitions without getting errors
I have gained 2 Gb extra space on the internal memory, and it works great so far. The only problem is that flashing roms from twrp returns the error /system can not be mounted, and you have to install the rom by restoring twrp backups.
Am I right in thinking that you cant install an rom update with modified partitions by flashing it in twrp?
If restoring my backup is the only way to install my rom, I will delete some music and pictures on the userdata partition...
You can install roms with "system" folder and files in it, on modified partitions (if you have enough space in /system, of course).
But you won't be able to install CyanogenMod-based roms with partition image in them (system.img, system.bin, etc.)
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
SantoSubito said:
I played with this a bit and something went wrong Now i can't flash any os neither TOT or KDZ. I dismantled my phone to enter 9006 mode and recover it from there. But with no success :c What should i do now? I have my stock values of 30f saved, but after flashing kdz and tot i have stock recovery. It doesn't have adb suppor so i can't start gdisk operation. And i can't push any rom or recovery by sideload. When recovery starts I have list of errors. It can't mount system, data etc. I think I bricked it quite well xd
Click to expand...
Click to collapse
Did you fix it yet? Does download mode work? Why didn't work flashing kdz in the first place?
Yes it does. After flashing kdz phone enters recovery and I have list of errors. And when i tried to flash tot i have error something with laf partition and gpt. Yesterday i tried to recover it from 9008 but I'm also getting error :c
SantoSubito said:
And when i tried to flash tot i have error something with laf partition and gpt.
Click to expand...
Click to collapse
Try to flash TOT-firmware with modded dll (bypass gpt-error). One of this should do the trick.
Yeah it worked. But not in 100%. When its 94% my phone reboots and LG Tool shows:
...
CACHE
CACHE
CUST
Wiating for the device 120s
then device reboots and get bootloop
BoardDiag have this wierd dload error and also i cant do nothing with this tool

[HOW TO] BOOT FROM SD CARD [SUCCESSFULLY] on QMobile Z8 with BRICKED/DEAD eMMC

I'm a mechanical engineer, not an IT guy. I can fix machines, perhaps, but not bricked phones. So try anything at your own extreme risk. This is NOT a step by step guide.
DEVICE:
QMobile Z8, same as Wikio Ridge 4G, (MSM8916).
Running Android 5.0.2, SuperSU rooted.
Kernel v 3.10.49
Thanks to @ASAZING for TWRP 3.0.2-0
PROBLEM:
So the screen started blinking and locking / unlocking automatically like UI resetting. And there was no SIM. At first I thought it's launcher or SuperSU causing problem. But it got worse over days. So I decided a factory flash since I didn't have untouched flashable zip.
Flashed firmware using QFIL but no success. Rebooted to recovery and TWRP was still there.
/data partition was locked and TWRP doesn't support decryption. So I did a factory reset and the message came: /data not mounted. Invalid Argument
Formatted /data from "Repair or Change Filesystem" option in TWRP and as a result /data and /cache both couldn't be mounted.
Formatted /cache, and /system too not mounted.
Manually formatted using 'make_ext4' and tried 'fastboot format:ext4 userdata' as well. Both succeeded apparently but mount still failed.
Run 'e2fsck' and that showed: "Bad magic number in super block" and "The superblock could not be read."
Run 'mke2fs -n' for alternate super blocks, run again 'e2fsck' but no success. Images are attached.
'sgdisk --verify' gives this error log:
Code:
sgdisk --verify mmcblk0p1
[COLOR="Red"]***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format in memory.
***************************************************************
Exact type match not found for type code 7200; assigning type code for 'Linux filesystem'
Exact type match not found for type code 6500; assigning type code for 'Linux filesystem'
Exact type match not found for type code 7900; assigning type code for 'Linux filesystem'
Exact type match not found for type code 0D00; assigning type code for 'Linux filesystem'
Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.
Warning! Secondary partition table overlaps the last partition by 3805778618 blocks!
You will need to delete this partition or resize it in another utility.
Problem: partitions 2 and 1 overlap:
Partition 2: 168689522 to 2104717761
Partition 1: 778135908 to 1919645538
Problem: partitions 3 and 1 overlap:
Partition 3: 1869881465 to 3805909656
Partition 1: 778135908 to 1919645538
Problem: partitions 3 and 2 overlap:
Partition 3: 1869881465 to 3805909656
Partition 2: 168689522 to 2104717761
Problem: partition 1 is too big for the disk.
Problem: partition 2 is too big for the disk.
Problem: partition 3 is too big for the disk.
Problem: partition 4 is too big for the disk.
Warning! Main partition table overlaps the first partition by 34 blocks!
You will need to delete this partition or resize it in another utility.
Warning! Secondary partition table overlaps the last partition by 3805778618 blocks!
You will need to delete this partition or resize it in another utility.
Identified 9 problems![/COLOR]
==========================
sgdisk --verify mmcblk0p16
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551584, but backup header is at 1 and disk size is 2 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems!
[/COLOR]
==========================
sgdisk --verify mmcblk0p17
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551598, but backup header is at 15 and disk size is 16 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems![/COLOR]
==========================
sgdisk --verify mmcblk0p22
[COLOR="red"]Creating new GPT entries.
Problem: GPT claims the disk is larger than it is! (Claimed last usable sector is 18446744073709551614, but backup header is at 31 and disk size is 32 sectors.
The 'e' option on the experts' menu will probably fix this problem
Identified 1 problems![/COLOR]
'parted rm' and 'fastboot erase' didn't work either. Partition was still there.
Then I tried to flash stock recovery through TWRP. And recovery too gone.
Now, device boots directly to bootloader (fastboot mode) and is halted there. Have to 'fastboot boot recovery.img' or 'fastboot boot boot.img' each time.
Download Mode (QDLoader 9008) is also accessible.
FLASHING FACTORY FIRMWARE:
Now left only with fastboot and EDL, tried once again QFIL flasher, Wiko official flasher, QDownloader. Log says: "Read back verify failed at sector ...." for partitions misc, system, cache, persist, recovery, userdata (6 partitions) and 2 partition table *.bins
Hence proved, eMMC is malfunctioning and device now can't boot on its own due to no partition table.
Tried 'sgdisk --backup' and 'sgdisk --load-backup' options for partition table. It gives error: "Warning! Current disk size doesn't match that of backup." and "Problem: Partition 28 ends before it begins." etc.
'fastboot flash partition *.bin' also failed with error: "remote: failed to write partition".
'dd if=gpt_main0.bin of=/dev/block/mmcblk0' apparently succeeded but comparing octal dump ('od') files of 34 sectors at start shows no difference, means file is not written to eMMC.
SOLUTION SUMMARY:
Partition SD card according to already existing partition table on internal eMMC.
Flash partition images from factory firmware to newly created partitions.
Modify kernel (boot.img) and recovery to boot from sd card instead of internal memory.
Boot kernel or recovery through fastboot.
SECTION 1
PARTITION SD CARD:
Here comes Google. Following the footsteps of @lexelby at this, I created gpt (parted command) on 16GB C-10 sd card using Ubuntu virtual machine.
Created first partition for external_sd card and 6 more of same size as original ones (size checked by parted and from rawprogram_unsparse.xml). Filesystems: system, userdata, cache & persist of ext4 while misc, recovery of linux-swap (though 'dd' will overwrite them).
Then I unsparsed userdata, system and cache images from factory firmware (on Windows used packsparseimg.exe binary). Sparsed images can only be flashed through fastboot?
Copied 5 prtitions images: userdata, system, cache, persist and misc using dd command to /dev/block/mmcblk1p*.
MODIFYING BOOT & RECOVERY:
Now coming to the changes in mount paths of boot and recovery (fstab and init.*.rc).
Extracted boot.img and then ramdisk using "Image Studio for Android". 'unpackbootimg' and 'abootimg' don't extract all files on Ubuntu. 'mkbootimg' makes smaller boot.img file without boot.img-dtb. Perhaps I'm doing it wrong.
Anyway, then did 'grep dev/block' on all extracted files. Results are attached for reference.
Made changes in "fstab.qcom" and "init.target.rc". For details on changes made, please read on RE-MODIFYING BOOT & RECOVERY.
Repacked boot.img
Similarly extracted recovery.img, did 'grep dev/block' on all extracted files. And made changes in "recovery.fstab".
Repacked recovery.img
COPYING IMAGES TO PARTITIONS AND BOOTING:
'fastboot flash boot boot.img' and 'dd if=recovery.img of=dev/block/mmcblk1p*' (though useless, have to boot from fastboot)
Rebooted to recovery by 'fastboot boot recovery.img'
userdata, persist and cache couldn't be mounted in TWRP. Tried 'mount -t ext4 -o loop *.img' on Ubuntu but there too not mounted. Googled and using commands 'file', 'fdisk', 'sfdisk', 'e2fsck' and finally 'resize2fs -f /*.img' resolved the problem "bad geometry: block count xxx exceeds size of device...".
Also unsparsed userdata too large to handle and only a few MBs data inside, that too useless. Therefore, did 'make_ext4fs' on cache & userdata.
Now booted kernel by 'fastboot boot boot.img'
And.......... it boots. But very very slow (due to slow write speed of sd card obviously). Took almost half an hour at first boot.
UNRESOLVED PROBLEMS:
There is no sound. Because of /persist not mounted? And still no SIM, means radio firmware isn't readable from eMMC or this too due to /persist absent? After all that contains drivers. And also Wi-Fi and bluetooth not working.
SECTION 2
RE-PARTITION SD CARD:
So re-created gpt on sd card (using parted and fdisk) and in a hope to utilize all necessary partitions, 100% replicated all partitions (except larger userdata) including space required at start and end of eMMC for partition table. Partition tables of both mmcblk0 and mmvblk1 are attached.
RE-MODIFYING BOOT & RECOVERY:
Made following changes in boot.img:
DEVICE BOOTS ALSO WITHOUT MAKING ANY CHANGES TO BOOT.IMG.
I don't know why but 'bootdevice' is automagiacally changed from 7824900.sdhci (eMMC) to 7864900.sdhci (external SD card). It seems there is some auto-detection mechanism.
Code:
########## ./ramdisk/fstab.qcom ##########
#/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait
#/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
#CHANGED TO
/dev/block/[B]mmcblk1p24[/B] /system ext4 ro,barrier=1,discard wait
/dev/block/[B]mmcblk1p32[/B] /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=footer
#/devices/soc.0/7864900.sdhci/mmc_host /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,noemulatedsd
#[B]disabled[/B]
Code:
########## ./ramdisk/init.target.rc ##########
on fs
mount_all fstab.qcom
#wait /dev/block/bootdevice/by-name/cache
#mount ext4 /dev/block/bootdevice/by-name/cache /cache nosuid nodev barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p26[/B]
mount ext4 /dev/block/[B]mmcblk1p26[/B] /cache nosuid nodev barrier=1
#wait /dev/block/bootdevice/by-name/persist
#mount ext4 /dev/block/bootdevice/by-name/persist /persist nosuid nodev barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p25[/B]
mount ext4 /dev/block/[B]mmcblk1p25[/B] /persist nosuid nodev barrier=1
#wait /dev/block/bootdevice/by-name/modem
#mount vfat /dev/block/bootdevice/by-name/modem /firmware ro context=u:object_r:firmware_file:s0,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337
#CHANGED TO
wait /dev/block/[B]mmcblk1p1[/B]
mount vfat /dev/block/[B]mmcblk1p1[/B] /firmware ro context=u:object_r:firmware_file:s0,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337
on charger
#wait /dev/block/bootdevice/by-name/system
#mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
#CHANGED TO
wait /dev/block/[B]mmcblk1p24[/B]
mount ext4 /dev/block/[B]mmcblk1p24[/B] /system ro barrier=1
Code:
########## ./split_img/boot.img-cmdline ##########
#console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1
#CHANGED TO
console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 [B]androidboot.bootdevice=7864900.sdhci[/B] lpm_levels.sleep_disabled=1
And following changes in recovery.img:
Code:
########## ./ramdisk/etc/recovery.fstab ##########
#/cache ext4 /dev/block/bootdevice/by-name/cache flags=display=Cache
#/system ext4 /dev/block/bootdevice/by-name/system flags=display=System
#/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384
#/persist ext4 /dev/block/mmcblk0p25 flags=backup=1;display=Persist
#/boot emmc /dev/block/bootdevice/by-name/boot flags=display=Boot
#/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1;display=Recovery
#/misc emmc /dev/block/bootdevice/by-name/misc /misc flags=backup=1;display=Misc
#/firmware vfat /dev/block/mmcblk0p1 flags=backup=1;display=Modem
#/splash emmc /dev/block/mmcblk0p18 flags=backup=1;display=Splash
#/fsg emmc /dev/block/mmcblk0p20 flags=backup=1;subpartitionof=/oem
#/aboot emmc /dev/block/mmcblk0p4 flags=backup=1;display=Aboot
#/abootbak emmc /dev/block/mmcblk0p5 flags=subpartitionof=/aboot;backup=1
#/hyp emmc /dev/block/mmcblk0p10 flags=backup=1;display=Firmware-update
#/sbl1 emmc /dev/block/mmcblk0p2 flags=backup=1;subpartitionof=/hyp
#/rpm emmc /dev/block/mmcblk0p6 flags=backup=1;subpartitionof=/hyp
#/tz emmc /dev/block/mmcblk0p8 flags=backup=1;subpartitionof=/hyp
#/hypbak emmc /dev/block/mmcblk0p11 flags=backup=1;subpartitionof=/hyp
#/sbl1bak emmc /dev/block/mmcblk0p3 flags=backup=1;subpartitionof=/hyp
#/rpmbak emmc /dev/block/mmcblk0p7 flags=backup=1;subpartitionof=/hyp
#/tzbak emmc /dev/block/mmcblk0p9 flags=backup=1;subpartitionof=/hyp
#/modemst1 emmc /dev/block/mmcblk0p13 flags=backup=1;display=EFS
#/modemst2 emmc /dev/block/mmcblk0p14 flags=backup=1;subpartitionof=/modemst1
#/oem emmc /dev/block/mmcblk0p30 flags=backup=1;display=OEM
#/DDR emmc /dev/block/mmcblk0p20 flags=backup=1;subpartitionof=/oem
#/fsc emmc /dev/block/mmcblk0p16 flags=backup=1;subpartitionof=/oem
#/ssd emmc /dev/block/mmcblk0p17 flags=backup=1;subpartitionof=/oem
#/pad emmc /dev/block/mmcblk0p12 flags=backup=1;subpartitionof=/oem
#CHANGED TO
/cache ext4 /dev/block/[B]mmcblk1p26[/B] flags=display=Cache
/system ext4 /dev/block/[B]mmcblk1p24[/B] flags=display=System
/data ext4 /dev/block/[B]mmcblk1p32[/B] flags=encryptable=footer;length=-16384
/persist ext4 /dev/block/[B]mmcblk1p25[/B] flags=backup=1;display=Persist
/boot emmc /dev/block/[B]mmcblk1p23[/B] flags=display=Boot
/recovery emmc /dev/block/[B]mmcblk1p27[/B] flags=backup=1;display=Recovery
/misc emmc /dev/block/[B]mmcblk1p15[/B] flags=backup=1;display=Misc
/firmware vfat /dev/block/[B]mmcblk1p1[/B] flags=backup=1;display=Modem
/splash emmc /dev/block/[B]mmcblk1p18[/B] flags=backup=1;display=Splash
/fsg emmc /dev/block/[B]mmcblk1p21[/B] flags=backup=1;subpartitionof=/oem
/aboot emmc /dev/block/[B]mmcblk1p4[/B] flags=backup=1;display=Aboot
/abootbak emmc /dev/block/[B]mmcblk1p5[/B] flags=subpartitionof=/aboot;backup=1
/hyp emmc /dev/block/[B]mmcblk1p10[/B] flags=backup=1;display=Firmware-update
/sbl1 emmc /dev/block/[B]mmcblk1p2[/B] flags=backup=1;subpartitionof=/hyp
/rpm emmc /dev/block/[B]mmcblk1p6[/B] flags=backup=1;subpartitionof=/hyp
/tz emmc /dev/block/[B]mmcblk1p8[/B] flags=backup=1;subpartitionof=/hyp
/hypbak emmc /dev/block/[B]mmcblk1p11[/B] flags=backup=1;subpartitionof=/hyp
/sbl1bak emmc /dev/block/[B]mmcblk1p3[/B] flags=backup=1;subpartitionof=/hyp
/rpmbak emmc /dev/block/[B]mmcblk1p7[/B] flags=backup=1;subpartitionof=/hyp
/tzbak emmc /dev/block/[B]mmcblk1p9[/B] flags=backup=1;subpartitionof=/hyp
/modemst1 emmc /dev/block/[B]mmcblk1p13[/B] flags=backup=1;display=EFS
/modemst2 emmc /dev/block/[B]mmcblk1p14[/B] flags=backup=1;subpartitionof=/modemst1
/oem emmc /dev/block/[B]mmcblk1p30[/B] flags=backup=1;display=OEM
/DDR emmc /dev/block/[B]mmcblk1p20[/B] flags=backup=1;subpartitionof=/oem
/fsc emmc /dev/block/[B]mmcblk1p16[/B] flags=backup=1;subpartitionof=/oem
/ssd emmc /dev/block/[B]mmcblk1p17[/B] flags=backup=1;subpartitionof=/oem
/pad emmc /dev/block/[B]mmcblk1p12[/B] flags=backup=1;subpartitionof=/oem
#/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="MicroSD Card";storage;wipeingui;removable
#CHANGED TO
# None. [B]External sd disabled[/B].
Code:
########## ./ramdisk/uneventd.rc ##########
#/dev/block/bootdevice/by-name/config 0660 system system
#CHANGED TO
/dev/block/[B]mmcblk1p29[/B] 0660 system system
Code:
########## ./split_img/recovery.img-cmdline ##########
#console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 androidboot.selinux=permissive
#CHANGED TO
console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom user_debug=30 msm_rtb.filter=0x3F ehci-hcd.park=3 [B]androidboot.bootdevice=7864900.sdhci[/B] lpm_levels.sleep_disabled=1 androidboot.selinux=permissive
Repacked boot.img and recovery.img.
RE-COPYING IMAGES TO PARTITIONS AND BOOTING:
Copied (dd) all available (15) images to (20) partitions on sd card.
Copied (dd) the 10 images not found in factory firmware from mmcblk0 to mmcblk1. (Not sure if successful).
2 partitions (/data and /cache) already formatted in ext4.
'fastboot boot recovery.img'. All partitions are mounted now. No horrible error lines.
'fastboot boot boot.img'
ROM booted successfully WITH sounds, SIM, Wi-Fi and Bluetooth. All seems working well so far.
SECTION 3
Continued on post 3...
hello hi
i have xiaomi redmi 2 chinesse version with same problem with your device. stuck logo, only still can access recovery TWRP via fastboot boot trwp.img.
twrp cant wipe, cant format, internal storage 0mb, "failed argument ".cant flash stock rom with flash tools "failed write partition", . try terminal parted rm not solve. try to many google same issue not solve. i think emmc or hardware issue
i never using linux and linux command so
please help me.make step by step guide , boot from sdcard .
- make partition sd card to be like emmc partition block
- can i using windows os or using small linux distro
- how to modif image stock rom ,kernel ,and flashing to sdcard
- how to boot from sdcard
many thank you
Continued from OP...
SECTION 3
QUERIES:
UNCERTAIN PARTITIONS
But there are no images available for these 10 partitions in factory firmware:
pad, modemst1, modemst2, fsc, ssd, DDR, keystore, config, oem & devinfo.
These seem to be very essential for OS, also containing IMEI if I'm not mistaken? I'm not sure of their contents. How system working without them? All are useless?
HOW TO COMPLETELY BOOT FROM SD CARD
In boot.img, "fstab.qcom" contains mount paths for system & userdata. While "init.target.rc" contains only mount paths for cache, persist and modem. In total 5 partitions which are mounted (checked by 'mount').
Code:
[email protected]:/ $ mount | grep mmcblk1
/dev/block/mmcblk1p24 /system ext4 rw,seclabel,relatime,discard,data=ordered 0 0
/dev/block/mmcblk1p32 /data ext4 rw,seclabel,nosuid,nodev,relatime,discard,noauto_da_alloc 0 0
/dev/block/mmcblk1p26 /cache ext4 rw,seclabel,nosuid,nodev,relatime 0 0
/dev/block/mmcblk1p25 /persist ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered 0 0
/dev/block/mmcblk1p1 /firmware vfat ro,context=u:object_r:firmware_file:s0,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=437,iocharset=iso8859-1,shortname=lower,errors=remount-ro 0 0
[email protected]:/ $
So the primary question is:
How to change mount source of other partitions from mmcblk0 to mmcblk1? Or how to force OS to read the essentially required partitions from mmcblk1 instead of mmcblk0?
Need to modify any other files in ramdisk or kernel-zimage or in /system or to modify init.d scripts or create new scripts? Any help?
Other than 10 partitions mentioned above, these "not mounted" partitions also include modem, sbl1, aboot, rpm, tz and hyp and fsg. Modem contains bootable code of MBR and following 5 are also executable binaries. I think these are all part of bootloader i.e. loading in initial booting process and not required by OS. But what about the fsg and ten others? Where are those used? Here is a partition detail.
Another primary issue is:
I think it's almost impossible to make Boot ROM (CPU embedded) hand over charge to bootloader at "mmcblk1". "mmcblk0" must be hardcoded in Boot ROM.
So, how to make bootloader load "kernel" and "rootfs" from mmcblk1p* instead of mmcblk0p*? Like there are switches in testing devices to optionally boot from different memories. Can we modify "aboot" (the little kernel) or "emmc_appsboot.mbn" ELF binary for this purpose? It must be complicated as bootloaders are signed by vendor (Qualcomm) and involve low-level programming as discussed here. Right?
Or in other words, how to force bootloader to read partition table from dev/mmcblk1 instead of dev/mmcblk0?
If we can't do this, system doesn't know how to boot in the absence of eMMC. That would have to be done through fastboot everytime we need to. Because boot chain will be stuck at bootloader.
Multi-booting solutions are also dependent on a fully working /boot partition on eMMC because they (one way or the other) re-flash/replace modified boot image every time a ROM is to be switched. EFIDroid is a secondary bootloader but that too replaces /boot and/or /recovery.
I have gone through this, this, this and this. But they only address partial booting from sd card e.g. dual booting in which only /system, /data and /cache are involved. None has discussed complete boot from sd. Is it really impossible? This link gives a little hope but it points to a ready made solution (bootloader) which boots kernel from SD card. But it gives no explanation how.
I have also come across a few threads discussing Samsung (and HTC too) booting from SD Card as a fix to QHSUSB_DLOAD mode or bricked-bootloaader state. They extracted "debrick" file from a working phone and flashed that to the start of SD Card. Debrick file seems to be a single bootloader file containing all bootloaders in it as explained here and here. So after flashing the bootloader(s) with its accompanying partitions to SD Card, when device was powered on, it automatically booted from SD Card. If it's that simple for all devices with Qualcomm SoC, the only thing I have to do is :laugh:
Code:
[COLOR="Red"]dd if=/dev/zero of=/dev/block/mmcblk0 bs=1m count=200[/COLOR]
Any suggestions? I believe this must be possible as they are discussing here.
Edit: Related quote from [GUIDE][9008][EDL|QDL][QUALCOMM ONLY] Unbrick via external sdcard (no QFIL!):
On eMMC devices, the boot path is /dev/block/mmcblk0. If you have a 9008 brick, the SD card is seen as /dev/block/mmcblk0 so the phone will boot from it on an eMMC device.
Click to expand...
Click to collapse
Some secondary questions:
HOW ARE PARTITIONS IDENTIFIED BY BOOT-ROM WITHOUT PARTITION TABLE ON eMMC
If there is no readable partition table on a bricked eMMC, how Boot ROM (primary bootloader on SoC) switches control to secondary bootloader or bootable modem partition or other partitions used by processors? Means how SoC / Processors locate modem, sbl, rpm, tz or aboot (the little kernel's offspring) on eMMC? Also, why 'parted /dev/block/mmcblk0 p' and 'sgdisk --print /dev/block/mmcblk0'show partitions if there is no table?
Though parted-2.2 shows warning:
Code:
[COLOR="Red"]Error: Both the primary and backup GPT tables are corrupt. Try making a fresh
table, and using Parted's rescue feature to recover partitions.[/COLOR]
Or I'm thinking in wrong direction? This link discusses the issues but I'm not clear how it works.
Once the a device is powered on it starts code from a know location (ROM) and looks for the first stage bootloader in a specific block.
Click to expand...
Click to collapse
How is this "specific block" located by cpu ROM?
It's talking about some "low-level" and "high-level" partition tables. How they differ? How can we manipulate the former?
And finally...
HOW TO SPEED UP SD CARD
Other than using a UHS-III or the most recent and expensive App Performance Class (A1) sd card, what changes we can make to kernel to boost read/write speed? Otherwise, it's almost useless with too slow speed, frequent ANRs, hangs and laggings.
Default I/O scheduler being used on QMobile Z8 is cfq with default tune-able settings. I think it's one of best schedulers for higher throughput. Na? Try other? Details here:
Code:
[email protected]:/ # cat /sys/block/mmcblk0/queue/scheduler
noop deadline row [cfq]
[email protected]:/ # for fyle in $(find /sys/block/mmcblk0/queue/iosched/ -type f); do echo $fyle; cat $fyle; done;
/sys/block/mmcblk0/queue/iosched/fifo_expire_async
50
/sys/block/mmcblk0/queue/iosched/group_idle
0
/sys/block/mmcblk0/queue/iosched/quantum
20
/sys/block/mmcblk0/queue/iosched/slice_async
40
/sys/block/mmcblk0/queue/iosched/slice_idle
10
/sys/block/mmcblk0/queue/iosched/slice_sync
100
/sys/block/mmcblk0/queue/iosched/low_latency
0
/sys/block/mmcblk0/queue/iosched/fifo_expire_sync
50
/sys/block/mmcblk0/queue/iosched/back_seek_max
16384
/sys/block/mmcblk0/queue/iosched/target_latency
300
/sys/block/mmcblk0/queue/iosched/back_seek_penalty
2
/sys/block/mmcblk0/queue/iosched/slice_async_rq
2
[email protected]:/ # cat /sys/block/mmcblk1/queue/scheduler
noop deadline row [cfq]
[email protected]:/ # for fyle in $(find /sys/block/mmcblk1/queue/iosched/ -type f); do echo $fyle; cat $fyle; done;
/sys/block/mmcblk1/queue/iosched/fifo_expire_async
50
/sys/block/mmcblk1/queue/iosched/group_idle
0
/sys/block/mmcblk1/queue/iosched/quantum
20
/sys/block/mmcblk1/queue/iosched/slice_async
40
/sys/block/mmcblk1/queue/iosched/slice_idle
10
/sys/block/mmcblk1/queue/iosched/slice_sync
100
/sys/block/mmcblk1/queue/iosched/low_latency
0
/sys/block/mmcblk1/queue/iosched/fifo_expire_sync
50
/sys/block/mmcblk1/queue/iosched/back_seek_max
16384
/sys/block/mmcblk1/queue/iosched/target_latency
300
/sys/block/mmcblk1/queue/iosched/back_seek_penalty
2
/sys/block/mmcblk1/queue/iosched/slice_async_rq
2
[email protected]:/ #
Tried different cache values (read_ahead_kb) from 64 to 4048. Makes no difference apparently.
Also disabled jounalling using 'tune2fs -O ^has_journal' and e2fsck checks using 'tune2fs -c -1'.
Changed mount options to for /data and /cache:
Code:
[email protected]:/ # mount | grep -E "/cache|/data"
/dev/block/mmcblk1p32 /data ext4 rw,seclabel,[B]noatime,discard,nobarrier,noauto_da_alloc,commit=60[/B] 0 0
/dev/block/mmcblk1p26 /cache ext4 rw,seclabel,noatime,discard,nobarrier,noauto_da_alloc,commit=60 0 0
[email protected]:/ #
Seems useless so far. Any ideas? Or it's a hardware limitation of device?
Is there a way to get rid of FUSE and use ext4 in true sense for whole /data (only possible if someone is willing to quit using MTP), though it doesn't matter much for Android's internal operations? But it's a real pain for I/O operations on external media.
Edit: Speed much improved by using a more certain branded SD Card; Sandisk C-10.
@yoAeroA00 Sir need your special attention for kernel part. You have a good history with kernel tweaking and multibooting.
I try to manual flash commands, one by one read from flash_all.bat. everything is okay finish, except file "gpt_both0.bin" and "sec.dat"
jeksparo said:
I try to manual flash commands, one by one read from flash_all.bat. everything is okay finish, except file "gpt_both0.bin" and "sec.dat"
Click to expand...
Click to collapse
If flasher is unable to flash partitions, then flashing manually won't make any difference. "gpt_both0.bin" contains partition tables; main and backup. First sector is protective mbr for legacy partitioning tools and next 33 sectors contain gpt partition table. A backup of partition table is stores on last 33 sectors of disk or emmc in our case. Total 67 sectors make 33.5 KiB size which is same as that of gpt_both0.bin. Let me have a look at partition table for further clarity. Run these from twrp to save your partition table.
Code:
sgdisk -p /dev/block/mmcblk0 > pt1
parted /dev/block/mmcblk0 p free > pt2
cant compile sgdisk -p /dev/block/mmcblk0 > pt1 invalid option --p
and parted /dev/block/mmcblk0 > pt2 blank line after entering
my device shell dont have parted command, so i run parted from sd card.
how to created gpt on sdcard using parted and fdisk, if my parted command in sdcard too, it is possible?
jeksparo said:
cant compile sgdisk -p /dev/block/mmcblk0 > pt1 invalid option --p
and parted /dev/block/mmcblk0 > pt2 blank line after entering
my device shell dont have parted command, so i run parted from sd card.
how to created gpt on sdcard using parted and fdisk, if my parted command in sdcard too, it is possible?
Click to expand...
Click to collapse
For sgdisk use --print as help shown in your screenshot.
Code:
sgdisk --print /dev/block/mmcblk0 > /part_table
"> /partition_table" is to save the output in root directory so that you can copy paste it. Otherwise you can also take screenshots in TWRP with PWR + VOL- combination.
'parted' doesn't come bundled with TWRP. You can use the binary from your SD card but you need to copy it somewhere else like '/sbin' if you want to partition you SD card. 'fdisk' can't create GPT, it's legacy tool for MBR partition scheme. You need to use 'parted', 'gdisk' or 'sgdisk' etc. to create partitions. Binaries for Android are with limited functionality. That's why Linux is preferred, but not necessary. Also the copying of partition images will be easy on Linux, though very slow if you connect card reader in virtual machine.
These partitions on your device contain filesystem and will be mounted in ROM
modem vfat
system ext4
cache ext4
persist ext4
userdata ext4
Click to expand...
Click to collapse
Boot and recovery partitions can also be used if your partition table isn't too corrupt to recognize them. Otherwise you'll have to use fastboot on every boot like me.
Simple is to duplicate the whole internal partition table on SD card because rest of the partitions don't occupy much space. It makes partition numbering easy.
But before creating partitions, you need to know exact boundaries in bytes:
Code:
parted /dev/block/mmcblk0
(parted) u b
(parted) p free
(parted) q
please hellp me
Hiii . i have wiko ridge 4g and i have the same problem as you it stuck on wiko logo and when i try to flash it with stock rom from wiko site nothing hapend and i tried to flash it using Qfil in the log i see "Read back verify failed at sector" the same problem as you sooooo please make step by step guid
i can boot to download mode . when i try to boot to recovery it boot to fastboot mode automaticly .....plz help me..... -sorry for my english-
_6ix._.9ine said:
Hiii . i have wiko ridge 4g and i have the same problem as you it stuck on wiko logo and when i try to flash it with stock rom from wiko site nothing hapend and i tried to flash it using Qfil in the log i see "Read back verify failed at sector" the same problem as you sooooo please make step by step guid
i can boot to download mode . when i try to boot to recovery it boot to fastboot mode automaticly .....plz help me..... -sorry for my english-
Click to expand...
Click to collapse
On what part you need help? It's all about partitioning an sd card and copying data to it. Then unpack, modify and re-pack boot.img
plllllz help me
mirfatif said:
On what part you need help? It's all about partitioning an sd card and copying data to it. Then unpack, modify and re-pack boot.img
Click to expand...
Click to collapse
i've been trying to understand what u wrote for the last 7 days and i couldn't understand shiiiit :crying:
i don't know anything about this shiiiit :crying: i'm so sad plz make video and upload it on youtube and show me step by step how did u boot from sd card plllllllllllllllllz _sorry for my english_
MODIFYING BOOT & RECOVERY:
Now coming to the changes in mount paths of boot and recovery (fstab and init.*.rc).
Extracted boot.img and then ramdisk using "Image Studio for Android". 'unpackbootimg' and 'abootimg' don't extract all files on Ubuntu. 'mkbootimg' makes smaller boot.img file without boot.img-dtb. Perhaps I'm doing it wrong.
Anyway, then did 'grep dev/block' on all extracted files. Results are attached for reference.
Made changes in "fstab.qcom" and "init.target.rc". For details on changes made, please read on RE-MODIFYING BOOT & RECOVERY.
Click to expand...
Click to collapse
In that part I used the "ABOOTIMG". To work, do the following:
Code:
$ sudo abootimg -x boot.img ramdisk ramdisk kernel kernel
or
Code:
#abootimg -x boot.img ramdisk ramdisk kernel kernel
You will find 3 files. The "RAMDISK" comes packaged in "GZIP". Unzip it and enter the folder that will be created. Inside this folder you will have the files to edit as the post follows.
By the way, congratulations for the initiative!
Turkish
Nothing is understood when it is translated. Can a British English translate this to me?
Thanks you very much for your great story and for a lot of informations!
Peace & Respect
mirfatif,
thanks for this interesting and promising information!
I'd like, though, get an additional explanation: you use "fastboot" to handle your smartphone. Does it mean,
that it was bootable when you've started all this stuff with booting from SD-card?
I'm asking because I'm trying to boot my samsung galaxy GT-N7100 from sd-card with completely dead emmc.
igorbounov said:
you use "fastboot" to handle your smartphone. Does it mean,
that it was bootable when you've started all this stuff with booting from SD-card?
Click to expand...
Click to collapse
My phone doesn't have "completely" dead eMMC. Booting process works up to bootloader (aboot) and it's related partitions. So fastboot works (as it's managed by bootloader). But after that, bootloader can't load boot image (kernel) from boot partition. Neither recovery partition is readable. Thus I have to do it manually using fastboot. And the remaining OS related partitions are read from SD card.
mirfatif said:
My phone doesn't have "completely" dead eMMC..
Click to expand...
Click to collapse
Now I get the idea... Nevertheless it looks like now I should stop attempts recovering smartphone because while trying I've turned
(somehow) my available 64Gb Samsung SD-card to a write-protected state (while partitioning). So my further experiments seem
not worth it - now it looks like buying a new Galaxy Note with a new SD-card is more cost-effective.
igorbounov said:
I've turned
(somehow) my available 64Gb Samsung SD-card to a write-protected state (while partitioning).
Click to expand...
Click to collapse
Are you unable to create a new partition table using parted/fdisk/gdisk?
mirfatif said:
Are you unable to create a new partition table using parted/fdisk/gdisk?
Click to expand...
Click to collapse
No, I've used everything - even Windows-oriented utilities for low level formatting. All of them complain that
this SD card is write-protected. It has stuck in a strange state - a gpt table created, but no partitions.
And some programs (sfdisk or sgdisk, and even diskpart from Windows) find there some inconsistences.
Perhaps the inner electronics thinks that this errors correspond to a worn state - and sets this read-only attribute.
When I partitioned this sd-card, I've first created the new gpt table, then for a long time speculated about which
partition of what type and size should be created. In this process I've opened two or maybe more parted and
gparted sessions, and then I've saved partitions from one session, then maybe from other... and now this
memory card is in read-only state. Perhaps it has decided that this is the most safe way.
igorbounov said:
No, I've used everything - even Windows-oriented utilities for low level formatting....
Click to expand...
Click to collapse
How did you connect SD card to PC? I mean USB card reader, SD card slot etc. Sometimes card reader drivers are causing the problems. Are you using Linux / Windows natively or on a VM? Did you try creating partition table on Android phone? Usually phones can handle SD cards better. Try card slot or OTG, in TWRP or from ROM, using arm or aarch64 binaries of parted, fdisk and gdisk. Command line tools are preferable for troubleshooting than GUI tools.
mirfatif said:
How did you connect SD card to PC? I mean USB card reader, ...
Click to expand...
Click to collapse
I've used a chip USB card reader. Linux and Windows natively and Windows in a VM (QEMU/KVM). I haven't yet found some other volunteer with Android phone to put my SD card there. My old faithfull Nokia 6131 just don't see this card (and shouldn't, there are no partitions and Nokia 6131 cannot handle sd cards of such size). Yesterday I've used an old card reader, that is built in my daughter's PC, I've used for that purpose a special SD casing for microSD - Windows disk management confirmed that this SD card is read-only.
May be some embedded device could help in this situation - some AVR- or STM32-based device via SPI (than it doesn't matter wether there is some protection or no).

Categories

Resources