虚拟机的镜像可以直接通过loop的方式来进行挂载,这种方式你必须先计算出镜像中每个分区的偏移量(fdisk -lu可查看),然后通过loop的方式的挂载,加上偏移量
详细命令如下
[root@centos images]# cd /var/lib/libvirt/images/
[root@centos images]# fdisk -lu ubuntu.raw
You must set cylinders.
You can do this from the extra functions menu.
Disk ubuntu.raw: 0 MB, 0 bytes
255 heads, 63 sectors/track, 0 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ccae5
Device Boot Start End Blocks Id System
ubuntu.raw1 * 2048 38862847 19430400 83 Linux
Partition 1 has different physical/logical endings:
phys=(1023, 254, 63) logical=(2419, 25, 38)
ubuntu.raw2 38864894 40957951 1046529 5 Extended
Partition 2 has different physical/logical beginning