I've read mixed opinions about how safe it is to modify qemu disk image files.
There are two distinct situations I'm interested in.
1) let's take a raw or qcow2 disk image file not used by kvm (i.e. the virtual machine is not running), mount it using losetup and kpartx and modify its contents (e.g. edit some files, remove some, add some, ....). While I've done this with no problem until now (provided I don't go beyond the maximum size of the image), I'm not sure this is perfectly riskless; I especially wonder how the space-saving features of those image formats behave in such cases - i.e. are they only activated when the VM is running or is a feature of the disk image file by itself.
2) same situation (mounted disk image) but the virtual machine is running now. Is is safe to access the image file contents read-only and even to edit/add some file provided for sure I'm absolutely certain this won't interfer with processes running in the VM ?
Thanks in advance,
phep