Linux – Reasoning behind hosting virtual disk images on BTRFS Filesystem

btrfsfilesystemslinux

I have been reading about BTRFS and ZFS for a while and while I do appreciate the benefits of CoW when hosting important files I am currently puzzled by the following dilemma:

Given that both ZFS and BTRFS seem to suffer performance degradation when hosting large files subject to random writes (e.g. QCOW2, VDIs, etc), why would someone use BTRFS as a FS of choice to host VMs?

I know that in the case o BTRFS you can selectively turn off CoW using chattr, or the nodatacow mount option, reducing the degradation imposed by fragmentation and CoW…

However, according to Redhat this also "disables checksum verification of data and metadata, resulting in reduced data integrity." (in addition to the lost compression and naturally the so desired CoW).

Based on that I ask: Why would someone chose BTRFS over lets say, XFS over LVM over MD RAID ?

Best Answer

If the main use case is storing VM images or databases, and you are not interested in accepting the potential performance issues in order to get the data integrity advantages of btrfs, then I can't think of any reason why you would want to choose btrfs over xfs or ext4.

Disabling copy-on-write for just the VM image directory (using chattr +C) is mostly relevant when storing VM images is just one of many uses you have for your file system. Then it can be very convenient to just disable copy-on-write for that single directory, yet still retaining all of the advantages of btrfs for the rest of the file system.

Related Question