Terry : Btrfs Tips

Btrfs Tips

Intermittent mount issues

This issue could be specific to loop devices only.

# mount -t btrfs /dev/loop1 /var/lib/lxc
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

dmesg output

[  622.758555] btrfs: failed to read the system array on loop1
[  622.761205] btrfs: open_ctree failed

mount using another device in the storage pool

mount -t btrfs /dev/loop2 /var/lib/lxc

Use btrfs for LXC (Linux Containers) backing store

LXC works very well with Btrfs, it makes use of Btrfs snapshot feature to clone containers. When using lxc-create, the -B need NOT to be specified as it will be used automatically if the /var/lib/lxc filesystem is found to be Btrfs.

          -B backingstore
              'backingstore' is one of 'none', 'lvm', or 'btrfs'.  The default
              is  'none', meaning that the container root filesystem will be a
              directory  under  /var/lib/lxc/container/rootfs.    The   option
              'btrfs'  need  not be specified as it will be used automatically
              if the /var/lib/lxc filesystem is found to be btrfs.   If  back?
              ingstore is 'lvm', then an lvm block device will be used and the
              following further options are available: --lvname  lvname1  will
              create an LV named lvname1 rather than the default, which is the
              container name.  --vgname vgname1 will create the LV  in  volume
              group  vgname1  rather  than  the default, lxc.  --fstype FSTYPE
              will create an FSTYPE filesystem on  the  LV,  rather  than  the
              default,  which  is  ext4.   --fssize SIZE will create a LV (and
              filesystem) of size SIZE rather than the default, which is 1G.