5

I have a Redmi Note 4 (mido) Android phone with a broken screen: the screen lights up, but otherwise it stays entirely "black". I already replaced the screen, but with no luck - the cause of the error must be somewhere else. The phone has data-encryption enabled with an unlock-pattern. Now I'm trying to access the data on the phone, but did not succeed so far. Here is what I've done so far:

  • Connected the phone to a PC over USB.
  • Started the phone in fastboot-mode by pressing and holding the buttons vol-down and power simultaneously.
  • Booted the latest version of TWRP for mido: fastboot boot twrp-3.3.1-0-mido.img.
  • Opened adb shell and presumably managed to decrypt the data (found instructions in the TWRP Commandline Guide):

TWRP decrypt:

~ # twrp decrypt 41236
Attempting to decrypt data partition via command line.
Data successfully decrypted, new block device: '/dev/block/dm-0'
Updating partition details...
...done
Unable to mount storage
~ #

Unfortunately, the block device /dev/block/dm-0 cannot be mounted.

This is the result of fdisk:

~ # fdisk -l /dev/block/dm-0

Disk /dev/block/dm-0: 57.0 GB, 57033580032 bytes
255 heads, 63 sectors/track, 6933 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/block/dm-0 doesn't contain a valid partition table

So I pulled an Image of the block device with adb pull /dev/block/dm-0. This image has a size of 57,033,580,032 bytes.

I tried to mount this image in Ubuntu 20.04, but did not succeed:

# file /media/sf_U_DRIVE/Note4Data/dm-0.img
/media/sf_U_DRIVE/Note4Data/dm-0.img: data

# fdisk -l /media/sf_U_DRIVE/Note4Data/dm-0.img
Disk /media/sf_U_DRIVE/Note4Data/dm-0.img: 53,12 GiB, 57033580032 bytes, 111393711 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

# mount -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Data
mount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.

# mount -t ext4 -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Data
[ 6986.649794] EXT4-fs (loop3): VFS: Can't find ext4 filesystem
mount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.

# mount -t f2fs -o loop /media/sf_U_DRIVE/Note4Data/dm-0.img /mnt/Note4Data
[ 7004.610412] F2FS-fs (loop3): Can't find valid F2FS filesystem in 1th superblock
[ 7004.615289] F2FS-fs (loop3): Can't find valid F2FS filesystem in 2th superblock
mount: /mnt/Note4Data: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.

I wonder if I need to mount the image in another way (with offsets? with LVM?) or if the decryption did not work. TWRP creates a log file in /tmp/recovery.log. After running the twrp decrypt command, the following lines are added:

I:Command 'decrypt 41236' received
I:Set page: 'singleaction_page'
I:operation_start: 'TWRP CLI Command'
Attempting to decrypt data partition via command line.
D:crypt_ftr->fs_size = 111393711
I:starting verify_hw_fde_passwd
I:Using scrypt with keymaster for cryptfs KDF
I:TWRP keymaster max API: 3
I:Signing safely-padded objectkeymaster module name is Keymaster QTI HAL
keymaster version is 256
Found keymaster1 module, using keymaster1 API.
I:Extra parameters for dm_crypt: fde_enabled ice
I:target_type = req-cryptI:real_blk_name = /dev/block/mmcblk0p49, extra_params = fde_enabled iceE:test mount returned 0
I:Found no matching fstab entry for uevent device '/devices/virtual/block/dm-0' - add
I:Found no matching fstab entry for uevent device '/devices/virtual/block/dm-0' - change
Data successfully decrypted, new block device: '/dev/block/dm-0'
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
Updating partition details...
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
I:Unable to mount '/sdcard1'
I:Actual block device: '', current file system: 'auto'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'auto'
...done
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
Unable to mount storage
/data | /dev/block/dm-0 | Size: 0MB Used: 0MB Free: 0MB Backup Size: 0MB
Flags: Can_Be_Mounted Can_Be_Wiped Can_Be_Backed_Up Wipe_During_Factory_Reset Wipe_Available_in_GUI IsPresent Can_Be_Encrypted Is_Encrypted Is_Decrypted Has_Data_Media Can_Encrypt_Backup Use_Userdata_Encr
Symlink_Path: /data/media
Symlink_Mount_Point: /sdcard
Primary_Block_Device: /dev/block/mmcblk0p49
Decrypted_Block_Device: /dev/block/dm-0
Crypto_Key_Location: footer
Length: -16384
Display_Name: data
Storage_Name: Internal Storage
Backup_Path: /data
Backup_Name: data
Backup_Display_Name: Data
Storage_Path: /data/media
Current_File_System: ext4
Fstab_File_System: ext4
Backup_Method: files
MTP_Storage_ID: 65539
I:Unmounting main partitions...
I:Done reading ORS command from command line
I:operation_end - status=0
I:Set page: 'decrypt_pattern'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
SELinux contexts loaded from /file_contexts
Full SELinux support is present.
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
I:Unable to mount settings storage during GUI startup.
I:Copying file /cache/recovery/log to /cache/recovery/last_log
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
Unable to mount /data/media/TWRP/.twrps
I:Attempt to load settings from settings file...
I:InfoManager file '/data/media/TWRP/.twrps' not found.
I:Backup folder set to '/data/media/TWRP/BACKUPS/f707e0500604'
I:Copying file /etc/recovery.fstab to /cache/recovery/recovery.fstab
I:Version number saved to '/cache/recovery/.version'
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
I:Unable to mount '/sdcard1'
I:Actual block device: '', current file system: 'auto'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'auto'
I:TWFunc::Set_Brightness: Setting brightness control to 255
I:PageManager::LoadFileToBuffer loading filename: '/twres/languages/en.xml' directly
parsing languageFile
parsing languageFile done
I:Translating partition display names
I:Backup folder set to '/data/media/TWRP/BACKUPS/f707e0500604'
I:Starting MTP
I:[MTP] Starting MTP
I:Can't probe device /dev/block/dm-0
I:Unable to mount '/data'
I:Actual block device: '/dev/block/dm-0', current file system: 'ext4'
MTP Enabled
I:Check_Lifetime_Writes result: '648837'
I:Switching packages (TWRP)
I:Starting Adb Backup FIFO
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:[MTP] created new mtpserver object
I:[MTP] MtpServer::run fd: 18
I:TWFunc::Set_Brightness: Setting brightness control to 5
I:TWFunc::Set_Brightness: Setting brightness control to 0

Any ideas what I should try next or where I could find helpful information?

7
  • when phone is still booting you can use scrcpy android.stackexchange.com/questions/213116
    – alecxs
    Apr 27, 2020 at 21:11
  • 1
    You don't need to use any offset in decrypted dm-0 device. It contains a standard filesystem at 0 offset. So mount should be able to detect it even without -t. There must be something wrong with your filesystem. Apr 27, 2020 at 23:58
  • Thanks for all your input! Normal boot of the phone only worked until the pattern input screen for decryption. Anyway, today the phone died completely, and I'm left with my dump of dm-0. So far, I did not succeed in accessing its contents. TestDisk failed to find Intel or GPT partitions. Photorec did not find any intact files. fsck did not help either. I might be out of luck.
    – x-ray
    Apr 28, 2020 at 14:32
  • One thing I remember, though: I might have chosen to split the internal storage to format part of it as removable media. I think this once was a function in adb or in CyanogenMod. Could this be relevant?
    – x-ray
    Apr 28, 2020 at 14:34
  • sounds more like encryption was not successful, otherwise testdisk would detect file system type. you can look with HxD, if there are no zero bytes in file then it is still encrypted
    – alecxs
    Apr 28, 2020 at 16:04

1 Answer 1

0

try this from TWRP terminal

busybox mount -t ext4 -o ro,noexec,noload /dev/block/dm-0 /data
busybox mount -o bind /data/media /sdcard
busybox mount -o bind /data/media/0 /sdcard
4
  • Thanks for pointing me to this thread - although it's for Redmi 5. Unfortunately it does not work: busybox mount -t ext4 -o ro,noexec,noload /dev/block/dm-0 /data -> mount: mounting /dev/block/dm-0 on /data failed: Invalid argument. I also did the mentioned hexdump -C -n1088 /dev/block/dm-0, and I do not have 53 at 0x438. -t f2fs and -t vfat also do not work (same error message).
    – x-ray
    Apr 27, 2020 at 19:27
  • for F2FS you have magic 10.20.f5.f2 starting at 1024 byte
    – alecxs
    Apr 28, 2020 at 7:31
  • Ok, this is not in the image, so it does not seem to be F2FS. Thx!
    – x-ray
    Apr 28, 2020 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .