error: Requested operation is not valid: Disk .. does not support snapshotting

Hmmm…. when I first tried virsh snapshot, I too got the same error.. But it was easy to understand why I got that.. It is nothing but the image format was “raw’. The snapshot feature depends on qemu to perform its operation.. For the qemu to work , the image format should be “qcow2“..

[root@dhcp210-84 qemu]# virsh list
Id Name State
———————————-
2 fedoraguest running

[root@dhcp210-84 qemu]# virsh snapshot-create fedoraguest
error: Requested operation is not valid: Disk
‘/var/lib/libvirt/images/fedoraguest.img’ does not support snapshotting

[root@humbles-lap qemu]# qemu-img info /var/lib/libvirt/images/fedoraguest.img
image: /var/lib/libvirt/images/fedoraguest.img
file format: raw
virtual size: 3.9G (4194304000 bytes)
disk size: 3.9G
[root@humbles-lap qemu]#

Now, a question can pop-up in your mind 🙂 . Is it possible to convert image format from “raw” to “qcow2”?

Yep, it is possible with ‘qemu-img convert’ command .. Please see below syntax for the same:

#qemu-img convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2 […]] output_filename

convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2 […]] output_filename
Convert the disk image filename to disk image output_filename using format output_fmt. It can be optionally compressed (“-c”
option) or use any format specific options like encryption (“-o” option).

Only the formats “qcow” and “qcow2” support compression. The compression is read-only. It means that if a compressed sector is
rewritten, then it is rewritten as uncompressed data.

Image conversion is also useful to get smaller image when using a growable format such as “qcow” or “cow”: the empty sectors
are detected and suppressed from the destination image.

You can use the backing_file option to force the output image to be created as a copy on write image of the specified base
image; the backing_file should have the same content as the input’s base image, however the path, image format, etc may
differ.