Question - re BTRFS COW and LXD VMs

I use LXD with BTRFS storage driver.

My storage disk contents are the default directories:

My question is about BTRFS COW for LXD Virtual Machines (VMs).

Its generally recommended due to “at scale & large I/O VMs” to Turn Off COW for VM storage to increase VM performance.

If someone’s LXD VM use-cases do not extend to VMs with large I/O requirements(example: databases) then as I understand it… there seems to not be much impact.


But for LXD VM creation on BTRFS storage should COW be turned off for the “virtual-machines” directory?

Turn off COW on file or folder (only works on 0 byte sized files):

# chattr +C file

Turn on COW on file or folder (only works on 0 byte sized files):

# chattr -C file

Turn off COW on directory recursively:

# chattr -R +C file

Turn on COW on directory recursively:

# chattr -R -C

Is LXD “smart enough” to know that if you are using BTRFS and try to Launch a VM does LXD Turns Off BTRFS COW “auto-magically” for that new LXD VM?

Or if LXD doesn’t currently do this then is it a Best Practice to manually Turn Off BTRFS COW for the above “virtual-machines” directory since that’s where LXD is going to store the VMs?

Thanks for any insight.

Brian

Yes indeed it does:

https://github.com/canonical/lxd/pull/9627

1 Like