Ubuntu 14.04: Setting up btrfs

Create a btrfs volume on the server

We will create a btrfs volume called, say, btrfsvol-74. on a server with the IP address 111.111.111.111. I will be using three partitions on the device named sda. You will most likely want to use a different volume name and may have other device names, so every time you see something with 111.111.111.111, sda or btrfsvol-74 (marked in red), substitute something appropriate for you.
Finally we will set up the clients.

Create btrfs volume:

sudo mkfs.btrfs -f -L btrfsvol-74  /dev/sda3

Check creation:

sudo blkid /dev/sda*

Which should output something like this:

/dev/sda1: UUID="07186e16-0a79-4886-a060-617c33abf1a3" TYPE="ext4"
/dev/sda2: UUID="3059dd8d-a091-484d-b274-6735fecbbaa2" TYPE="swap"
/dev/sda3: LABEL="btrfsvol-74" UUID="cc2d74b5-9494-4c21-b7f7-d6a838f17fb0" UUID_SUB="e791304c-9693-425c-8125-99c217306e08" TYPE="btrfs"

Mount the volume. (We can grab any old partition that participates in the volume because mounting any btrfs partition will mount the whole btrfs volume):

sudo mkdir /btrfsvol-74
sudo mount /dev/sda3 /btrfsvol-74

Create fstab entry: (using UUID)

sudo vi /etc/fstab

Inserting this line:

UUID=cc2d74b5-9494-4c21-b7f7-d6a838f17fb0  /btrfsvol-74  btrfs  defaults  0 0


Configure the clients

Follow these steps to allow mounting the btrfs volume on clients:

sudo apt-get install nfs-common portmap
sudo mkdir /mnt/btrfs
sudo mount 111.111.111.111:/mnt/btrfsvol-74 /mnt/btrfs

Maintenance

sudo btrfs scrub start /btrfsvol-74/
sudo btrfs scrub status /btrfsvol-74/