I downloaded an raw SD card image that has two partitions.
It caused some file system errors when I tried to dd it directly into an SD card. I am not sure if the card is defective or the image.
Is there a way to examine this image without writing it to a physical card? Like trying to mount the partitions separately or checking the tables?
Answer
You can use kpartx or partx to create loop devices for the partitions on the image, and then mount them. So either:
$ sudo kpartx -v -a file.iso
add map loop0p1 (253:17): 0 8382464 linear 7:1 2048
$ mount /dev/mapper/loop0p1 ./mnt_point
... do something with the partition ...
$ umount ./mnt_point
$ kpartx -d -v file.iso
del devmap : loop0p1
loop deleted : /dev/loop0
or:
$ sudo partx -a -v file.iso
partition: none, disk: file.iso, lower: 0, upper: 0
Trying to use '/dev/loop0' for the loop device
/dev/loop0: partition table type 'dos' detected
range recount: max partno=1, lower=0, upper=0
/dev/loop0: partition #1 added
$ mount /dev/loop0p1 ./mnt_point
... do something with the partition ...
$ umount /dev/loop0p1 ./mnt_point
$ sudo partx -d -v /dev/loop0
partition: none, disk: /dev/loop0, lower: 0, upper: 0
/dev/loop0: partition #1 removed
See also How can I mount a disk image?
Comments
Post a Comment