Take ubuntu12.04 as an example:
Suppose I have a file named test. IMG to mount it to the/mnt/imgfile directory:
The procedure is as follows:
$ CD "Directory of your IMG image"
$ Losetup/dev/loop0 test. IMG // If loop0 is prompted to be busy, try loop1, etc.
$ Sudo kpartx-Av/dev/loop0 // If kpartx is not installed, install apt-Get.
Add map loop0p1 (254: 0): 0 9783522 Linear/dev/loop0 63
Add map loop0p2 (254: 1): 0 11181240 Linear/dev/loop0 9783585
$ Sudo Mount/dev/mapper/loop0p1/mnt/IMG // here, P1 after loop0 represents the // partition of your imgfile, starting from 1, if there are two partitions, It is // loopxp1, loopxp2, where X represents the above command //
In/dev/loop0 test. IMG, Which loop do you mount.
As for the reason that "you must specify the file system type" appears, your IMG image contains MBR, that is, boot information, which cannot be identified by the system. An imgfile is equivalent to a hard disk containing an operating system. We only need to mount the file system part of the file system, so we need to bypass MBR. The above command can help you bypass MBR and mount the file system directly.
According to the preceding command, if your IMG contains MBR, the MBR partition is mounted. If you want to mount only the file system, change the last command:
$ Sudo Mount/dev/mapper/loop0p2/mnt/img
Of course, if it is mounted to the same directory, You need to first execute $ umount/mnt/IMG, and then execute the above mount command again.
If you have any questions, leave a message to ask.