0

I have a VM that was created in raw disk format but learned later that both virsh and qemu-img only supports creating snapshots in qcow2 format.

So I converted my base raw disks to qcow2 and then created snapshots for the disks. The question now is how to apply the snapshot to my base raw disk images?

I tried:

$ qemu-img snapshot -a disk1-snapshot1.qcow2 disk1.img WARNING: Image format was not specified for 'disk1.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. WARNING: Image format was not specified for 'disk1.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. qemu-img: Could not apply snapshot 'disk1-snapshot1.qcow2': -95 (Operation not supported) 
1
  • See this article - dustymabe.com/2015/01/11/… - I think it's more involved than you're imagining. Commented Aug 23, 2018 at 22:27

1 Answer 1

2

Once you convert the raw disk to qcow2 format, use "qemu-img" for creating a snapshot from base image.

qemu-img create -f qcow2 -b <Base-Image>.qcow2 <Base-Image-Snapshot>.qcow2 

The snapshot will have a size of around 200 KB. Further you will need to install new Guest VM which uses snapshot as its disk image.

virt-install --virt-type=kvm --name=<New-Guest-VM> --ram 2048 --vcpus=2 --virt-type=kvm --hvm --network network=default --graphics vnc --disk <Base-Image-Snapshot>.qcow2 --boot=hd --noautoconsole 

Now you can start your new Guest VM.

And the snapshot will store only the changes in base image, thus saving a lot of space on your host machine :)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.