分类: LINUX
2010-07-13 21:36:19
今天试图挂载arch的为u盘特制的img文件时,执行:"sudo mount -o loop xxx.img /mnt/xxx",系统提示:"mount: you must specify the filesystem type",加上"-t ext2"后仍然报错:"mount: wrong fs type, bad option, bad superblock on /dev/loop1...",看来又到搜索的时候了……
呵呵,还真让我找到了解决方案……
首先,要说明一下的是,这情况是由于img文件的开头包含了mbr,以致于系统无法识别……
怎么办?跳过mbr吧……执行:fdisk -ul xxx.img,和显示一大堆信息,如:
You must set cylinders.
You can do this from the extra functions menu.
Disk xxx.img: 0 MB, 0 bytes
171 heads, 23 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
xxx.img1 * 63 332032 165985 83 Linux
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 1, 1) logical=(0, 2, 18)
Partition 1 has different physical/logical endings:
phys=(20, 170, 23) logical=(84, 72, 5)
而你所要知道的就是在"Units"开头的那一行里,乘号后面的数字也就是扇区大小(不知是否该这样翻译,英文的单位为 (bytes/sector)),一般是跟例中一样的512bytes……接着,找到"Start",记下下面的数字(例中为63),这是起始扇区(是这 样译的吧?),再将这两个数字相乘,得到的结果(例中为32256)等一下要用到(说了句废话……)……
最后执行:
(sudo) mount -o loop,offset=32256(刚刚得出的结果) xxx.img /mnt/xxx……
大概就成功了……