Is there a way to mount specify boot partition dynamically? | BTRFS subvolumes
As you can see from files bellow I need to indicate path to root 2 times:
- once in refind.conf/refind_linux.conf
- once in
/etc/fstab
It would be awesome if / partition would be mounted automatically based on partition where /boot is, aka archlinux/new/boot specified in /boot/efi/EFI/refind/refind.conf. Then it would only be necessary to change one file instead of 3.
Do you have any thought on how to make snapshots automatically bootable, without editing 3 files in a row, but only one top?
cat /boot/efi/EFI/refind/refind.conf
timeout 20
use_graphics_for windows,linux
also_scan_dirs + archlinux/new/boot
cat /mnt/btrfs/archlinux/new/boot/refind_linux.conf
"Boot using default options" "root=PARTUUID=fb884168-0d7f-4fa2-8b42-16e249a702e8 rootfstype=btrfs rootflags=subvol=archlinux/new rw add_efi_memmap initrd=/archlinux/current/boot/intel-ucode.img"
cat /mnt/btrfs/archlinux/new/etc/fstab
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
PARTUUID="fb884168-0d7f-4fa2-8b42-16e249a702e8" / btrfs defaults,subvol=archlinux/new 0 0
...
Interesting resource on topic https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
Edited 15 Feb 2016. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 5 · 100% up
- Kind
- Text
- ID
- 45nops
6 comments
You simply have to remove the entry for "/" out of your fstab. It will then use what's on the kernel command line.
I was hoping for something like that! Were did you found it, btw?
The only problem of course is that in this case there is no way to set mount options, but I am using defaults for btrfs so far.
I knew that it still works when fstab doesn't have the entry because of mistakes in the past. :)
Can you try to add your mount options to the "rootflags=" parameter on the kernel command line? From examples I found online, it seems it can take the normal mount options separated by
,so perhaps something like this works:You can check if the output of
mountchanges. The options that are currently used are listed there.If you omit explicit subvol from rootflags btrfs will mount the default subvolume. You can learn how to change the default subvolume here.
If that doesn't help you can always write a simple bash script (a single
sed, really).I do not want to resort to default because usually I have various installations on single partition.
Yeah, probably will have to do some scripting.