On Fri, Jan 31, 2014 at 11:13:41AM -0700, Michael Torrie wrote:
Question is, has anyone been using btrfs for root, and if so what volume
and subvolume layouts did you use?  I will be keeping my home
directories on a completely separate partition/volume.  But on root,
should I have a separate volume for /var?

I've played around a little with btrfs on an old workstation using Arch, but I admit I don't have it perfect yet (I can't get the machine to power off cleanly for some reason). My setup is a little different than yours, but here it is:

$ lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sdb 8:16 0 136.8G 0 disk ├─sdb1 8:17 0 1007K 0 part ├─sdb2 8:18 0 100M 0 part │ └─md127 9:127 0 99.9M 0 raid1 /boot
├─sdb3      8:19   0     2G  0 part  [SWAP]
└─sdb4      8:20   0 134.5G  0 part  /home
sdc 8:32 0 136.8G 0 disk ├─sdc1 8:33 0 1007K 0 part ├─sdc2 8:34 0 100M 0 part │ └─md127 9:127 0 99.9M 0 raid1 /boot
├─sdc3      8:35   0     2G  0 part  [SWAP]
└─sdc4 8:36 0 134.5G 0 part I have two SCSI drives (I did say it was an old workstation) and basically am using RAID-1. The drives are partitioned with a GPT layout and I use grub, so /dev/sd{b,c}1 is the BIOS boot partition for grub. /dev/sd{b,c}2 is an ext3 /boot partition, using md-raid in RAID-1. /dev/sd{b,c}3 are swap partitions, no explicit raid, but both are used (if needed). Finally, /dev/sd{b,c}4 is my btrfs filesystem.

The single filesystem has two subvolumes, for / and for /home:

$ sudo btrfs subvol list /
ID 258 gen 10556 top level 5 path root
ID 259 gen 10556 top level 5 path home

The root and home partitions are mounted as follows (I replaced the UUIDs with dummy values here):

$ cat /etc/fstab
# <file system> <dir>   <type>  <options>   <dump>  <pass>
# /dev/sdb3
UUID=xxx / btrfs rw,noatime,autodefrag,space_cache,subvol=root,user_xattr 0 0

# /dev/sdb3
UUID=yyy /home btrfs rw,noatime,autodefrag,space_cache,subvol=home,user_xattr 0 0

Note that the kernel commandline needs to be modified to mount / from a subvol:

$ cat /proc/cmdline BOOT_IMAGE=/vmlinuz-linux root=UUID=xxx rw rootflags=subvol=root

Grub is smart enough to detect this and add these flags for me automatically.

From what I've seen, everything runs great except for the issue of cleanly halting the machine. I'll fix that later if/when I have the time/interest. It's been fun playing around with btrfs, but in some respects ZFS seems better to me.

--
Rich

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to