Unable to mount mmcblk partition on linux
The root cause is that you're attempting to mount a nested partition, and Linux doesn't recognize those as block devices. Here's the GPT table for /dev/mmcblk0
:
Disk /dev/mmcblk0: 29.1 GiB, 31268536320 bytes, 61071360 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
Disklabel type: gpt
Disk identifier: BDCC441D-C0B3-4F13-A548-025EC15FA7FE
Device Start End Sectors Size Type
/dev/mmcblk0p1 2048 534527 532480 260M EFI System
/dev/mmcblk0p2 534528 567295 32768 16M Microsoft reserved
/dev/mmcblk0p3 567296 59054079 58486784 27.9G Microsoft basic data
/dev/mmcblk0p4 59054080 61059071 2004992 979M Windows recovery environment
The third partition, /dev/mmcblk0p3
contains an MBR table, not a filesystem:
Disk /dev/mmcblk0p3: 27.9 GiB, 29945233408 bytes, 58486784 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
Disklabel type: dos
Disk identifier: 0x78787878
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p3p1 2021161080 4042322159 2021161080 963.8G 78 unknown
/dev/mmcblk0p3p2 2021161080 4042322159 2021161080 963.8G 78 unknown
/dev/mmcblk0p3p3 4294932600 8589899894 4294967295 2T 78 unknown
/dev/mmcblk0p3p4 4294967295 5035196669 740229375 353G ff BBT
Notice the DOS disk label above. However, Linux doesn't recognize that MBR table nested in a partition. Consequently the MBR partitions are not available for mounting:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
...
mmcblk0 179:0 0 29.1G 0 disk
├─mmcblk0p1 179:1 0 260M 0 part
├─mmcblk0p2 179:2 0 16M 0 part
├─mmcblk0p3 179:3 0 27.9G 0 part
| |-- No block devices are shown nested here.
└─mmcblk0p4 179:4 0 979M 0 part
...
Solution
You can mount a nested partition using a loop mount. Essentially, you'll be creating a block device which points to the nested partition, and then mounting that block device. Beware, this is tricky to do, and given that the start and end sectors of the nested partitions as shown by fdisk
are clearly incorrect, I won't be able to provide much guidance.
Basically, you'll need to figure out where a nested partition actually begins and ends, and then use the offset and sizelimit options to create a loop device. Something like this:
mount /dev/mmcblk0p3 /mnt -o loop,offset=123,sizelimit=456
Resources
-
man losetup
- To learn about offset and sizelimit - https://superuser.com/questions/83249/how-to-create-device-driver-for-nested-partitions - Similar question
- https://www.unix.com/filesystems-disks-and-memory/24366-can-loopback-filesystem-partitioned.html - Details on how to do this, but for older drives; with cylinders.
Related videos on Youtube
Th3Wolf
Updated on September 18, 2022Comments
-
Th3Wolf over 1 year
Im running Kali live on USB and Im trying to access a Windows 10 partition (because Windows has a password that we forgot about and Im trying to alter the SAM file). On HD drives i just use
mount /dev/sdX /mnt
and im in, but on SD drives (its my first experience with them) ive got this file system error that i dont know how to solve. this isfdisk -l
result :Disk /dev/mmcblk0: 29.1 GiB, 31268536320 bytes, 61071360 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 Disklabel type: gpt Disk identifier: BDCC441D-C0B3-4F13-A548-025EC15FA7FE Device Start End Sectors Size Type /dev/mmcblk0p1 2048 534527 532480 260M EFI System /dev/mmcblk0p2 534528 567295 32768 16M Microsoft reserved /dev/mmcblk0p3 567296 59054079 58486784 27.9G Microsoft basic data /dev/mmcblk0p4 59054080 61059071 2004992 979M Windows recovery environment Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 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 Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 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 Disk /dev/sda: 3.7 GiB, 4005560320 bytes, 7823360 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 Disklabel type: dos Disk identifier: 0x17fcad22 Device Boot Start End Sectors Size Id Type /dev/sda1 * 64 5898239 5898176 2.8G 17 Hidden HPFS/NTFS /dev/sda2 5898240 5899647 1408 704K 1 FAT12 Disk /dev/loop0: 2.6 GiB, 2779897856 bytes, 5429488 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 this is the result of
fdisk /dev/mmcblk0p3 -l
Disk /dev/mmcblk0p3: 27.9 GiB, 29945233408 bytes, 58486784 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 Disklabel type: dos Disk identifier: 0x78787878 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p3p1 2021161080 4042322159 2021161080 963.8G 78 unknown /dev/mmcblk0p3p2 2021161080 4042322159 2021161080 963.8G 78 unknown /dev/mmcblk0p3p3 4294932600 8589899894 4294967295 2T 78 unknown /dev/mmcblk0p3p4 4294967295 5035196669 740229375 353G ff BBT
this is the result of
file -s /dev/mmcblk0p3
/dev/mmcblk0p3: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "-FVE-FS-", sectors/cluster 8, reserved sectors 0, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 567296, FAT (32 bit), sectors/FAT 8160, serial number 0x0, unlabeled; NTFS, sectors/track 63, physical drive 0x1fe0, $MFT start cluster 393217, serial number 02020454d414e204f, checksum 0x41462020
this is the result of
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 2.6G 1 loop /lib/live/mount/rootfs/filesystem.squashfs sda 8:0 1 3.7G 0 disk ├─sda1 8:1 1 2.8G 0 part /lib/live/mount/medium └─sda2 8:2 1 704K 0 part /media/root/Kali Live mmcblk0 179:0 0 29.1G 0 disk ├─mmcblk0p1 179:1 0 260M 0 part ├─mmcblk0p2 179:2 0 16M 0 part ├─mmcblk0p3 179:3 0 27.9G 0 part └─mmcblk0p4 179:4 0 979M 0 part mmcblk0boot0 179:256 0 4M 1 disk mmcblk0boot1 179:512 0 4M 1 disk mmcblk0rpmb 179:768 0 4M 0 disk
when I run this command :
mount /dev/mmcblk0p3/ /mnt
I get the following error :
NTFS signature is missing. Failed to mount '/dev/mmcblk0p3': Invalid argument The device '/dev/mmcblk0p3' doesn't seem to have a valid NTFS. Maybe the wrong device is used? Or the whole disk instead of a partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
ive tried with this
mount -t vfat /dev/mmcblk0p3 /mnt
also but i get :mount: wrong fs type, bad option, bad superblock on /dev/mmcblk0p3, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.
and finally this is the result of
cat /proc/filesystems
nodev sysfs nodev rootfs nodev tmpfs nodev bdev nodev proc nodev cpuset nodev cgroup nodev cgroup2 nodev devtmpfs nodev debugfs nodev tracefs nodev securityfs nodev sockfs nodev dax nodev bpf nodev pipefs nodev ramfs nodev hugetlbfs nodev devpts nodev pstore nodev mqueue vfat ntfs iso9660 nodev overlay squashfs nodev autofs nodev efivarfs nodev binfmt_misc fuseblk nodev fuse nodev fusectl
What could be the cause of thoes errors ?
-
Murphy over 6 yearsRelated: unix.stackexchange.com/q/399626/157411. Solution: Get a more user-friendly and up-to-date distribution to use as a rescue system, like Ubuntu or Knoppix.
-
-
Th3Wolf over 6 yearsThanks alot @Emmanuel. The problem i guess was because the C partition on windows was encrypted (with BitLocker), i've burned a Windows iso to a USB stick and typed cd /d c: and it sais that you can't access... but after removing the Bitlocker the mount was automatically done by Linux Thank for yout efforts and for your time. I'll check the resources you mentioned thoes are important stuff to know Thanks again.