From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RrD5d-0004wz-HQ for mharc-grub-devel@gnu.org; Sat, 28 Jan 2012 13:33:29 -0500 Received: from eggs.gnu.org ([140.186.70.92]:48920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrD5b-0004w5-G8 for grub-devel@gnu.org; Sat, 28 Jan 2012 13:33:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrD5a-0008BD-GH for grub-devel@gnu.org; Sat, 28 Jan 2012 13:33:27 -0500 Received: from spam1.wiktel.com ([69.89.207.151]:36507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrD5a-0008B9-AG for grub-devel@gnu.org; Sat, 28 Jan 2012 13:33:26 -0500 Received: from [172.16.0.253] (thief-pool2-121-14.mncable.net [24.225.121.14]) (authenticated bits=0) by spam1.wiktel.com (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id q0SIXLX1000797; Sat, 28 Jan 2012 12:33:21 -0600 Subject: Re: [Patch] Robustly search for ZFS labels & uberblocks From: Richard Laager To: Vladimir =?UTF-8?Q?=27=CF=86-coder/phcoder=27?= Serbinenko In-Reply-To: <4F23EF3C.9050407@gmail.com> 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> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-0GnLOasEtm0Tyf5vVdf2" Date: Sat, 28 Jan 2012 12:33:20 -0600 Message-ID: <1327775600.9477.174.camel@watermelon.coderich.net> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 X-bounce-key: wiktel.com-1; rlaager@wiktel.com; 1327775601; PzAhIV2p0+mkxsJFsTaiE37kFjo; X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 69.89.207.151 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 18:33:28 -0000 --=-0GnLOasEtm0Tyf5vVdf2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, 2012-01-28 at 13:51 +0100, Vladimir '=CF=86-coder/phcoder' Serbinen= ko wrote: > > Index: grub/util/grub.d/10_linux.in > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- grub.orig/util/grub.d/10_linux.in 2012-01-24 23:44:10.530591000 -06= 00 > > +++ grub/util/grub.d/10_linux.in 2012-01-24 23:44:10.706928000 -0600 > > @@ -56,8 +56,10 @@ > > LINUX_ROOT_DEVICE=3DUUID=3D${GRUB_DEVICE_UUID} > > fi > > > > -if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=3Dfs 2>/dev/nul= l || true`" =3D xbtrfs ] \ > > - || [ "x`stat -f --printf=3D%T /`" =3D xbtrfs ]; then > > +LINUX_ROOT_FS=3D`${grub_probe} --device ${GRUB_DEVICE} --target=3Dfs 2= >/dev/null || true` > > +LINUX_ROOT_STAT=3D`stat -f --printf=3D%T / || true` > > + > > +if [ "x${LINUX_ROOT_FS}" =3D xbtrfs -o "x${LINUX_ROOT_STAT}" =3D xbtrf= s ]; then > > rootsubvol=3D"`make_system_path_relative_to_its_root /`" > > rootsubvol=3D"${rootsubvol#/}" > > if [ "x${rootsubvol}" !=3D x ]; then > > @@ -76,6 +78,10 @@ > > GRUB_CMDLINE_EXTRA=3D"$GRUB_CMDLINE_EXTRA crashkernel=3D384M-2G:6= 4M,2G-:128M" > > fi > > > > +if [ "x${LINUX_ROOT_FS}" =3D xzfs ]; then > > + GRUB_CMDLINE_LINUX=3D"boot=3Dzfs \$bootfs ${GRUB_CMDLINE_LINUX}" > > +fi > > + > > linux_entry () > > { > > os=3D"$1" > > @@ -114,6 +120,12 @@ > > fi > > printf '%s\n' "${prepare_boot_cache}" > > fi > > + if [ "x${LINUX_ROOT_FS}" =3D 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 / !=3D /boot, is $GRUB_DEVICE the device of / or /boot? > - Linux may be in a non-root subvolume. Then the subvolid points to=20 > wrong one. By "Linux", you're talking about the kernel, as opposed to the root filesystem, correct? What do you mean by "non-root subvolume"? That sounds like a btrfs term, not a ZFS term, so I don't follow. > - / 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. > In short: this command line part has to be generated on grub-mkconfig=20 > time and have a stable representation. I'd recommend UUID and subvolume= =20 > name. By "this command line part", are you talking about the path to the kernel? --=20 Richard --=-0GnLOasEtm0Tyf5vVdf2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAk8kP2sACgkQbfU6uV4fG84oTgCgt7y9aQWMy5Elmfwt1vWj1oWO lqEAnAyXM7LRC8NPMqk7ghr/Vrx5zItb =z9Wk -----END PGP SIGNATURE----- --=-0GnLOasEtm0Tyf5vVdf2--