Rough notes, getting btrfs working on Digital Ocean

(Sam Saffron) #1

Following Report on using discourse_docker on a CoreOS image I decided to play with setting up btrfs in digital ocean.

Creating a btrfs volume and mounting it:

mkdir /img
dd if=/dev/zero of=/img/btrfs.img bs=1024 count=10000000
mkfs.btrfs /img/btrfs.img
mount -o loop /img/btrfs.img /var/lib/docker

At this point we have a btrfs 10gig volume mounted in /var/lib/docker. Next we need to tell docker to use btrfs.

vim /etc/default/docker


DOCKER_OPTS="-s btrfs"

Restart docker

service docker restart

Ensure btrfs is running:

root@btrfs:/var/discourse# docker info
Containers: 1
Images: 20
Storage Driver: btrfs
Execution Driver: native-0.2
Kernel Version: 3.13.0-32-generic
Operating System: Ubuntu 14.04.1 LTS
WARNING: No swap limit support

Ensure btrfs is mounted on boot

vim /etc/fstab


/img/btrfs.img /var/lib/docker btrfs loop

Done, booting rails is now 40% faster.

time rake routes 


real 0m6.014s


real 0m10.273s


Migrating is going to be tricky cause the volume will need resizing.



are now running on btrfs.

(Gerhard Schlager) #2

Shouldn’t this be of=~/btrfs.img or am I missing something?

What do you mean by that? Migration of what?

(Jens Maier) #3

Nope, but it’s missing a mkdir /img. :wink:

(Sam Saffron) #4

migrating from a non-btrfs setup to a btrfs setup.

on second thoughts it might be not as bad as I though cause you want to cap the size consumed by docker images anyway.

(Sam Saffron) #5

I tweaked the instructions, they were a bit off.

(Balázs Nagy) #6

Nice. I’m looking forward giving btrfs a block device by zfs.

(Jeff Atwood) #7

Just as an update, has been running with btrfs for a while now, but I’ve seen no real performance benefit in admin/upgrade at all – if anything it’s a little slower.

No issues, though.

(Jeff Atwood) #8

Further update, eventually this droplet ate dirt and I had to rebuild from the automated Discourse daily backup. So I do not recommend btrfs at all. No speed improvement (that I could see) and more risk.

(Jeff Atwood) #9