[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Patch] Robustly search for ZFS labels & uberblocks
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [Patch] Robustly search for ZFS labels & uberblocks |
Date: |
Sat, 28 Jan 2012 20:21:19 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 |
On 28.01.2012 19:33, Richard Laager wrote:
On Sat, 2012-01-28 at 13:51 +0100, Vladimir 'φ-coder/phcoder' Serbinenko
wrote:
Index: grub/util/grub.d/10_linux.in
===================================================================
--- grub.orig/util/grub.d/10_linux.in 2012-01-24 23:44:10.530591000 -0600
+++ grub/util/grub.d/10_linux.in 2012-01-24 23:44:10.706928000 -0600
@@ -56,8 +56,10 @@
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null ||
true`" = xbtrfs ] \
- || [ "x`stat -f --printf=%T /`" = xbtrfs ]; then
+LINUX_ROOT_FS=`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null
|| true`
+LINUX_ROOT_STAT=`stat -f --printf=%T / || true`
+
+if [ "x${LINUX_ROOT_FS}" = xbtrfs -o "x${LINUX_ROOT_STAT}" = xbtrfs ]; then
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
@@ -76,6 +78,10 @@
GRUB_CMDLINE_EXTRA="$GRUB_CMDLINE_EXTRA crashkernel=384M-2G:64M,2G-:128M"
fi
+if [ "x${LINUX_ROOT_FS}" = xzfs ]; then
+ GRUB_CMDLINE_LINUX="boot=zfs \$bootfs ${GRUB_CMDLINE_LINUX}"
+fi
+
linux_entry ()
{
os="$1"
@@ -114,6 +120,12 @@
fi
printf '%s\n' "${prepare_boot_cache}"
fi
+ if [ "x${LINUX_ROOT_FS}" = xzfs ]; then
+ cat<< EOF
+ insmod zfsinfo
+ zfs-bootfs (\$root) bootfs
This makes 3 wrong assumptions in a row:
- / and /boot may be different.
Despite the variable being called LINUX_ROOT_FS, this is really the
output from grub-probe --device ${GRUB_DEVICE}. When / != /boot, is
$GRUB_DEVICE the device of / or /boot?
Yes. But "zfs-bootfs (\$root) bootfs" will fill "bootfs" with the info
for /boot.
- Linux may be in a non-root subvolume. Then the subvolid points to
wrong one.
By "Linux", you're talking about the kernel, as opposed to the root
filesystem, correct?
Sorry, I used wrong term. I meant "OS root".
What do you mean by "non-root subvolume"? That sounds like a btrfs term,
not a ZFS term, so I don't follow.
I refuse to use ZFS terminology due to its term misuse for marketing
reasons (calling subvolume a "filesystem" just to say "we handle
N*1000000 filesystems on the server" is pure marketing).
In short my system may be in mypool/OS/Debian and not just mypool/
- / may be unaccessible to GRUB altogether.
Are you talking about at grub-install time or boot time? Can you provide
an example of when this might happen, so I can understand.
boot time. Easy: ZFS on LUKS with a separate /boot and GRUB LUKS support
disabled (like the default).
In short: this command line part has to be generated on grub-mkconfig
time and have a stable representation. I'd recommend UUID and subvolume
name.
By "this command line part", are you talking about the path to the
kernel?
The part "fs=zfs $bootfs"
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
- Re: [Patch] Robustly search for ZFS labels & uberblocks, (continued)
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/22
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/24
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Zachary Bedell, 2012/01/27
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/27
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/27
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Darik Horn, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks,
Vladimir 'φ-coder/phcoder' Serbinenko <=
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/29
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/31
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Darik Horn, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/28
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Richard Laager, 2012/01/29
- Re: [Patch] Robustly search for ZFS labels & uberblocks, Vladimir 'φ-coder/phcoder' Serbinenko, 2012/01/29