[zfs-discuss] Problems installing ubuntu 11.04 with native ZFS root

Swâmi Petaramesh swami at petaramesh.org
Thu Jul 21 18:52:23 EDT 2011


Le jeudi 21 juillet 2011, Brian Behlendorf a écrit :
> On Thu, 2011-07-21 at 10:20 -0700, Zachary Bedell wrote:
> > On Jul 21, 2011, at 2:07 AM, Swâmi Petaramesh wrote:
> > > the "zfs import BLAH" in initramfs will ALWAYS FAIL here because my
> > > system will always think the pool is "already imported", not having
> > > been exported at system shutdown.
> > 
> > That does actually sound like incorrect behavior in the script.  If
> > /etc/hostid and /etc/zfs/zpool.cache are correct and available to the
> > initrd, then just doing `modprobe zfs` should result in the pools
> > imported without needing to import them explicitly.
> 
> Right, if /etc/zfs/zpool.cache exists at module load time the pools will
> be automatically imported.  I've flirted with the idea of making this
> behavior configurable with a zfs module option since there are times
> when this would be undesirable.

For the time being, I would at least suggest the following patch to 
/usr/share/initramfs-tools/scripts/zfs from package zfs-initramfs, tested here 
and working :

--- zfs-original        2011-07-21 08:27:36.009939000 +0200
+++ zfs 2011-07-21 08:29:10.859440000 +0200
@@ -57,7 +57,7 @@
        # Import the root pool, but don't mount it.  Doing `-R /` instead of
        # `-R $rootmnt` keeps the namespace sensible after the pivot.
        [ "$quiet" != "y" ] && log_begin_msg "Importing ZFS root pool 
$ZFS_RPOOL"
-       ZFS_STDERR=$(zpool import -R / -N "$ZFS_RPOOL" 2>&1)
+       ZFS_STDERR=$(zpool list "$ZFS_RPOOL" || zpool import -R / -N 
"$ZFS_RPOOL" 2>&1)
        ZFS_ERROR=$?
        [ "$quiet" != "y" ] && log_end_msg


(Beware of 2 undesireable line breaks in email...)


-- 
Swâmi Petaramesh <swami at petaramesh.org> http://petaramesh.org PGP 9076E32E



More information about the zfs-discuss mailing list