Block image of USERDATA partition is missing media folder (Internal storage folder), but I can see the files in the phone - General Questions and Answers

Hello,
Every now and then I like to boot into recovery, unmount all partitions and make a image of the main block devices (SYSTEM and USERDATA) through adb as a backup. The USERDATA device should include a folder (media) containing the internal storage of the device where things like the Downloads folder is located.
However, I just noticed that if I mount the image in my Linux computer and navigate there, the folder is empty, even though the image has a reasonable size (27GB in a 32GB phone) and contains application data where it's supposed to.
By the sizes alone, there are no other block devices that could be hiding the missing files.
If I boot the phone back up and navigate to `/data/media/0` in termux, the files are there.
Am I missing something?
Additional Information:
Model: Samsung Galaxy S7
OS: LineageOS 18.1 (based on Android 11)
Recovery: TWRP
Command used for backup: adb pull /dev/block/platform/155a0000.ufs/by-name/USERDATA ~/Documents/emmc-backup-USERDATA.img
Thanks for any help.

Related

[HUAWEI U8350][Orange Barcelona] Rom backup and restore

If you already tried to backup the rom from your Huawei u8350 Boulder with CWM you must have realised it doesn't work. The culprilt? Huawei made 2 changes from the normal Android partition pattern: we got a /cust partition, thought so that phone provider can install their bloatwares, and for unknown reasons we got 2 userdata partitions.
But there is a solution, thanks to Gulyuk's great work.
Prerequisite:
A Huawei u8350 Boulder / Orange Barcelona (obviously),
A working ClockWorkMod Recovery for U8350,
The two attached scripts
How to use (again, i'll take Gulyuk's explanations):
Backup boot, system, cust via CWM recovery
Download Attached File backup_by_Gulyuk.zip (445.33K)
Number of downloads: 0 and put it on the microSD card (do not unzip).
Ensure that you have enough (about 261 MB) free space on the microSD card.
Enter ClockworkMod Recovery.
Select "install zip from sdcard" in the menu, then select the backup_by_Gulyuk.zip file. Wait for several minutes while the backup script works.
Select "reboot system now" to exit from recovery.
The backup script should create the firmware directory on the microSD card (seen as /sdcard/firmware from the phone) with these files:
boot.img — dump of the boot partition (kernel and initramfs);
recovery.img — dump of the recovery partition (the one you installed);
system.img — dump of the system partition in yaffs2 format;
cust.img — dump of the cust partition in yaffs2 format.
data.img — dump of the userdata partition in yaffs2 format.
data2.img — dump of the userdata partition in yaffs2 format.
Running the backup script when the /sdcard/firmware directory already exists overwrites the previous contents of this directory (including any extra files which were placed there). Currently there is no way to keep more than one firmware backup by this method, unless you rename the firmware directory manually (but then the backup cannot be restored until you rename or copy the directory back).
Restore boot, system, cust via CWM recovery
Download Attached File restore_by_Gulyuk.zip (260.83K)
Number of downloads: 0 and put it on the microSD card (do not unzip).
Ensure that you have the firmware directory on your microSD card with valid firmware image files (boot.img, recovery.img, system.img, cust.img, data.img, data2.img).
Enter ClockworkMod Recovery.
Select "install zip from sdcard" in the menu, then select the restore_by_Gulyuk.zip file. Wait for several minutes while the restore script works.
Select "reboot system now" to exit from recovery.
Warning! Warning! Warning!
I tested both scripts on by own u8350 and it's still working, but I give absolutely no warranty about these scripts and how they works. If your phone burns, bricks, looses faith in you or try to run away in love with the neighbourg's dog IT IS YOUR RESPONSIBILITY.
If you want to share your wonderfull customised ROM with these scripts delete data.img and data2.img before sharing as they contains your personnal datas (google accounts, emails, and so on...).
before to try someone else's ROM, backup yours, then copy the "firmware" drawer from the SDCard in a safe place (dedicated to a french fellow that lost its keyboard configuration ).
"install zip from sdcard" option not given
Hello. Noob here. I'm following the instructions for the section "Backup boot, system, cust via CWM recovery", but the "install zip from sdcard" option is not appearing so I need some guidance, please.
General info: Orange Barcelona, UK, unlocked, rooted and verified, no sim inserted. CWM is installed.SuperUser is installed. Debugging and Unknown Sources are enabled, Fastboot disabled. The sd card is mounted and has plenty of spare capacity. Recovery Manger, Restore.zip and backup_Gulyuk.zip are on the card.
Can someone please point out what the noob is doing wrong?
Thanks,
Kate
EDIT: I started again from scratch and now the phone just reboots from CWM so I now no longer get a menu at all.

[GUIDE][ROOT] Resizing emulated SD card and userdata partitions

I originally created this guide for Sony Xperia T/TL/TX/V and have since discovered that the method works for other devices, too. So I present the universal guide to getting rid of that annoyingly tiny allocation of space for internal storage in devices that have plenty of it.
Kudos to @teidus for pointing me to this long-forgotten method.
Screenshots of proof are attached to my original post.
WARNING: You will lose a lot of data if you don't follow this guide!
WARNING: These operations require a rooted device. If you are running unrooted Android 4.3 or newer, you cannot proceed.
NOTE: All of these changes will be reversed if you flash a factory image that contains a partition table.
DISCLAIMER: I'm not responsible for bricked devices and data loss from power surges, hardware damage, or changes to the linked software. Always check the native manuals for all the tools listed here!
I'm also not responsible for your curiosity and desire to resize other partitions. I haven't tried that because messing with /system and /cache can lead to unexpected results.
Requirements:
1. Your device must currently have root access, CMW recovery v6.0.4.6 or later, less than 50% allocated to internal storage, emulated SD card (usually, it's /storage/sdcard0), and at least 8GB of total onboard memory. If you answered "No" to at least one of these, this guide won't help you. To check whether you have an emulated SD card, remove your physical SD card, go into a file manager app, and see whether you still have some sdcard listed.
2. A factory image flashing software for your device unzipped and/or installed on your computer. Look in the relevant forums for downloads.
3. ADB from either Android SDK or your device's flashing tool. Look in the relevant forums for instructions.
4. For locked bootloaders, factory firmware image with Android v4.1.2 or v4.0.x saved on your computer (consult your flashing tool's manual for the default location) - nearly 100% of these have root exploits. Look in the relevant forums for downloads.
5. Root exploit with Superuser or SuperSU installer for your device unzipped on your computer. Look in the relevant forums for downloads.
6. CMW recovery installer v6.0.4.6 or later compatible with your device and the factory firmware version obtained in step 4 unzipped on your computer. Look in the relevant forums for downloads.
7. File system utilities (attached) unzipped to a folder on your device's physical SD card you'll remember (I'll be using /fs-utils in this guide).
8. For Windows 8 users, ADB drivers for your device.​
The Guide (skip all the way to the bottom for the short list of ADB commands):
1. Back up all data stored on internal storage:
Option 1: Connect your device to the computer and save it to a computer drive.
Option 2: Open a file manager on the device and copy it to a physical SD card (/sdcard1).​2. Back up your current installation with either Online Nandroid or your current recovery and remove the SD card for safety.
3. Flash your device with basic 4.1.2 install.
Refer to the documentation for your tool.​4. Connect your device to the computer and let the computer recognize it.
5. Enable USB debugging.
5.1 Go to (System) Settings -> Developer options and flip the switch in the top-right corner of the screen.
5.2 Look a bit down (toward the middle of the screen) and check USB debugging.​6. Root your device.
Refer to the documentation for your tool.​7. Install recovery on your device.
Refer to the documentation for your tool.​8. Boot into CMW recovery.
Depending on the device, reboot into recovery may be available in the power menu, or you'll need to press/hold a button during the power on sequence. Refer to the documentation for your recovery.​9. After the device boots into recovery, connect it to the computer.
10. Start ADB shell in command prompt.
Navigate to the folder where adb.exe resides, hold SHIFT, right click the mouse, and select Open command window here, then type adb shell in the command prompt and press ENTER.​11. Execute the following commands one-by-one (you can copy & paste, hit enter, and wait for the output):
Code:
umount /storage
parted /dev/block/mmcblk0
print
These commands unmount all drives, launch parted utility for mmcblk0 (onboard flash storage), and display the partition table on your screen.​12. Write down the info from the following columns for partitions Userdata and SDCard (or Media). Usually, they are the last 2 partitions.
Column 1 - Number, Column 2 - Start, Column 3 - End, Column 5 - File system, Column 6 - Name. The start of the first partition and the end of the second partition are the limits, within which your new partitions will be created. The numbers are in megabytes (MB) unless specified. Make sure the name is recorded just as it appears in the partition table - Andorid is case-sensitive.​13. Remove the 2 partitions by executing the following commands:
Adjust the numbers according to your system.​
Code:
rm 14
rm 15
14. Calculate the new start and end point for both partitions.
For the first partition, the start point will be the same. For the second partition, the end point will be the same. The end point of the first partition is the start point of the second partition.
Take the end number for the first partition you recorded in step 12, add more space to get the new end. Alternatively, if your first partition is actually the emulated storage, subtract the reallocated space to get the new end point. I advise to add at least 2GB (2048MB) to Userdata feel safe about having enough storage for apps. DON'T TRY TO REMOVE EMULATED STORAGE ALTOGETHER BY ALLOCATING ALL OF THE AVAILABLE SPACE TO USERDATA! Emulated storage is coded into OS environment and requires additional modifications to work properly.​15. Create and name new partitions by executing the following commands (don't copy the text in parentheses):
The system might throw several errors in the process. When prompted, just type ignore and hit ENTER.​
Code:
mkpartfs logical ext2 OLD_START NEW_END (change ext2 to fat32 if the first partition had that file system)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 NEW_START OLD_END (change ext2 to fat32 if the second partition had that file system; make sure to include GB as the designation of the end point in order to stretch the partition to the end of the onboard storage)
name 15 SDCard (change the number and the name according to your environment)
quit
These commands create the partitions with ext2 file system and given beginning and end parameters, rename them as required, and close parted.​16. "Damage" the internal, emulated SD card so that it could be formatted properly later. REMOVE YOUR PHYSICAL SD CARD BEFORE THIS STEP TO AVOID WIPING THE WRONG CARD!!!
Tap Mounts and storage -> Format /storage/sdcard0 -> default and confirm the operation.​17. Insert the physical SD card (sdcard1) that you removed in step 2 back into the device.
Make sure it's mounted by going to Mounts and storage and checking its status (it should say unmount /storage/sdcard1/). If not, mount it by executing on the appropriate option.​18. Execute the following commands one-by-one in the ADB command prompt:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​19. Reboot the device into full Android.
19.1 Remove the physical SD card for safety.
19.2 Go to the top menu level of recovery. Then select the top option Reboot the device.​20. When Android loads fully, you'll notice a notification about storage file system. Tap it and follow the prompts to format it.
21. Insert the physical SD card and reboot into the recovery to restore the backup from step 2.
Backup and Restore -> Restore from /storage/sdcard1.​22. Reboot back into full Android and copy the files saved from internal storage back into it. Then reboot again so that apps recognize the data.
DONE!​
Short guide/list of ADB commands and other events (*enclosed in asterisks*) if you know the safety drill & bash-based parted utility:
Code:
*flash 4.1.2 & install recovery*
*boot recovery*
adb shell
umount /storage
parted /dev/block/mmcblk0
print
*record start point of Userdata and end point of SDCard*
rm 15 (change the number according to your environment)
rm 14 (change the number according to your environment)
mkpartfs logical ext2 1621 7865 (change the numbers according to your environment)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 7865 15.6GB (change the numbers according to your environment)
name 15 SDCard (change the number and the name according to your environment)
*remove physical SD card*
*Mounts and storage -> Format /storage/sdcard0 -> default -> confirm*
*insert physical SD card*
*Mounts and storage -> Mount /storage/sdcard1*
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
*remove physical SD card*
*reboot*
*format emulated SD card*
*reboot recovery*
*restore backup*
*reboot*
*restore sdcard0/*
*reboot*
FAQ
Will it work with Android 4.2/4.3/4.4 or an older version of recovery?
So far I have tested with the versions mentioned in the guide. You can test whether this method will work for your setup without jeopardizing any data by completing step 7 of requirements and executing the following commands in ADB shell after booting into your recovery:
Code:
parted /dev/block/mmcblk0
print *wait for output*
quit
cd /storage/sdcard1 *change if your physical sdcard is sdcard0*
tune2fs *no parameters*
e2fsck *no parameters*
No errors indicate the method works for you. Please make sure to tell me about your setup in the comments - I'll update the compatibility list.
Tested devices
Did it work on your device or did you fail? Leave a comment and I'll update the list!
Barnes & Noble
- Nook Tablet 16GB
Sony
- Xperia T/TL/TX
Links to tools and recoveries
Reserved
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
derpotato said:
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
Click to expand...
Click to collapse
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
bsined said:
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
Click to expand...
Click to collapse
Oh I see.. that's too bad. Well, thanks for the information
ignore this
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
sourabhp said:
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
Click to expand...
Click to collapse
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
bsined said:
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
Click to expand...
Click to collapse
I searched with google for ADB drivers in recovery mode and found one but even after that device was not detected in recovery mode.
I tried uninstalling and re-installing drivers but no luck. may be need more research
bsined said:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​[/code][/hide]
[/size]
Click to expand...
Click to collapse
Thanx bro. I have successfully partitioned my device (Xperia L).
But when I checked the file system, it is ext3 not ext4.
Still my device is running well.
Will it effect the performance of my device?
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
jjiiaa said:
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
Click to expand...
Click to collapse
First off, SYSTEM partition isn't that big - less than 1GB, so you won't gain much from shrinking it. Secondly, I'm not sure where recovery is written. You're risking bricking your phone. Lastly, if you shrink the partition too tightly, you'll effectively remove the ability to upgrade your device's firmware because all ROMs have various sizes.
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
israfild said:
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
Click to expand...
Click to collapse
I think Android 4.4+ utilizes the entire internal storage as a single block, so the guide is pointless. If that's not the case on your device and you're willing to be the guinea pig, please do attempt the repartitioning and report on the results.
Sent from my LT30p using XDA Free mobile app
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
zero995 said:
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
Click to expand...
Click to collapse
Just double-checking that you had downgraded to 4.1 before resizing. You should be able to recover your device by flashing any FTF with Flashtool.
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
zero995 said:
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
Click to expand...
Click to collapse
If the phone doesn't start at all, that doesn't sound like it's related to partition tables. If the screen, the vibrator, and the LED turn on, the phone is in a soft brick and should be recoverable. You should ask in the FTF threads if you get any errors in flashtool.

[Q] Data Recovery from .RAW file Internal Memory

Hi there,
I have created a .Raw image from my Internal memory to recover deleted files from, using this tutorial successively:
http://forum.xda-developers.com/galaxy-nexus/general/guide-internal-memory-data-recovery-yes-t1994705
Now the problem rises because I am using windows 8, and the internal memory image is Linux EXT4 partition.
I have used many software to mount the image including : " Diskinternals, OSFMount, Ext2Fsd ... " but the problem arises because the data recovery software doesn't show the mounted partition even-though it is showing in My Computer.
I also have used many data recovery software that support Linux partitions such as: " Testdisk, PhotoRec, R-studio, Easeus, Geeksnerds, UFS, Active Undelete..." but all are only showing the files that are already there, and I need to recover the deleted files from this ext4 partition!

[SOLVED] Decryption Unsuccessful and a currently bricked M8

I previously ran LolliGPE but was long overdue for an update. I downloaded the latest version and copied the image to my phone and flashed the ROM. I decided to go try a dirty install first to see if I could keep everything I had, since I had already been running a previous version and after reviewing the changelog did not see anything recommending to wipe clean. After installing successfully, Android asked me to enter my password to decrypt my data (I don't recall ever encrypting my data?), and so I did. It then told me that my password was right, but the data was corrupt, and presented me a button to reset my phone. The button redirected me to recovery and automatically attempted to wipe /data and then re-mount it, but the wipe failed. I rebooted again with the same issue, same failed attempt to wipe. I went to install the zip again, and this time do a full wipe, but it was unable to mount my phone's storage nor my SD card. I am not able to mount either at all now.
What's the best course of action? I'd like to retain as much as I can and avoid wiping all of the internal storage clean. Is there a simpler fix to this or am I doomed?
HBOOT: 3.19.0.0000
RADIO: 1.09.20.0926
OS: 3.28.605.4
EDIT: For anyone else having a problem like this that at least wants to get their data back, here's what you should do (I assume you know how to work with Linux!):
Make sure you have the latest version of TWRP and ADB.
Boot the phone into recovery mode and connect the phone to your computer via USB
Run "ls -al /dev/block/platform/msm_sdcc.1/by-name" and check the output. Make a note of the partition marked "userdata" - for me, it was /dev/block/mmcblk0p48.
Either: simply use adb pull to copy this file to your computer (this will require about 26 gigs of space), or attempt to mount the file. To use adb pull, execute "adb pull /dev/block/<ID> ./data" (ID being what you marked down). Your data partition will be copied to /data. To mount, use "mount -t ext4 /dev/block/<ID> /userdata". Whatever's left of your data will be on your phone's new /userdata folder.
Use ADB to pull what files you want from /userdata. If you pulled the partition, skip this step.
If you copied the files you wanted over, you're done. If you pulled the entire partition, you're going to want to try and mount it. On Windows, there are various tools to mount Linux partitions, a quick Google will find some good ones. However, if the data is corrupt, it will not work. I recommend attempting to repair the partition on linux, with the command "e2fsck -f -y /path/to/data", replacing the path to your data file as necessary. Once done, run "mount -t ext4 /path/to/data /mnt/data", replacing the paths as necessary.
Once mounted, you can access your data wherever it was mounted. If e2fsck appeared to fix many errors, chances are most of your data will be in the lost+found folder, and you'll need to sort through this yourself. If you're lucky, then your data will be intact and readily usable. Internal SD card data is located at ./media/0.
To fix the partitions and get Android back up and running, you need to install the latest firmware, format your data in TWRP, factory reset, and then flash a ROM again. Here's what I did to do that, without an SD card. If you have an SD card, simply copy your ROM zip to the SD card and skip the final steps:
Make sure you have the latest version of TWRP and ADB, and download the latest copy of the firmware (check the development forum here).
Boot the phone (doesn't matter to what) and run adb reboot bootloader. When your phone reboots, double-check by running fastboot reboot-bootloader.
Put your phone in RUU mode with fastboot oem rebootRUU. The phone will restart and the HTC logo will come up.
Wait a couple seconds, then run fastboot flash zip firmware.zip, where firmware.zip is the firmware you want to flash.
The first time you do this, it will fail saying something like "FAILED (remote: 90 hboot pre-update! please flush image again immediately)". Ignore this, run the last command again: fastboot flash zip firmware.zip
The progress bar will appear and begin filling. Wait until fastboot is finished flashig it (the progress bar may not fill completely), wait an extra 5 seconds or so, and then do fastboot reboot.
The phone will reboot. Android will still be messed up, but you can verify the partitions are in working order by checking adb shell cat /proc/emmc.
Once you know the partitions are working, get back into TWRP/recovery: adb reboot recovery
Format /data and wipe /cache, /data, dalvik/art cache, etc (factory reset). You will lose the contents of your internal storage and everything else.
If you don't have the ROM zip on an sd card, make sure the zip is in the same directory as adb and run adb push rom.zip /sdcard/rom.zip, where rom.zip is the ROM. You can also copy it to the external sd by swapping /sdcard/rom.zip with /external_storage/rom.zip.
Once copied, reboot into recovery and flash the zip. Back to normal!
Update:
It's a firmware problem. Apparently there was a new firmware update that the ROM uses that I don't have. mmcblk0p42 was changed to "vzw_logger" (which I don't have), making mmcblk0p49 userdata instead of previously mmcblk0p48. The data partition it expects to be /data is /cache. Got this information by comparing 'cat /proc/emmc' with information of the latest version I found here.
Is there a way to fix this that allows me to preserve the contents of my internal storage (/sdcard)? Can I just flash an older version of the ROM to backup my data?
Klayderpus said:
Update:
It's a firmware problem. Apparently there was a new firmware update that the ROM uses that I don't have. mmcblk0p42 was changed to "vzw_logger" (which I don't have), making mmcblk0p49 userdata instead of previously mmcblk0p48. The data partition it expects to be /data is /cache. Got this information by comparing 'cat /proc/emmc' with information of the latest version I found here.
Is there a way to fix this that allows me to preserve the contents of my internal storage (/sdcard)? Can I just flash an older version of the ROM to backup my data?
Click to expand...
Click to collapse
I posted a warning about this change in the general section early on. For you to have the partition changes means you are on the newer firmware which doesn't match what you posted above for os. You very likely at this point have nothing left to salvage. Are you on the latest twrp?
dottat said:
I posted a warning about this change in the general section early on. For you to have the partition changes means you are on the newer firmware which doesn't match what you posted above for os. You very likely at this point have nothing left to salvage. Are you on the latest twrp?
Click to expand...
Click to collapse
I am on the latest TWRP, yes. Since this post, I've actually been making good progress in getting the data partition back, or so I think. I've been using dd to copy /dev/block/mntblk0p48 to an image file, but got stuck when I reached the FAT32 limit, so I re-formatted my SD card, except now it's read-only.
Klayderpus said:
I am on the latest TWRP, yes. Since this post, I've actually been making good progress in getting the data partition back, or so I think. I've been using dd to copy /dev/block/mntblk0p48 to an image file, but got stuck when I reached the FAT32 limit, so I re-formatted my SD card, except now it's read-only.
Click to expand...
Click to collapse
If you Dd the entire data partition it's gonna be almost 25 gigs. If you can't mount data in twrp and find anything usable when browsing via adb in twrp there's probably not anything usable in there.
dottat said:
If you Dd the entire data partition it's gonna be almost 25 gigs. If you can't mount data in twrp and find anything usable when browsing via adb in twrp there's probably not anything usable in there.
Click to expand...
Click to collapse
I did a DD before while in ADB and it only got to about 1.3 gigs, but after running the image through e2fsck I actually found some images and downloads. I think there's usable stuff in there and I'd like to at least try to get it. There's family pictures and stuff on there that have some value to me. My SD card is 32 gigs so I could probably do it if anything for the hell of it.
Do you happen to know how I can get the SD card mounted? mount -o rw,remount /dev/block/mmcblk1p1 [some dir] is what I've been trying, but I've been getting either Read only filesystem or Invalid argument.
I might be a little crazy
Klayderpus said:
I did a DD before while in ADB and it only got to about 1.3 gigs, but after running the image through e2fsck I actually found some images and downloads. I think there's usable stuff in there and I'd like to at least try to get it. There's family pictures and stuff on there that have some value to me. My SD card is 32 gigs so I could probably do it if anything for the hell of it.
Do you happen to know how I can get the SD card mounted? mount -o rw,remount /dev/block/mmcblk1p1 [some dir] is what I've been trying, but I've been getting either Read only filesystem or Invalid argument.
I might be a little crazy
Click to expand...
Click to collapse
Its already mounted.. Just boot into TWRP while connected to your PC. Open cmd prompt in your adb directory.
adb shell
cd sdcard
ls
See if your internal SD card contents are listed.
dottat said:
Its already mounted.. Just boot into TWRP while connected to your PC. Open cmd prompt in your adb directory.
adb shell
cd sdcard
ls
See if your internal SD card contents are listed.
Click to expand...
Click to collapse
TWRP lists the internal SD card as being size 0 under Mount -> Select Storage and /sdcard is empty. I re-formatted my external SD card to make a full size image but that's what wasn't mounting.
Klayderpus said:
TWRP lists the internal SD card as being size 0 under Mount -> Select Storage and /sdcard is empty. I re-formatted my external SD card to make a full size image but that's what wasn't mounting.
Click to expand...
Click to collapse
Did you try the repair option for /data listed under wipe in TWRP?
dottat said:
Did you try the repair option for /data listed under wipe in TWRP?
Click to expand...
Click to collapse
Doesn't work. There's a couple of messages about not being able to mount /data and then:
Code:
Repairing Data using e2fsck...
E:Unable to repair '/data'.
E:Error repairing file system.
Klayderpus said:
Doesn't work. There's a couple of messages about not being able to mount /data and then:
Code:
Repairing Data using e2fsck...
E:Unable to repair '/data'.
E:Error repairing file system.
Click to expand...
Click to collapse
try this
adb shell
mount -t ext4 /dev/block/mmcblk0p49 /userdata
df
show me the output of df...
and if to be sure of which firmware you are on.. reboot recovery... and do the following....
adb shell
mount -t ext4 /dev/block/mmcblk0p48 /userdata
df
and show me that DF
I got all of my data back successfully. I'm updating the OP with the steps I did to get it back.
What's the next step? Change firmware? I have a local copy of what I needed from the phone, so anything's game now.
edit: /dev/block/mmcblk0p48 for me is userdata, 49 does not exist. Both mounts fail.
Code:
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 933044 24 933020 0% /dev
tmpfs 933044 20 933024 0% /tmp
/dev/block/mmcblk0p47 1030828 16464 1014364 2% /cache
/dev/block/mmcblk1p1 30647232 12 29090436 0% /external_sd
/dev/block/mmcblk1p1 30647232 12 29090436 0% /and-sec
Klayderpus said:
I got all of my data back successfully. I'm updating the OP with the steps I did to get it back.
What's the next step? Change firmware? I have a local copy of what I needed from the phone, so anything's game now.
edit: /dev/block/mmcblk0p48 for me is userdata, 49 does not exist. Both mounts fail.
Code:
df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 933044 24 933020 0% /dev
tmpfs 933044 20 933024 0% /tmp
/dev/block/mmcblk0p47 1030828 16464 1014364 2% /cache
/dev/block/mmcblk1p1 30647232 12 29090436 0% /external_sd
/dev/block/mmcblk1p1 30647232 12 29090436 0% /and-sec
Click to expand...
Click to collapse
I would say update firmware. Since you confirmed blk48 as user data I know you don't have lollipop firmware.
I posted a firmware zip that contains the newest twrp which is compatible with lollipop in tigerstowns firmware thread. You can use that to update.
Then wipe and reinstall whatever Rom you want to use.
I fixed it this morning by updating firmware and will update the OP with the rest of the steps for the Googlers. Thanks again.
Klayderpus said:
EDIT: For anyone else having a problem like this that at least wants to get their data back, here's what you should do (I assume you know how to work with Linux!):
Make sure you have the latest version of TWRP and ADB.
Boot the phone into recovery mode and connect the phone to your computer via USB
Run "ls -al /dev/block/platform/msm_sdcc.1/by-name" and check the output. Make a note of the partition marked "userdata" - for me, it was /dev/block/mmcblk0p48.
Either: simply use adb pull to copy this file to your computer (this will require about 26 gigs of space), or attempt to mount the file. To use adb pull, execute "adb pull /dev/block/<ID> ./data" (ID being what you marked down). Your data partition will be copied to /data. To mount, use "mount -t ext4 /dev/block/<ID> /userdata". Whatever's left of your data will be on your phone's new /userdata folder.
Use ADB to pull what files you want from /userdata. If you pulled the partition, skip this step.
If you copied the files you wanted over, you're done. If you pulled the entire partition, you're going to want to try and mount it. On Windows, there are various tools to mount Linux partitions, a quick Google will find some good ones. However, if the data is corrupt, it will not work. I recommend attempting to repair the partition on linux, with the command "e2fsck -f -y /path/to/data", replacing the path to your data file as necessary. Once done, run "mount -t ext4 /path/to/data /mnt/data", replacing the paths as necessary.
Once mounted, you can access your data wherever it was mounted. If e2fsck appeared to fix many errors, chances are most of your data will be in the lost+found folder, and you'll need to sort through this yourself. If you're lucky, then your data will be intact and readily usable. Internal SD card data is located at ./media/0.
[/LIST]
Click to expand...
Click to collapse
I have a laptop running Ubuntu: where do I run the "ls -al /dev/block..." command? As in what folder do I need to be in? The phone only appears in an mtp capacity...
EDIT: I figured that out but now I am stuck at "adb pull /dev/block/<ID> ./data". My ID was mmcblk0p28 but the command returns "Bash: mmcblk0p28: no such file or directory exists"
EDIT 2: Got that command to work but the file is too large to write (My disk is FAT32 ). So I then tried the mount command but again got "no such file or directory exists".
Same Issue "Decryption Unsuccessful"
I was trying to apply the OTA update for 5.1 on my M8 converted to GPE 5.01, but had to update to the stock recovery, and found myself in the same situation with the "Decryption Unsuccessful" message.
Following Klayderpus' steps to recover, but I'm running into a few issues:
1) Windows not Ubuntu so some (many) of the commands do not apply.
2) The device is not responding to adb, although it was prior to the "upgrade". Fastboot is working.
3) TWRP was not on the device, in fact I never could get to the recovery after trying to install the stock recovery when I converted to GPE 5.01 many months ago
I have a fresh nandroid backup, so I am just trying to get the device running. Being without the phone is causing me great pain....
I upgraded the firmware to 4.16 and did the factory reset from the stock 4.16 recovery. The phone boots back to the "Decryption Unsuccessful" message.
I am not sure, but I think the next step for me to try is to install the GPE ROM from graffixnyc from the microSD card (need to find/buy that little SD adaptor)
Any help would be greatly appreciated!!
========================
Update;
Recovery does not see the SD card , so I won't be able to install from there.
I'll try flashing TWRP recover to see if that will show the contents of the external card
========================
Update 2:
TWRP does see the external card, but the install failed as it is unable to mount /data and /storage.
I'm out of ideas....HELP!!
========================
Update 3
I noticed the "factory reset" in HBOOT and thought I'd try that instead of the "Wipe" in TWRP, but only made things worse.
Now the phone comes up to the "Decryption Unsuccessful" where I can then take the reset to get it into TWRP recover
TWRP comes up directly into a screen where it's "Running OpenRecovery Script" and then reboots.
I'm going to quit now, as I am only making matters worse.....
========================
Update 4
I got TWRP to quit whatever it was doing.
Now, In TWRP > Wipe > Advanced Wipe, I cannot wipe or repair the Data partition. I see a message "Could not mount /data unable to find crypto footer". Trying to wipe the Davlik Cache fails, "Unable to mount /data, " Unable to mount storage".
========================
version-bootloader: 3.19.0.0000
version-baseband: 1.25.214500021.06G
version-main: 4.16.401.10
modelid: 0P6B12000
cidnum: 11111111
========================
I've bricked the phone and it looks permanent.
I found another thread where everyone was solving this issue running this command "mke2fs -T ext4 /dev/block/mmcblk0p8" in TWRP. I failed to notice that it was not an M8 device thread. The phone won't boot at all, and windows sees it as a usb drive.
Haste makes waste
Do you still have fastboot?
Check out the RUU collection here and grab what apllies to your device:
http://forum.xda-developers.com/ver...zw-m8-master-ruu-firmware-collection-t2946473
Make sure you use the HTC fastboot.exe from post 3
highplains914drifter said:
I was trying to apply the OTA update for 5.1 on my M8 converted to GPE 5.01, but had to update to the stock recovery, and found myself in the same situation with the "Decryption Unsuccessful" message.
Following Klayderpus' steps to recover, but I'm running into a few issues:
1) Windows not Ubuntu so some (many) of the commands do not apply.
2) The device is not responding to adb, although it was prior to the "upgrade". Fastboot is working.
3) TWRP was not on the device, in fact I never could get to the recovery after trying to install the stock recovery when I converted to GPE 5.01 many months ago
I have a fresh nandroid backup, so I am just trying to get the device running. Being without the phone is causing me great pain....
I upgraded the firmware to 4.16 and did the factory reset from the stock 4.16 recovery. The phone boots back to the "Decryption Unsuccessful" message.
I am not sure, but I think the next step for me to try is to install the GPE ROM from graffixnyc from the microSD card (need to find/buy that little SD adaptor)
Any help would be greatly appreciated!!
========================
Update;
Recovery does not see the SD card , so I won't be able to install from there.
I'll try flashing TWRP recover to see if that will show the contents of the external card
========================
Update 2:
TWRP does see the external card, but the install failed as it is unable to mount /data and /storage.
I'm out of ideas....HELP!!
========================
Update 3
I noticed the "factory reset" in HBOOT and thought I'd try that instead of the "Wipe" in TWRP, but only made things worse.
Now the phone comes up to the "Decryption Unsuccessful" where I can then take the reset to get it into TWRP recover
TWRP comes up directly into a screen where it's "Running OpenRecovery Script" and then reboots.
I'm going to quit now, as I am only making matters worse.....
========================
Update 4
I got TWRP to quit whatever it was doing.
Now, In TWRP > Wipe > Advanced Wipe, I cannot wipe or repair the Data partition. I see a message "Could not mount /data unable to find crypto footer". Trying to wipe the Davlik Cache fails, "Unable to mount /data, " Unable to mount storage".
========================
version-bootloader: 3.19.0.0000
version-baseband: 1.25.214500021.06G
version-main: 4.16.401.10
modelid: 0P6B12000
cidnum: 11111111
========================
I've bricked the phone and it looks permanent.
I found another thread where everyone was solving this issue running this command "mke2fs -T ext4 /dev/block/mmcblk0p8" in TWRP. I failed to notice that it was not an M8 device thread. The phone won't boot at all, and windows sees it as a usb drive.
Haste makes waste
Click to expand...
Click to collapse
If you have fastboot do the following commands
Fastboot oem task 28
Fastboot oem task 29
Then try to flash your rom or ruu.
dottat said:
If you have fastboot do the following commands
Fastboot oem task 28
Fastboot oem task 29
Then try to flash your rom or ruu.
Click to expand...
Click to collapse
No Fastboot, nothing. Device was charged, but now acts as if the battery is dead. the Power button does nothing even after a long press.
Bad day...
Klayderpus said:
I previously ran LolliGPE but was long overdue for an update. I downloaded the latest version and copied the image to my phone and flashed the ROM. I decided to go try a dirty install first to see if I could keep everything I had, since I had already been running a previous version and after reviewing the changelog did not see anything recommending to wipe clean. After installing successfully, Android asked me to enter my password to decrypt my data (I don't recall ever encrypting my data?), and so I did. It then told me that my password was right, but the data was corrupt, and presented me a button to reset my phone. The button redirected me to recovery and automatically attempted to wipe /data and then re-mount it, but the wipe failed. I rebooted again with the same issue, same failed attempt to wipe. I went to install the zip again, and this time do a full wipe, but it was unable to mount my phone's storage nor my SD card. I am not able to mount either at all now.
What's the best course of action? I'd like to retain as much as I can and avoid wiping all of the internal storage clean. Is there a simpler fix to this or am I doomed?
HBOOT: 3.19.0.0000
RADIO: 1.09.20.0926
OS: 3.28.605.4
EDIT: For anyone else having a problem like this that at least wants to get their data back, here's what you should do (I assume you know how to work with Linux!):
Make sure you have the latest version of TWRP and ADB.
Boot the phone into recovery mode and connect the phone to your computer via USB
Run "ls -al /dev/block/platform/msm_sdcc.1/by-name" and check the output. Make a note of the partition marked "userdata" - for me, it was /dev/block/mmcblk0p48.
Either: simply use adb pull to copy this file to your computer (this will require about 26 gigs of space), or attempt to mount the file. To use adb pull, execute "adb pull /dev/block/<ID> ./data" (ID being what you marked down). Your data partition will be copied to /data. To mount, use "mount -t ext4 /dev/block/<ID> /userdata". Whatever's left of your data will be on your phone's new /userdata folder.
Use ADB to pull what files you want from /userdata. If you pulled the partition, skip this step.
If you copied the files you wanted over, you're done. If you pulled the entire partition, you're going to want to try and mount it. On Windows, there are various tools to mount Linux partitions, a quick Google will find some good ones. However, if the data is corrupt, it will not work. I recommend attempting to repair the partition on linux, with the command "e2fsck -f -y /path/to/data", replacing the path to your data file as necessary. Once done, run "mount -t ext4 /path/to/data /mnt/data", replacing the paths as necessary.
Once mounted, you can access your data wherever it was mounted. If e2fsck appeared to fix many errors, chances are most of your data will be in the lost+found folder, and you'll need to sort through this yourself. If you're lucky, then your data will be intact and readily usable. Internal SD card data is located at ./media/0.
To fix the partitions and get Android back up and running, you need to install the latest firmware, format your data in TWRP, factory reset, and then flash a ROM again. Here's what I did to do that, without an SD card. If you have an SD card, simply copy your ROM zip to the SD card and skip the final steps:
Make sure you have the latest version of TWRP and ADB, and download the latest copy of the firmware (check the development forum here).
Boot the phone (doesn't matter to what) and run adb reboot bootloader. When your phone reboots, double-check by running fastboot reboot-bootloader.
Put your phone in RUU mode with fastboot oem rebootRUU. The phone will restart and the HTC logo will come up.
Wait a couple seconds, then run fastboot flash zip firmware.zip, where firmware.zip is the firmware you want to flash.
The first time you do this, it will fail saying something like "FAILED (remote: 90 hboot pre-update! please flush image again immediately)". Ignore this, run the last command again: fastboot flash zip firmware.zip
The progress bar will appear and begin filling. Wait until fastboot is finished flashig it (the progress bar may not fill completely), wait an extra 5 seconds or so, and then do fastboot reboot.
The phone will reboot. Android will still be messed up, but you can verify the partitions are in working order by checking adb shell cat /proc/emmc.
Once you know the partitions are working, get back into TWRP/recovery: adb reboot recovery
Format /data and wipe /cache, /data, dalvik/art cache, etc (factory reset). You will lose the contents of your internal storage and everything else.
If you don't have the ROM zip on an sd card, make sure the zip is in the same directory as adb and run adb push rom.zip /sdcard/rom.zip, where rom.zip is the ROM. You can also copy it to the external sd by swapping /sdcard/rom.zip with /external_storage/rom.zip.
Once copied, reboot into recovery and flash the zip. Back to normal!
Click to expand...
Click to collapse
Hey
I have a HTC one m7 verizon & same problem storage decryption failed. See my case here in below post. And please tell me if anything possible. Please......
http://forum.xda-developers.com/verizon-htc-one/help/storage-encryped-htc-one-m7-vzw-s-t3279869

Android FDE crypto footer behavior/KeyMaster on Android 8

On a Qualcomm device (OnePlus 3T) running Android vers. 8, (rooted and stock more or less with TWRP), my question is this.
Is the cryptofooter always able to decrypt the device even after being destroyed and recreated (with the same PIN/password), or is there something special/distinctive that happens when the device is encrypted initially (like a random seed is used to encrypt) that is lost after the cryptofooter is destroyed, like the HMAC?
Explicitly, if I were to do the following:
1) set up the phone like new on Android v8.0.0, copy in a file onto the internal storage and then encrypt it with a pin
2) destroy/write over the cryptofooter (like installling a ZIP that overrides it) such that it could no longer be decrypted by TWRP or when booting into OS
3) back up the entire encrypted image of the phone in recovery via an ADB command (adb pull /dev/block/dm-0 file.img) to a PC
4) wipe all partitions on the phone and perform step 1) again with the same pin (generating a new cryptofooter)
5) go into ADB via TWRP, decrypt and mount the device storage/fs and pull the cryptofooter file structure/keys via adb
6) run adb push file.img /dev/block/dm-0 from TWRP to put the encrypted filesystem back
7) restore the cryptofooter from step 5 (via adb push)
8) unlock/mount the device internal storage utilizing the regenerated cryptofooter
would step 8 be possible?

Categories

Resources