qcow2镜像挂载
- 开启nbd
modprobe nbd max_part=16
- 挂载qcow2镜像文件
qemu-nbd -c /dev/nbd0 xxx.qcow2
Ps: xxx为你需要挂载的文件名 - 查看镜像的分区情况
fdisk -l /dev/nbd0
- 创建文件夹
mkdir /root/file
Ps: /root/file改为自己需要的路径 - 挂载nbd到文件系统
mount /dev/nbd0p1 /root/file
qcow2镜像卸载
- 卸载文件系统挂载
umount /root/file
Ps: /root/file改为自己需要的路径 - 卸载qcow2镜像挂载
qemu-nbd -d /dev/nbd0