Edit qcow2 or raw image files offline using virt-edit

Sometimes I need to edit files inside qcow2 or raw image, but for some reason I don’t want to launch the image in KVM or in Openstack cloud. The image can be edited offline using virt-edit tool.

Installing libguestfs-tools (provides virt-edit):

[root@tuxfixer ~]# yum install libguestfs-tools

Editing files inside image, examples:

[root@tuxfixer ~]# virt-edit image.img /etc/hosts
[root@tuxfixer ~]# virt-edit image.qcow2 /etc/hosts

Note: the format of the disk image (raw|qcow2) is auto-detected.

Liked it? Take a second to support tuxfixer.com on Patreon!

Share on: Share on FacebookShare on Google+Tweet about this on TwitterShare on StumbleUponShare on LinkedInPin on PinterestBuffer this pageShare on TumblrDigg thisFlattr the authorShare on RedditShare on VKShare on Yummly

One thought on “Edit qcow2 or raw image files offline using virt-edit

  1. Leroy Tennison January 28, 2016 at 21:27

    Thank you, it couldn’t have been more timely, resolved a significant problem for me.

Leave a Reply

Name *
Email *