virt 其他命令
查看虚拟机的分区情况
apt -y install libguestfs-tools
virt-filesystems --long --parts --blkdevs -h -a /data/centos7.img
virt-filesystems -d centos7
virt-list-partitions /data/centos7.img
virt-df /data/centos7.img
virt-ls /data/centos7.img /home
virt-copy-out -d centos1 /etc/passwd /tmp
FAQ
- 执行
libguestfs-test-tool
报错
qemu-system-x86_64: error: failed to set MSR 0x48d to 0x5600000016
qemu-system-x86_64: ../../target/i386/kvm.c:2701: kvm_buf_set_msrs: Assertion `ret == cpu->kvm_msr_buf->nmsrs' failed.
修复方式:
# 配置
sudo tee /etc/modprobe.d/qemu-system-x86.conf << EOF
options kvm ignore_msrs=1
EOF
# 重启
sudo reboot
virt-top
显示虚拟机内存和cpu的使用情况
yum install virt-top -y
virt-top