Skip to content

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.

5 points6 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
5 · 100% up
Kind
Text
ID
45nops

Author

7
posts
32
comments
0
media
View profile

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.

2 points

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.

1 points

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:

rootflags=defaults,lazytime,compress=lzo,space_cache,subvol=archlinux/new

You can check if the output of mount changes. The options that are currently used are listed there.

1 points

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).

2 points

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.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.