[Solution]: The Mount imgfile in Linux prompts "you must specify the file system type"

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.