'Failed to read last sector' when trying to mount DD file
I have a .dd file and want to check what's inside. Many tutorials suggest Disk Image Mounter, but this option doesn't exist.
So I tried the classic way:
mkdir /mnt/image
and
sudo mount -o loop /home/name/Downloads/usb_content.dd
But get this instead
Failed to read last sector (129022): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
or it was not setup correctly (e.g. by not using mdadm --build ...),
or a wrong device is tried to be mounted,
or the partition table is corrupt (partition is smaller than NTFS),
or the NTFS boot sector is corrupt (NTFS size is not valid).
Failed to mount '/dev/loop42': Invalid argument
The device '/dev/loop42' 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?
How can I properly mount dd image?
Edit:
sudo fdisk --list /home/name/Downloads/usb_content.dd
gives:
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: 0x73736572
Device Boot Start End Sectors Size Id Type
/home/name/Downloads/usb_content.dd1 1920221984 3736432267 1816210284 866G 72 unknown
/home/name/Downloads/usb_content.dd2 1936028192 3889681299 1953653108 931,6G 6c unknown
/home/name/Downloads/usb_content.dd3 0 0 0 0B 0 Empty
/home/name/Downloads/usb_content.dd4 27722122 27722568 447 223,5K 0 Empty
Partition table entries are not in disk order.
There seems to be four partitions in your image file. If at least one partition has a file system, that Ubuntu can manage, you can try to mount a partition according to the following steps.
-
Install
kpartx
sudo apt install kpartx
-
Use
kpartx
to map the content of the image file to loop devicessudo kpartx -av /home/name/Downloads/usb_content.dd
-
You should find the mapped loop devices with
ls /dev/mapper/loop*
-
Use
lsblk
to view the mapped contentlsblk -o name,size,fstype,label,mountpoint /dev/loopN
where
N
is a number (0 if there were no loop devices before, otherwise the first unoccupied number, for example 7 depending of the number of loop devices that are already mapped). In my case (without any snaps)N = 0
so/dev/loop0
. -
Now,
lsblk
should tell you if there is some file system, and if that is the case, you can create mountpoints and mount [the file systems] withsudo mkdir /mnt/lp1 # create mountpoint only once sudo mkdir /mnt/lp2 # create mountpoint only once ... sudo mount /dev/mapper/loopNp1 /mnt/lp1 sudo mount /dev/mapper/loopNp2 /mnt/lp2 ...
where
N
is the number that you identified earlier (in my case0
). -
Now you can read the content of the mounted file systems at
/mnt/lp1
/mnt/lp2
...
-
Finally, you may want to unmount the file systems and delete the mapping,
sudo umount /mnt/lp* sudo kpartx -d /home/name/Downloads/usb_content.dd