VirTips wind between the clouds

Monthly Archives: July 2012

You are browsing the site archives by month.

Editing files inside vm image

There are some situations when you have to edit file from vm image and you can’t or don’t want to start virtual machine to do it.

Old way

If you have raw image without partitons you can just mount it via loop device:

If you have paritions it’s getting more complicated. You can play with offset option for mount command or for example you can use program called kpartx.

Then you can mount partitions from /mnt/mappert/loop0p1 and so on. It’s getting even more complicated when you are using no raw image formats, for example qcow2. Then you can use program called qemu-nbd.

virt-edit for rescue

All this are old days. Currently you can just use already mentioned on this blog project libguestfs. There is a program virt-edit. Just run:

Change file, save it and quit program. That’s all what you need.

You can also try guestfish and virt-rescue programs.


Get every new post delivered to your Inbox

Join other followers