I'm trying to move /var/log/. to its own subvolume. I've tried a number of things, but the /etc/fstab entry never does what I'd hope. My examples here use /spam
because I don't want to trash the log files while I work this out. My questions are in bold below.
I won't bore you with what won't work. But here's where I'm at:
thor / 158# btrfs subvolume create /spam
Create subvolume '//spam'
thor / 161# ll -d spam
drwxr-xr-x 1 root root 0 Jul 25 16:19 spam/
thor / 163# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
udev devtmpfs 1540072 0 1540072 0% /dev
tmpfs tmpfs 310140 5380 304760 2% /run
/dev/sdb1 btrfs 33739776 7791536 24482480 25% /
tmpfs tmpfs 1550684 156 1550528 1% /dev/shm
tmpfs tmpfs 5120 4 5116 1% /run/lock
tmpfs tmpfs 1550684 0 1550684 0% /sys/fs/cgroup
/dev/sdb1 btrfs 33739776 7791536 24482480 25% /home
cgmfs tmpfs 100 0 100 0% /run/cgmanager/fs
tmpfs tmpfs 310140 44 310096 1% /run/user/1000
thor / 164# btrfs subvolume list /
ID 257 gen 289 top level 5 path @
ID 258 gen 286 top level 5 path @home
ID 263 gen 41 top level 257 path var/lib/machines
ID 275 gen 287 top level 257 path spam
thor / 165# grep -v '^#' /etc/fstab
UUID=ee321c37-2ccc-4016-aa0b-9cf9280be11e / btrfs defaults,subvol=@ 0 1
UUID=ee321c37-2ccc-4016-aa0b-9cf9280be11e /home btrfs defaults,subvol=@home 0 2
UUID=aff22fd4-48d6-4c8c-9c2e-260c05028fba none swap sw 0 0
thor / 166#
My OpenSUSE machine (hence the different UUID) mounts a bunch of subvolumes from the fstab
with entries such as:
UUID=2c2aa4ed-bb4e-4c44-b222-4e75dc0469f2 /spam btrfs subvol=spam 0 0
If I try this on my Ubuntu machine, it won't boot. An strace
from single user mode show that mount(2)
fails with:
mount("/dev/sdb1", "/spam", "btrfs", MS_MGC_VAL, "subvol=spam") = -1 ENOENT (No such file or directory)
Furthermore, if I df the directory, I get this:
thor /spam 174# df -T /spam/.
Filesystem Type 1K-blocks Used Available Use% Mounted on
- - 33739776 7791776 24482368 25% /spam
thor /spam 175#
My first question: What am I missing? Something's wrong because it's mis-behaving. Second question: Am I posting in the right place? Thanks!
Update 1:
thor /spam 175# uname -a
Linux thor 3.19.0-23-generic #24-Ubuntu SMP Tue Jul 7 18:52:29 UTC 2015 i686 i686 i686 GNU/Linux
My first question: What am I missing? Something's wrong because it's mis-behaving.
Currently, the path of your spam
subvolume with respect to the btrfs root is @/spam
because the spam
subvolume was created within the @
subvolume. Use btrfs sub list -a /
to see this. You will need subvol=@/spam
in fstab
to mount it.
But I think you actually want to create the subvolume in the btrfs root itself, in which case you will need to mount the root somewhere to create the subvolume:
mkdir -p /mnt/tmp/
mount -o subvol=/ /dev/sdb1 /mnt/tmp/
btrfs sub create /mnt/tmp/spam/
Second question: Am I posting in the right place?
I suggest the Unix/Linux Stack Exchange for questions like this.