Tried to partition Internal SD Card and destroyed pretty much everything - Android Q&A, Help & Troubleshooting

Hey there,
I own an Oppo Find 5 and because of the limited internal app storage I wanted to partition the internal sdcard to use Link2SD.
I followed some guides found on the internet and I managed to create 2 partitions(FAT32+EXT3) with Minitool, but sadly something went wrong. The phone was unable to mount them, and although I was able to use it I couldn't (and I still can't) save pics/video/other stuff anymore.
After that I decided to revert all the changes, but once again it did not work as expected. Now I have a 25GB FAT32 (as it was before) partition that can't be mounted even if the phone can detect it.
This is my /etc/fstab file:
Code:
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 rw
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 rw
/dev/block/mmcblk0p29 /storage/sdcard0 fat32 rw
This the output of fdisk:
Code:
[email protected]:/ # fdisk -l /dev/block/mmcblk0p29
fdisk -l /dev/block/mmcblk0p29
Disk /dev/block/mmcblk0p29: 27.1 GB, 27141324288 bytes
255 heads, 63 sectors/track, 3299 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p29p1 1 2612 20974592 b Win95 FAT32
I tried to mount it via adb shell (while the phone was in recovery mode, CWM) and even in runtime, but it doesn't work. Same goes with "format /storage/sdcard0" in CWM.
Below you can find a "screenshot" (had to use a camera, sorry but I can't do proper screenshots anymore because of this). As you can see the mmcblk0p29 partition is detected but not mounted.
Any suggestions? Thanks a lot in advance for your help.

Related

ext2 support?

Specifically, what do I need to install on my gtab so that it can read an sdcard formatted to ext2?
I've already installed Clockworkmod and Vegan-Tab Ginger. Maybe I need a different kernel too? I know very little about kernels - Are they device specific? Are they interchangeable? Can I change the kernel without wiping my files?
Has anyone ever had success with ext2 on the gtab?
deadfraggle said:
Specifically, what do I need to install on my gtab so that it can read an sdcard formatted to ext2?
Click to expand...
Click to collapse
Nothing.
I know very little about kernels - Are they device specific?
Click to expand...
Click to collapse
They have to be--that's their function after all.
Are they interchangeable?
Click to expand...
Click to collapse
They should be. For the gTablet, you can use either the Clemsyn or Pershoot kernels. Both have native extn support.
Can I change the kernel without wiping my files?
Click to expand...
Click to collapse
Yes.
Has anyone ever had success with ext2 on the gtab?
Click to expand...
Click to collapse
ext2/3/4 are all natively supported by the linux kernel, and issuing a mount command will work if you do it on the command line. However, the automounter program, called vold, likes to have ext4 or VFAT (aka FAT32) filesystems on the SD card. If your ext2 formatted SD card is not automatically mounted, format it again as ext4.
Formatted the sdcard to ext4, but still cannot read anything off it.
As for mounting through the terminal, if I use
fdisk -l
it shows nothing, not even an error. Is there another way to list disks so I know what to mount?
What I'm trying to do is use the Debian installer for Android, but the only version I could find is 2 years old. It's probably based on Lenny or earlier which does not have native ext4 support.
deadfraggle said:
Formatted the sdcard to ext4, but still cannot read anything off it.
Click to expand...
Click to collapse
What ROM are you on? Are you running Android or something else?
As for mounting through the terminal, if I use
fdisk -l
it shows nothing, not even an error. Is there another way to list disks so I know what to mount?
Click to expand...
Click to collapse
Code:
$ su
# /system/xbin/fdisk -l /dev/block/mmcblk3
Disk /dev/block/mmcblk3: 16.0 GB, 16097738752 bytes
255 heads, 63 sectors/track, 1957 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk3p1 1 1709 13720703 c Win95 FAT32 (LBA)
/dev/block/mmcblk3p2 1709 1958 1999744+ 83 Linux
Use /dev/block/mmcblk2 for the external SD card. Mount it as:
Code:
$ su
# mount /dev/block/mmcblk2p1 /some/path
or
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /some/path
rajeevvp said:
What ROM are you on? Are you running Android or something else?
Click to expand...
Click to collapse
Vegan-Tab Ginger edition
rajeevvp said:
Code:
$ su
# /system/xbin/fdisk -l /dev/block/mmcblk3
Click to expand...
Click to collapse
This gives me similar results to yours.
rajeevvp said:
Use /dev/block/mmcblk2 for the external SD card. Mount it as:
Code:
$ su
# mount /dev/block/mmcblk2p1 /some/path
Click to expand...
Click to collapse
My result:
Code:
$ su
# mount /dev/block/mmcblk2p1 /micro
mount: mounting /dev/block/mmcblk2p1 on /micro failed: No Such file or directory
Also tried
mount /dev/block/mmcblk2p2 /micro
with the same result.
rajeevvp said:
or
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /some/path
Click to expand...
Click to collapse
My result:
Code:
$ su
# mount -t ext4 /dev/block/mmcblk2p2 /micro
mount: mounting /dev/block/mmcblk2p2 on /micro failed: No Such file or directory
Edit:
If I insert a ext2 formatted sdcard, I get a notice that it is being scanned for errors. It goes away after a minute or so.
If I go to /sdcard2 in Root Explorer, the folder is empty but the stats show a correct 2 gb of used space and the correct amount of free space.
(Also in Root Explorer, if I try to create a test file, it says 'successful' but no file is created.)
If someone here owns a gtab and can access a ext2/4 sdcard, please let me know what setup/Rom you are using. Or if you own an extra sdcard you can format to ext2, and use some other aftermarket ROM/different kernel on your gtab, please test and post your results.
The commands I gave were just examples, you'll have to adjust them to suit your system.
deadfraggle said:
If I insert a ext2 formatted sdcard, I get a notice that it is being scanned for errors. It goes away after a minute or so.
Click to expand...
Click to collapse
That looks like the correct behaviour. The external SD card is being fsck'd and then automounted.
If I go to /sdcard2 in Root Explorer, the folder is empty but the stats show a correct 2 gb of used space and the correct amount of free space.
Click to expand...
Click to collapse
This, again, is correct, except that on a newly created filesystem, Root Explorer should've shown a lost+found directory.
(Also in Root Explorer, if I try to create a test file, it says 'successful' but no file is created.)
Click to expand...
Click to collapse
Reformat the filesystem again and try creating a file using the command line:
Code:
$ su
# echo test > /mnt/sdcard2/test.txt
# cat /mnt/sdcard2/test.txt
test
#
My external SD card is formatted as ext3 and I have no problem using Root Explorer. With other file managers, you'll have to be careful because of the standard Unix permissions that come into effect on all extn filesystems. If you want to use file managers other than Root Explorer, just create a new directory on your ext2 filesystem and give that directory a user of "system" and a group of "sdcard_rw", and give (at least) the group "rwx" permissions. Use the user, group and permissions of the /mnt/sdcard directory as a guide:
Code:
$ ls -ld /mnt/sdcard
d---rwxr-x 22 system sdcard_rw 8192 Jan 1 1970 /mnt/sdcard
$ su
# mkdir /mnt/sdcard2/user-dir
# chmod 0775 /mnt/sdcard2/user-dir [I]#or 0075 to exactly match /mnt/sdcard[/I]
# chown system.sdcard_rw /mnt/sdcard2/user-dir
If you don't want to bother with all this, just format the SD card as VFAT, and Android will automatically mount the VFAT filesystem with an owner of "system" and a group of "sdcard_rw". And since (all?) file managers belong to the "sdcard_rw" group, they get automatic read-write permissions to that filesystem. BTW, the Terminal Emulator app also belongs to the "sdcard_rw" group, so you can freely write onto VFAT formatted SD cards on the command line without resorting to the 'su' command (the example above).
Granted, it's been a while since I researched this - but I learned many months ago that the version of VOLD in Froyo does not support anything else but vFAT - so it just won't mount EXT2, or NTFS for that matter.
the mount command would bypass VOLD and we know that NTFS should work, if it's a custom kernel. Conceivably EXT2 should also work, but since it was all manual scripting I just stopped researching it - mainly because I'd still have issues using the card with other devices so it wouldn't really be a portable solution anymore.
As much as I detest FAT32 for its file size limitations, it's still the "standard" between portable devices. The various vendors have yet to figure out a replacement, since they can't seem to agree on anything.
rajeevvp said:
My external SD card is formatted as ext3 and I have no problem using Root Explorer.
Click to expand...
Click to collapse
Figures. Never tried ext3, mainly because it's not a readily available option in Ubuntu. Tried to format to ext3 via the terminal but got a weird error, even after unmounting the drive:
"/dev/sdb is apparently in use by the system; will not make a filesystem here!"
So I booted in to Parted Magic with my netbook, wiped the sdcard, and created a new ext3 partition.
Success!!
The sdcard auto-mounts, and is accessible by Root Explorer, ES File Explorer and File Manager.
Ext3 will suit my purposes just fine. Sorry to make you write all the rest of your post, but it will be a handy reference.
Thank you a million times over!
@ roebeet
I'm humbled this post got your attention. Thanks for the great work!
deadfraggle said:
Figures. Never tried ext3, mainly because it's not a readily available option in Ubuntu.
Click to expand...
Click to collapse
The ext3 format was the default filesystem of Ubuntu, until just recently. It is generally considered better to use ext2 on a SD card. Since a SD card has a limited number of read/writes, a journaling filesystem like ext3/ext4 would use up the limited number of read/writes faster than using ext2. Also, never create a swap partition on a flash drive or SD card.
To format a SD card in Ubuntu, first determine the device name:
Code:
[email protected]:~$ sudo fdisk -l
[sudo] password for paul:
Disk /dev/sda: 64.6 GB, 64609058816 bytes
255 heads, 63 sectors/track, 7854 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000d996
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3890 31246393+ 83 Linux
/dev/sda2 3891 7854 31840830 83 Linux
Disk /dev/sdb: 16.4 GB, 16437477376 bytes
255 heads, 63 sectors/track, 1998 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3366
Device Boot Start End Blocks Id System
/dev/sdb1 1 1998 16048903+ 83 Linux
My EEEPC has a 64 GB hard drive, and a 16 GB SDHC card. So the card I want to format is /dev/sdb1. Use fdisk again for the formatting, here are the steps copied directly from my terminal:
Run commands with root privileges (sudo).
Find the disk:
# sudo fdisk -l
Format the disk (sdb1):
# sudo fdisk /dev/sdb1
Command (m for help):d (delete any existing partitions)
Command (m for help):n (create a new partition)
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):1
Command (m for help):w (to write the changes to the disk)
Format the card. You may need to unmount it first:
# sudo umount /dev/sdb1
# sudo mkfs -t ext3 /dev/sdb1

first adb action

Hi to all. I'm Abe Wayer.
I'm dreaming to start changing at first my own mobile OS end maybe going to develop a day.
Today it's just all the afternoon that i google....
I became root, I partitioned my sd and installing sdk & adb tools in a couple of days.
something goes quickly something not.
I have a galaxy ace with 2.3.6
I thought to start my develop time using adb.
first at all adb push.
So i made:
adb push test.txt /sdcard/test.txt
And i have: permission denied
I googled a lot and nothing worked:
Debug usb is on.
I umounted sdcard from /media (I use linux)
I've tried this as well:
mount -o remount , rw /dev/block/void/179:9 /sdcard
or
mount -r -w -o remount -t vfat /dev/block/void/179:9 /sdcard
But nothing work!
If im not able to push a file on a sd what i dream for?
My sdcard has two partition linux call them sdc1 & sdc2 first is 1500 Mib second 400
Thanks for your help
No Links too?
Please give me a hand!:crying:
Dont you have a guide ive not fought?
Please.....
News:
I've tried:
adb shel => su =>fdisk -l
and i've got the device name but if do:
# mount rw -o remount, rw -t fat32 /dev/stl10 /sdcard
I always have:
Usage: mount [-r] [-w] [-o options] [-t type] device directory
But is there somewhere on the web an adb shel man complete with examples?
How do i obtain -w permission on my sd card?
adb pull works so i can read....
if i try ls -l /sdcard i got: lrwxrwxrwx root root 2012-12-18 02:01 sdcard -> /mnt/sdcard
So root can write.
Have i to change owner to the card?
Or simply with adb i'd say i'm root?
have i to umount sdcard?
Please!
Abe Wayer said:
# mount rw -o remount, rw -t fat32 /dev/stl10 /sdcard
Click to expand...
Click to collapse
Wrong usage, correct usage (provided that the device is correct):
Code:
mount -o rw, remount -t fat32 /dev/stl10 /sdcard
RoberGalarga said:
Wrong usage, correct usage (provided that the device is correct):
Code:
mount -o rw, remount -t fat32 /dev/stl10 /sdcard
Click to expand...
Click to collapse
Doesn't work as well.
my fdisk -l output is this:
# fdisk -l
Disk /dev/bml10: 41 MB, 41943040 bytes
255 heads, 63 sectors/track, 5 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/bml10 doesn't contain a valid partition table
Disk /dev/stl10: 37 MB, 37748736 bytes
255 heads, 63 sectors/track, 4 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Abe Wayer said:
if i try ls -l /sdcard i got: lrwxrwxrwx root root 2012-12-18 02:01 sdcard -> /mnt/sdcard
So root can write.
Click to expand...
Click to collapse
You don't know that. This is just a symbolic link, not the volume itself. Do:
$ ls -l /mnt/sdcard
This will show you if the card is mounted properly. Also issue a "mount" command, no parameter. But you should not need to remount it, the sdcard is handled by magic via the vold daemon. As soon as you remove it from the GNU/Linux machine, vold will mount it in Android.
kuisma said:
Y
Do: $ ls -l /mnt/sdcard
.
Click to expand...
Click to collapse
With ls - /mnt I have:
# ls -l /mnt/
drwxr-xr-x root system 2012-12-18 02:01 obb
drwxr-xr-x root system 2012-12-19 14:27 asec
drwx------ root root 2012-12-18 02:01 secure
d--------- system system 2012-12-18 02:01 sdcard
So sdcar has not permissions?
mount about sdcard says
/dev/block/vold/179:9 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:9 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
It goes to be mounted rw but for some errors it came to be remounted ro?
I've proved with:
mount -o rw, remount -t vfat /dev/block/vold/179:9 /sdcard , And
mount -o rw, remount -t vfat /dev/block/vold/179:9 /mnt/sdcard
but the answer's always:
Usage: mount [-r] [-w] [-o options] [-t type] device directory
any ideas?
/dev/block/vold/179:9 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,g id=1015,fmask=0702,dmask=0702,allow_utime=0020,cod epage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
Click to expand...
Click to collapse
Your sdcard is mounted just fine, no need to try to change anything there. Don't confuse the sdcard with its mount point, different things.
Make sure you've got read access to your test file, and push it to some place you know you are allowed to write. And use the full path /mnt/sdcard/file.name just to be sure.
Also, again, do a "ls - l /mnt/sdcard" to see its really there.
I had the same problem when I didn't root correctly, check if you have root correctly by using a root app. (like root checker or root explorer)

Mounting an image made with adb pull ...

I had a S3 i9300 and I want to check if I can recover some files from data partition
after a hard reset.
I have been able to get an image of data partition with
Code:
adb pull /dev/block/mmcblk0p12 mmcblk0p12.img
My problem is to mount this image on linux.
I tried of course:
Code:
mount -o loop,ro -t auto mmcblk0p12.img ./galaxys3/
but I get ..
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
I tried to understand what was going on with fdisk ...
Code:
# fdisk -l mmcblk0p12.img
Disk mmcblk0p12.img: 11.5 GiB, 12381585408 bytes, 24182784 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
and it doesn't seem to find a partition and give the offset.
anyway android mount that block like that ...
Code:
/dev/block/mmcblk0p12 /data ext4 rw,nosuid,nodev,noatime,barrier=1,journal_async_commit,data=ordered,noauto_da_alloc,discard 0 0
any suggestions?
Anyway my goal is to run testdisk (photorec) on it.
TIA.
The fs will be in ext*. Android isnt linux, thats why it works on android and not linux. That's why android needs busybox.
Sent from my HTC One M9 using Tapatalk
shivadow said:
The fs will be in ext*. Android isnt linux, thats why it works on android and not linux. That's why android needs busybox.
Sent from my HTC One M9 using Tapatalk
Click to expand...
Click to collapse
Actually I manage to mount it on linux. I forgot to unmount the data partition
before make the image so it wasn't consistent ... I made a e2fsck and now I can easily
mount it.

[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).

Internal disk has on about 10, not about 30GB: how do I recover the disk space?

Hi all,
After having the Smartphone lex821 bricked* and recovering I now only see 10GB on the internal disk.
with adb and
# df -h
...
/dev/block/dm-0 9.7G 5.0G 4.7G 51% /data
/dev/block/dm-0 9.7G 5.0G 4.7G 51% /sdcard
...
# cat /proc/partitions gives (1kB Blocksize):
...
253 0 25536188 dm-0
I understand the dm-0 partition is about 25GB and but the mounted /data or /sdcard only has about 10GB: where did the other 15GB go?
side question:
ps: I also see in the partition table cat /proc/partitions a disk sda of about 25GB
...
8 0 25833472 sda
8 1 8 sda1
...
8 9 25536204 sda9
Is this space usable in any way? Or is this somehow the same as the dm-0 partition (or better: where do I find a description of the internal disk setup of the lemax2?)?
thanks in advance for your feedback,
Walter
* bricked and recovered with the flashone 2.0 tool. No running ...5.8.019s
Great I found the answer/solution myself...
it is here: on www dot androidbrick dot com page leeco-letv-x820-max-2-qdloader-9008-unbrick-twrpguide (sorry: cannot post a link in my message)
step 3 states: After your phone boots, you will see that its storage is abnormally 9.71 GB, to fix this just factory reset your phone choosing the option “Format Virtual SD card”. File system will be restored to normal values.
Indeed formatting the internal storage with TWRP solves the issue (and brings you back to a clean phone...)
Walter

Categories

Resources