Booting from btrfs subvolume
-
- Offline
- 1 year 2 months ago
- 2015-07-12
As this is my first post here: hello everyone! :)
I'm slowly migrating to AL and have some struggle with booting from btrfs subvolume
. My goal is to have one big partition, totally owned by btrfs and rest of the dividing should be handled by subvolumes.
What's working:
1. One big partition on msdos/mbr with no subvolumes at all.
2. One big partition on gpt with no subvolumes at all.
3. With separate /boot partition on msdos/mbr with no subvolumes at all.
4. With separate /boot partition on gpt with no subvolumes at all.
5. With separate /boot partition on msdos/mbr with btrfs subvolumes and with set-default subvolumes set to @.
6. With separate /boot partition on gpt with btrfs subvolumes and with set-default subvolumes set to @.
What's not working:
I was going to create bug report/feature request, but thought that I might be missing some obvious step that's escaping my attention -- hence the topic. Here are my steps when I try to boot from btrfs subvolume:
1. Booting AL & running quick setup via setup-alpine -q
.
2. Install parted
and btrfs-progs
with all dependencies necessary.
3. Using parted to end up with following partitioning:
Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 3146kB 2097kB btrfs bios_grub 2 3146kB 21.5GB 21.5GB btrfs legacy_boot
This is an example for GPT partition table, but it doesn't work on MBR/msdos either.
4. mkfs.btrfs /dev/sda2
and mount -t btrfs -o rw,noatime /dev/sda2 /mnt
.
5. cd /mnt
and btrfs subvolume create @
(yes, naming convention taken from Ubuntu, get over it).
6. cd
and umount /mnt
.
7. mount -t btrfs -o rw,noatime,subvol=@ /dev/sda2 /mnt
8. Once that's done, one may confirm via grep btrfs /proc/self/mountinfo
that indeed subvolume is being used.
9. mkdir /mnt/boot
-- even though I'm not using separete /boot partition, this step is still necessary (bug? feature?).
10. Installation ongoing: setup-disk -v /mnt
.
11. Once installation is done, my understanding is, that there are three steps necessary (in case of GPT at least):
a) edit /etc/fstab
and add subvol=@
to the mount options for the root partition.
b) edit /boot/extlinux.conf
and add rootflags=subvol=@
in the APPEND section.
c) dd gptmbr.bin to /dev/sda
.
The problem is, that it won't boot. I tested this stuff out with using separate /boot
partition and figured, that the only way to boot it is to use btrfs subvolume set-default #ID (taken from btrfs subvolume list command) /path
-- but this way the whole point of using subvolumes is lost, one can just not make the whole effort in the first place (also this way /etc/fstab
for the root partition is omitted and it doesn't matter whether there's rootflags
specified in the extlinux.conf
).
For me it looks a bit like rootflags is not being respected by the bootloader -- which is weird, cause this is the way it should work and is working in other distributions (RHEL: https://bugzilla.redhat.com/show_bug.cgi?id=1033764, Slackware: http://dvaerghoffmann.tumblr.com/post/33722281147/install-slackware-14-btrfs-extlinux-ext2).
Is rootflags available in extlinux provided by AL? Am I missing any step after editing /boot/extlinux.conf
file? Should I somehow update the config differently? Any ideas anybody? Maybe someone already have it working?
All the best
-Hadret