From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RrDq4-0003Id-I8 for mharc-grub-devel@gnu.org; Sat, 28 Jan 2012 14:21:28 -0500 Received: from eggs.gnu.org ([140.186.70.92]:45787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrDq1-0003Gu-El for grub-devel@gnu.org; Sat, 28 Jan 2012 14:21:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrDq0-0005K9-0e for grub-devel@gnu.org; Sat, 28 Jan 2012 14:21:25 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:48478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrDpz-0005K2-R2 for grub-devel@gnu.org; Sat, 28 Jan 2012 14:21:23 -0500 Received: by wgbds1 with SMTP id ds1so2480575wgb.30 for ; Sat, 28 Jan 2012 11:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=02CZIJj4SitN+nRrlmNYPPd1vUkCYeI4e3NkKvYV86k=; b=M4Nr3TOomdN2zyOvcY1huHIUuFViSk6+8oIY2JNiiPFARLLa0K8Jn+qo12uivzqzi+ unZStQLorLwICsDK0E4KP6ab3lgeM6iWJRD4LEyomcIEKVXEpbFOyjDvF9Htg/abI7st vh3JB68owmVB2GekQkUPk862r0dGt6tIkuti0= Received: by 10.180.94.68 with SMTP id da4mr17906172wib.22.1327778482926; Sat, 28 Jan 2012 11:21:22 -0800 (PST) Received: from fedora.x201.phnet (94-26.62-81.cust.bluewin.ch. [81.62.26.94]) by mx.google.com with ESMTPS id t6sm19691115wid.1.2012.01.28.11.21.20 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 28 Jan 2012 11:21:21 -0800 (PST) Message-ID: <4F244AAF.5030908@gmail.com> Date: Sat, 28 Jan 2012 20:21:19 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Richard Laager Subject: Re: [Patch] Robustly search for ZFS labels & uberblocks References: <4E838F85.6060001@gmail.com> <1326973014.6387.224.camel@watermelon.coderich.net> <4F1C1ABD.1010303@gmail.com> <1327719035.9477.68.camel@watermelon.coderich.net> <4F23EF3C.9050407@gmail.com> <1327775600.9477.174.camel@watermelon.coderich.net> In-Reply-To: <1327775600.9477.174.camel@watermelon.coderich.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.49 Cc: grub-devel@gnu.org, Zachary Bedell X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jan 2012 19:21:26 -0000 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