How to mount encrypted /data partition in recovery mode?

Is it normal that my “heimdall print-pit” shows 32 Entries? Quite a lot? I don’t now if linux has so many partitions? :open_mouth:

... 
--- Entry #28 ---
Binary Type: 0 (AP)
Device Type: 8 (Unknown)
Identifier: 22
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 1680512
Partition Block Count: 2560
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: HIDDEN
Flash Filename: hidden.img
FOTA Filename: 


--- Entry #29 ---
Binary Type: 0 (AP)
Device Type: 8 (Unknown)
Identifier: 23
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 1683072
Partition Block Count: 12800
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: OMR
Flash Filename: omr.img
FOTA Filename: 


--- Entry #30 ---
Binary Type: 0 (AP)
Device Type: 8 (Unknown)
Identifier: 24
Attributes: 5 (Read/Write)
Update Attributes: 1 (FOTA)
Partition Block Size/Offset: 1695872
Partition Block Count: 1280
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: CP_DEBUG
Flash Filename: modem_debug.bin
FOTA Filename: 


--- Entry #31 ---
Binary Type: 0 (AP)
Device Type: 8 (Unknown)
Identifier: 25
Attributes: 5 (Read/Write)
Update Attributes: 5 (FOTA)
Partition Block Size/Offset: 1697152
Partition Block Count: 0
File Offset (Obsolete): 0
File Size (Obsolete): 0
Partition Name: USERDATA
Flash Filename: userdata.img
FOTA Filename: remained


I have seen similar on other Samsungs, not a problem; Android does use a lot of partitions.

1 Like

I flashed the /e/recovery and tried it and indeed the response is a bit different and more like with the s9+ device. But still:

tarlte:/ # mkdir -p /mnt/userdata                                                                      
ount /dev/block/platform/11120000.ufs/by-name/USERDATA /mnt/userdata                                   <
mount: /dev/block/platform/11120000.ufs/by-name/USERDATA: need -t
1|starlte:/ # mount -t ext4 /dev/block/platform/11120000.ufs/by-name/USERDATA /mnt/userdata                                                                                                                        mount: '/dev/block/platform/11120000.ufs/by-name/USERDATA'->'/mnt/userdata': Invalid argument
1|starlte:/ # cd /mnt/userdata                                                                                                                                                                                    
starlte:/mnt/userdata # ls
starlte:/mnt/userdata # lsblk -f
/system/bin/sh: lsblk: inaccessible or not found
127|starlte:/mnt/userdata # blkid
/system/bin/sh: blkid: inaccessible or not found

I don’t now what this means:
image

I expected a different (bigger) result. :open_mouth:

I know these kind of situations … it feels like the solution is so “close” but something must be missing here, but what? :confused:
i can’t believe that the storage is really broken, because of a full disk. :confused:

If I click mount from the /e/recovery-GUI it indeed mounts (empty folders).

only use the proper recovery for the device - sorry if this was misleading. I just assumed the maintainers of both devices are the same or merge the same code.

For science… can you use an older starlte twrp, before January 2022? as in twrp-3.6.0

1 Like
Recent reports show TWRP getting stuck at startup
logo because of a /data glitch, without further
posibility to do anything, on unencrypted phones.
Considering decryption was never working, or that
removing these flags fix the issue mentioned and
lead to a functional TWRP (unencrypted), let's
remove them for now.

Actually a possible /data - glitch does not really sound calming. Is the decrypt-function in this twrp a thread to the data? :thinking:

I see the risk as minimal, as in things error, you restart. Your data is at stake anyway

1 Like

@jan545651 have you read though "Your data may be corrupt": /e/os booting into recovery and crashing on startup after running out of disk space?

This starts as a Fairphone thread – it seems to me there is some useful background information as to how adb commands might work.

(Maybe, as said / implied by @tcecyk adb
could work better with e-Recovery than TWRP.)

At Post # 99 above @tcecyk points to “other person”.

At this point the subject is now a Samsung S9+. Some of the formatting is hard to follow, but the commands recommended do result in success. For orientation the Samsung S9+ is introduced at Post #17

1 Like

Hi aibd,
thank yo for your help!
I am currently doing a backup of the S9+ and will try the “old” TWRP image with decrypt-functionality.
Actually I also came past the the FP3-Thread … but what command do you mean exactly?
I cannot see where I did something different so far? :thinking:

Addon: To me it seems the key in solving this is to have a powerful recovery image that can decrypt and mount Samsung Phones (S9) even if they are somehow “broken” (Not sure if this is really true). Do you perhaps know if there is an even more advanced recovery (even than TWRP)?

… it doesn not work … even with the “intact” S9+ phone the decrypt feature of twrp cannot decrypt the samsung S9+ phone. :confused:

Well @tcecyk pointed to the post leading to a solution in that case Post #28… but I felt you needed to follow the background Edit @jan545651 of getting started with adb.

That may not be the “only way” … I think it will be trial and error where you can get a mount point.

My experience with Samsung and TWRP goes back to Oreo where encryption seemed not an issue … encryption became a bigger issue at Android 10 (Q).

Samsung is specifically mentioned in this post Why doesn't TWRP support encryption on my device? from the TWRP FAQ on the subject of encryption.

1 Like

Yes … it seem’s so! What’s interesting with both phones … it first gives this read error: “Unable to mount storage”

So perhaps decryption is not working because of failing to mount in the first place.

I wonder:
Could an adb sideload restore the phone?
Will it preserve /data and apps?
I guess it will not fix the memory problem?

as it needs space on userdata, a sideload can’t help.

Decryption is optional, mounting the partition and filesystem is not. This is solely up to the kernel used in the recovery.

1 Like

:open_mouth: ow … but then there is something wrong with the kernel?:open_mouth:

I tested your mount command with the fully working (and not corrupted) S9+ … and get the absolutely same error (this time with /e/recovery).

Is there a way to veryfy that this mount command still works this way with the current recoveries? :open_mouth:

So even with a fully fine Samsung … the commands does not seem to work for me!

Edit: Could it be the wrong mountpath?

image

It’s does not seem possible to mount mmcblk0 also.

1|star2lte:/ # mount -t ext4 /dev/block/platform/11500000.dwmmc2/mmcblk0 /mnt/userdata                                                                                                                            
mount: '/dev/block/platform/11500000.dwmmc2/mmcblk0'->'/mnt/userdata': Invalid argument
1|star2lte:/ # mount /dev/block/platform/11500000.dwmmc2/mmcblk0 /mnt/userdata                                                                                                                                    
mount: '/dev/block/platform/11500000.dwmmc2/mmcblk0'->'/mnt/userdata': I/O error
1|star2lte:/ #

… the sd-card does not seem to be mountable also? :open_mouth:

I realize that I cannot run su command also … is it a permission problem?

Just to be absolutely sure: Twrp already runs with root and with the highest permissions … correct? No need to do further escalation?

Addon:
I grabbed an “old” Fairphone lying around (I accedently unlocked the bootloader again which swiped the phones apps - I have a backup anyways) and tried to mount the storage.

It seems to work:

FP3:/mnt/userdata/data # find . -type f -size +500K                                                     
./PWTMKL7SzhnvhmAKAbWk7e8SCSF/V2rhV5xbmbCdemNmnhdxSA/xDVA7DzegrFrPOt7cyoMwC/GcOsxh3c9ikjQlqSoDEwmA

But here I cannot flash twrp for some reason …
But in /e/recovery the (encrypted storage seems to be mountable).

So could it be a problem only with Samsung Phones ?

if you go through the whole thread you will see that it’s a device-by-device question if the recovery can successfully mount the devices filesystems (FP3 has no problem doing so).

The recovery is a minimal linux with a kernel that is or isn’t the same as the system image kernel (which can mount the filesystems).

1 Like

Hi tcecyk,
and for everyone else facing a similar problem.

There was absolutely no way to mount /userdata at all (at least I couldn’t find one and some other guy, that tried also).
I had to wipe everything and reinstall the system.
Weirdly: Now with the fresh installation, Encryption and PIN in place … it’s is no problem to mount the userdata-partition even though it is encrypted (with simply the normal /e/recovery).
This means it must be something else but not the /e/recovery kernel (and weirdly so my S9+ is still running … and here I still cannot mount).


Who knows why …?