天天看點

挂載.img鏡像Mounting a QEMU Image

https://www.kumari.net/index.php/system-adminstration/49-mounting-a-qemu-image

Mounting a QEMU Image

In order to mount a QUMU / KVM disk image you need to use qemu-nbd, which lets you use the NBD protocol to share the disk image on the network.

First you need the module loaded:

sudo modprobe nbd max_part=8
      

Then you can share the disk on the network and create the device entries:

sudo qemu-nbd --connect=/dev/nbd0 file.qcow2
      

Then you mount it:

sudo mount /dev/nbd0p1 /mnt/kvm
      

When done, unmount and unshare it:

sudo umount /mnt/kvm
sudo nbd-client -d /dev/nbd0      

繼續閱讀