Default directory used for 'zpool import' broken (/dev/dsk)?

Fabian Keil freebsd-listen at fabiankeil.de
Mon May 14 15:25:42 UTC 2012


Andriy Gapon <avg at FreeBSD.org> wrote:

> on 13/05/2012 11:53 Bruce Cran said the following:
> > When running 'zpool import' without -d I get the error:
> > "cannot open '/dev/dsk': must be an absolute path"
> > 
> > zpool(8) suggests the default should have been updated for FreeBSD:
> > "If the -d option is not specified, this command searches for devices
> > in "/dev""
> > 
> > Was this broken recently?

> Not sure, but maybe /dev/dsk is recorded somewhere in the pool metadata
> or in zpool.cache.  It could have happened with the older version of the
> code. I think that you could check that with zdb.  I think that a fresh
> import should fix it, though.

The following patch seems to work for me:

####
commit 7ec69700f2d6944a61f5c7a826e67f46fa160221
Author: Fabian Keil <fk at fabiankeil.de>
Date:   Mon May 12 16:53:56 2012 +0200

    Default to searching vdevs in /dev. /dev/dsk doesn't exist on FreeBSD.
    
    Fixes import issues if no cachefile exists and -d isn't used:
    
    fk at r500 ~ $sudo zpool import wde2
    cannot open '/dev/dsk': must be an absolute path

diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
index fe76250..5d1e454 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
@@ -1909,7 +1909,7 @@ zpool_do_import(int argc, char **argv)
 
 	if (searchdirs == NULL) {
 		searchdirs = safe_malloc(sizeof (char *));
-		searchdirs[0] = "/dev/dsk";
+		searchdirs[0] = "/dev";
 		nsearch = 1;
 	}
####

The cachefile part is speculation ...

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20120514/77656012/signature.pgp


More information about the freebsd-current mailing list