From e74c31125d2466db7d5a190f924b1abee6094947 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 13 Apr 2011 12:57:26 +0100 Subject: [PATCH] * util/grub.d/10_linux.in: Add rootflags=subvol= if / is on a btrfs subvolume. * util/grub.d/20_linux_xen.in: Likewise. --- ChangeLog | 6 ++++++ util/grub.d/10_linux.in | 8 ++++++++ util/grub.d/20_linux_xen.in | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index d0269c905..47935890d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-13 Colin Watson + + * util/grub.d/10_linux.in: Add rootflags=subvol= if / is on a + btrfs subvolume. + * util/grub.d/20_linux_xen.in: Likewise. + 2011-04-13 Colin Watson Rewrite /proc/self/mountinfo handling to cope with bind-mounts and diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 930ce06ef..1dbcad90c 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -51,6 +51,14 @@ else LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} fi +if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then + rootsubvol="`make_system_path_relative_to_its_root /`" + rootsubvol="${rootsubvol#/}" + if [ "x${rootsubvol}" != x ]; then + GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" + fi +fi + linux_entry () { os="$1" diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 858627aa3..a9007603d 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -51,6 +51,14 @@ else LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} fi +if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then + rootsubvol="`make_system_path_relative_to_its_root /`" + rootsubvol="${rootsubvol#/}" + if [ "x${rootsubvol}" != x ]; then + GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" + fi +fi + linux_entry () { os="$1"