Edit VM Image with guestfish tool
Edit me
Modify VM Image without Starting It
=====
Load image file with guestfish
# guestfish --rw -a /export/data/kvm/images/image.qcow2
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: ‘help’ for help on commands
‘man’ to read the manual
‘quit’ to quit the shell
><fs> run
100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
List available devices
><fs> list-filesystems
/dev/sda1: ext4
/dev/sda2: ext4
><fs> mount /dev/sda2 /
Add/Remove file attributes
><fs> get-e2attrs /etc/resolv.conf
ei
><fs> set-e2attrs /etc/resolv.conf i clear:true
><fs> get-e2attrs /etc/resolv.conf
e