[lxc-devel] RFC: should lxc-create default to -B best?

Serge Hallyn serge.hallyn at ubuntu.com
Wed Sep 24 20:45:22 UTC 2014


Quoting Dwight Engen (dwight.engen at oracle.com):
> In lxc-0.9.0 if -B wasn't given to lxc-create (the shell script), it
> would test if $rootfs was on a btrfs and if so would act as if -B btrfs
> were given (ie. create a subvolume).
> 
> In lxc-1.x with the bdev backend, lxc-create has the option -B best
> which would have a similar result, but this is not the default. Is
> there a reason 'dir' was made the default? This seems like a change in
> default behavior, at least with respect to btrfs backend storage. I'd
> be happy to send a patch making lxc-create default to -B best, but
> wanted to understand if there were any issues first. Thanks.
> 
> P.S. doing this change might allow simplification of the lxc-ubuntu
> template since it appears to always create a subvolume when $rootfs is
> a btrfs.

The commit message which made this change said:

#    bdev_create: don't default to btrfs if possible
#    
#    Ideally it would be great to default to a btrfs subvolume for each new
#    container created.  However, this is not as we previously thought
#    without consequence.  'rsync --one-file-system' will not descend into
#    btrfs subvolumes.  This means that 'lxc-create -B _unset' will cause
#    different behavior for rsync -vax /var/lib/lxc based on whether that
#    fs is btrfs or not.
#    
#    So don't do that.  If -B is not specified, use -B dir.

Stéphane also points out that as the default btrfs mount is such that
unpriv users can create but not remove subvolumes, doing this by default
could cause trouble.

Now mind you, I'd far prefer to do as you suggest.  I keep getting
bitten by this change, and it's annoying.  (Of course so is the slow
fsync on btrfs :)

-serge


More information about the lxc-devel mailing list