• 11
name Punditsdkoslkdosdkoskdo

Why is zfs/btrfs recommended for an lxd host?

Note that for maximum performance, it's recommended to have /var/lib/lxd on a btrfs filesystem or setup ZFS or LVM and configure LXD to use a ZFS pool or LVM VG. Source

Why is that? I.e. How will those file systems (on the host) equate to better container performance?

Is it computational performance, is it just reduced hard drive consumption because of copy-on-write, both, neither, or something else?

Edit 1

Thanks to @Sven for pointing out that "LVM VG" refers to Logical Volume Manager Volume Group.

    • VG = Volume Group. You use one or more physical volumes (PV) to create a VG and then create a logical volume (LV) on that VG.

In addition to what @Sven said; ZFS, btrfs and LVM all provide copy-on-write clone/snapshot features. This makes it very cheap storage and time-wise to spin up new containers. With an image stored on regular ext2-4 filesystem, LXD will have to copy all the data itself, which takes more time and storage.

  • 3
Reply Report

First off, btrfs and ZFS offer features similar to LVM where space is offered not as a file but as a device with direct block device access.

When using disk image files (e.g. qcow), a file system operation in the container will be translated like this:

FS op.-> virtual block device -> FS op in the host on the container file 
     -> physical block device (or any number of  VFS layers like e.g. LVM)  

where the FS op on the container is a comparatively expensive operation. Using some kind of logical volume instead of a container file gets rid of this expensive FS operation:

FS op.-> virtual block device -> logical volume -> physical block device

where the logical volume operation is much cheaper than a file system operation.

  • 2
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags