Mount and mount an imgfile

Source: Internet
Author: User

Run the following command to mount the imgfile of the Ubuntu Virtual Machine:

"Sudo Mount-o loop XXX. img/mnt/xxx ",

System prompt:

"Mount: You must specify the filesystem type"

After "-T ext3" is added, the following error occurs:

mount: wrong fs  type, bad option, bad superblock on  /dev/loop2,  missing codepage or helper program, or other error  In some cases useful info is found  insyslog - try  dmesg |  tailor so

First of all, it should be noted that this is because the IMG file contains MBR at the beginning, and the system cannot recognize it ...... The imgfile is equivalent to a hard disk that contains an operating system, and we need to mount part of the file system, so we need to bypass MBR.

Execute: fdisk-ul XXX. IMG, and display a lot of information, such:

Disk 3059.img: 4294 MB, 4294967296 bytes 255 heads, 63 sectors/track, 522 cylinders, total 8388608 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/Osize (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000bdbdcDevice Boot Start End Blocks Id System 3059.img1 * 63 7903979 3951958+ 83 Linux 3059.img2 7903980 8385929 240975 5 Extended 3059.img5 7904043 8385929 240943+ 82 Linux swap / Solaris

When we see this line, we find that the Linux file system starts from 63rd, so we should start mounting from this place during mounting.

3059. img1 * 63 7903979 3951958 + 83 Linux

This information can be used to output data. The slice size is 512.

Units = sectors of 1*512 = 512 bytes

So we need to mount it from 512*63

Last run:

(SUDO) Mount-o loop, offset = 32256 XXX. img/mnt/xxx ......

Note: The mount command automatically identifies the file system type of the partition based on the file system's superblock. If it cannot be identified, it will read and match entries in/etc/filesystems.


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.