guestmount更改qcow2

daizichuan / 2024-10-21 / 原文

# 查看 filesystem
# virt-filesystems --all --long --uuid -h -a netone-sw02.qcow2
Name      Type       VFS  Label MBR Size Parent   UUID
/dev/sda1 filesystem vfat -     -   32M  -        4F61-D6A6
/dev/sda2 filesystem ext4 -     -   10G  -        2e2515b6-4464-4049-8e09-7dfe58003f13
/dev/sda1 partition  -    -     -   32M  /dev/sda -
/dev/sda2 partition  -    -     -   10G  /dev/sda -
/dev/sda  device     -    -     -   10G  -        -

# 挂载 -m 指定filesystem
# guestmount -a xxx.qcow2 -w -m /dev/sda1 /mnt/xxx

# 尝试编辑
# vi /mnt/xxx/test

# 卸载
# guestunmount /mnt/xxx/