[lxc-users] Strange freezes with btrfs backend

Tomasz Chmielewski mangoo at wpkg.org
Sat Dec 3 09:48:29 UTC 2016

On 2016-12-03 18:31, Pierce Ng wrote:
> On Sat, Dec 03, 2016 at 11:49:02AM +0700, Sergiusz Pawlowicz wrote:
>> With 1GB of memory is is not recommended to use ZFS not BTRFS,
>> especially via a disk image file. Just forget about it.
> The same VPS - as same as a VPS can be :-) - ran LXC on Ubuntu 14.04 
> fine. For
> my work load perhaps the directory or LVM backends for LXD are good 
> enough.

Don't use a file-based image for a different filesystem - your 
performance will be poor, and you risk loosing the whole filesystem if 
something wrong happens to your main fs.

Exceptions to this rule are perhaps:

- testing
- recovery
- KVM set up to use a file-based image for a VM (still, not perfect)

If you want to use LXD with btrfs, it's still quite easy to do, though 
stick to the following rules:

- btrfs should be placed on a separate block device (disk/partition) - 
so, let's say /dev/xvdb1 mounted to /var/lib/lxd

- btrfs is still not very stable (no RAID and RAID-1 levels are fine for 
basic workloads, though you may still hit an occasional hiccup) - use 
the most recent stable kernel with btrfs (for Ubuntu, you can get it 
from http://kernel.ubuntu.com/~kernel-ppa/mainline/ - you'll need 
"raw.lxc: lxc.aa_allow_incomplete=1" in container's config); kernel 4.4 
used in Ubuntu 16.04 is too old and you will run into problems after 
some time!

- chattr +C on database (mysql, postgres, mongo, elasticsearch) 
directories, otherwise, performance will be very poor (note chattr +C 
only works on directories and empty files; for existing files, you'll 
have to move them out and copy back in)

Tomasz Chmielewski

More information about the lxc-users mailing list