装载包含单个分区的图像

时间:2014-11-03 10:56:58

标签: linux image mount

我使用以下内容从包含多个分区的磁盘中创建了一个分区的映像:

#ddrescue -d -r3 /dev/sdb3 sdb3.img sdb3.logfile

但是,当我尝试使用以下方法安装图像时:

mount -o loop,ro sdb3.img /media/mymount

我收到以下错误消息:

Failed to read last sector (81919999): Invalid argument
HINTS: Either the volume is a RAID/LDM but it wasn't setup yet,
    or it was not setup correctly (e.g. by not using mdadm --build ...),
    or a wrong device is tried to be mounted,
    or the partition table is corrupt (partition is smaller than NTFS),
    or the NTFS boot sector is corrupt (NTFS size is not valid).

Failed to mount '/dev/loop0': Invalid argument
The device '/dev/loop0' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?

任何帮助解决问题都将不胜感激。

此致

1 个答案:

答案 0 :(得分:0)

要从图像文件安装分区,您可以使用kpartx

列出工具在图像文件中检测到的映射:

kpartx -l sdb3.img

然后添加映射:

kpartx -a sdb3.img

然后,分区将显示为/dev/mapper下的设备,然后可以正常安装。

请参阅man kpartx和此blog