guestmount 挂载虚拟机的文件系统到host 进行编辑
例子:
查看虚拟机文件里面的设备,xxx随便写个,如果不存在,则会显示出分区来:
# guestmount –rw -a /var/lib/nova/instances/instance-0000001c/disk -m /dev/xxx /mnt/tmp1/
libguestfs: error: mount_options: mount_options_stub: /dev/xxx: No such file or directory
guestmount: ‘/dev/xxx’ could not be mounted.
guestmount: Did you mean to mount one of these filesystems?
guestmount: /dev/sda1 (ext4)
guestmount: /dev/sda2 (swap)
guestmount: /dev/sda3 (ext4)
guestmount: ‘/dev/xxx’ could not be mounted.
guestmount: Did you mean to mount one of these filesystems?
guestmount: /dev/sda1 (ext4)
guestmount: /dev/sda2 (swap)
guestmount: /dev/sda3 (ext4)
把/var/lib/nova/instances/instance-0000001c/disk这个虚拟机文件的/dev/sda2设备mount到host机器的/mnt/tmp1/目录,之后可以在这个目录修改:
# guestmount –rw -a /var/lib/nova/instances/instance-0000001c/disk -m /dev/sda2 /mnt/tmp1/
修改完之后,umount掉:
# fusermount -u /mnt/tmp1