Ask Your Question

How can I add entries to the Grub menu to boot into my Btrfs snapshots of /?

asked 2016-06-24 03:25:12 -0500

BeOS gravatar image

updated 2016-06-24 03:27:26 -0500

Whenever I create a new Btrfs snapshot for / I want a new entry to be added to Grub (ideally automatically but manually is okay too) so that I have the option to directly boot into that snapshot.

Is this possible? If yes, how can I do it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-04 19:32:17 -0500

cmurf gravatar image

One way is to manually duplicate a menuentry in the grub.cfg and change the rootflags=subvol= argument to match the name of the snapshot. Of course this only works if the snapshot is a read write snapshot (which is the default for 'btrfs sub snap' command), because I think right now Fedora doesn't really support read only root fs. Of course this menu entry gets obliterated should you run grub2-mkconfig for any reason, since that creates a new grub.cfg. So you could add the menuentries to /etc/grub.d/50_ or 51_ I forget which is easier. One of those supports drop in scripts that get collected into grub.cfg by grub2-mkconfig so you can use either one, it's personal preference which you use.

Last, openSUSE carries a bunch of Btrfs specific patches for GRUB that includes automatically finding and listing snapshots. They do support read only snapshots for booting from GRUB so you'll have to inspect those patches and adapt them for Fedora.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-06-24 03:25:12 -0500

Seen: 708 times

Last updated: Jul 04 '16