Score:0

What capabilities do you lose when turning off COW on a qcow2 file?

us flag

I run a small internal cloud utilizing 3 redundant, live migration capable Ubuntu/Qemu/KVM hosts with ~30 mixed OS VMs.

The Pool volumes are BTRFS and before any of you give me crap about it: this is small shop, utility is more important than performance here, so zip-it!

This being said, one still should mitigate the performance issues as best one can. The alternatives are turn off COW at the volume level or at the file level.

I didn't want to mount the BTRFS with nocow for fear of interfering in any way with the REALLY cool snapshot and backup capabilities BTRFS brings to the party. Small shop, lot's of automation, don't want to risk it!

So I opted for creating my .qcow2 VM volumes using the -o nocow=on option under qemu-img utility. And this seems to be working fine. I get the space savings (over going raw) and the performance is fine. I do have to periodically defrag them with a virsh blockcopy ... -pivot but that can be cron'd so what do I care?

But it kinda nags at me: what capabilities does one lose with the -o nocow=on?

Nikita Kipriyanov avatar
za flag
In Proxmox VE you would lose nothing. I'd say you rather won't use QCOW layered over BTRFS in the first place, and use its subvolumes instead. However, you seem to be using libvirt (right?) and so what it will lose depends on its wisdom (which is not very high; libvirt still don't know about VLAN-aware Linux built-in bridges, I don't expect it to be very intellegent regarding other new Linux features).
Score:1
us flag

A file created using qemu-img create -o nocow=on cannot be copied using cp --reflink=always option:

root@cview:/kvm# btrfs subvolume create ./tmpvol
Create subvolume './tmpvol'
root@cview:/kvm# qemu-img create -f qcow2 cow.qcow2 10G
Formatting 'cow.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16
root@cview:/kvm# qemu-img create -f qcow2 -o nocow=on nocow.qcow2 10G
Formatting 'nocow.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=10737418240 lazy_refcounts=off refcount_bits=16 nocow=on
root@cview:/kvm# cp --reflink=always cow-*.qcow2 ./tmpvol
cp: failed to clone './tmpvol/cow-no.qcow2' from 'cow-no.qcow2': Invalid argument
root@cview:/kvm# ls -l ./tmpvol
total 196
-rw-r--r-- 1 root root      0 Nov 15 07:54 cow-no.qcow2
-rw-r--r-- 1 root root 196768 Nov 15 07:54 cow-yes.qcow2

This fail produces a zero length file.

Funny. I have never had occasion to use cp --reflink until today. I immediately thought of this post.,

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.