ZFS 'read-only' device / pool scan / import?

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Oct 23 10:03:52 UTC 2010


On Sat, Oct 23, 2010 at 09:56:43AM +0100, Karl Pielorz wrote:
> 
> --On 20 October 2010 11:35 +0100 Pete French <petefrench at ticketswitch.com> 
> wrote:
> 
> >You can do a forced export - as long as the system doesnt think
> >the pool is imported then an import will go looking. I made a
> >similar mess of my drives the first time I changed discs oover, and I
> >also didnt know about the import/export trick. But since then I
> >have used iit every time I have got into trouble and it has always
> >worked for me.
> 
> As a follow up to this - we tried to reproduce the original problem once 
> we'd restored the data. We removed a drive - rebooted, and got 'a mess':
> 
> "
>        NAME        STATE     READ WRITE CKSUM
>        vol         UNAVAIL      0     0     0  insufficient replicas
>          mirror    ONLINE       0     0     0
>            da1     ONLINE       0     0     0
>            da2     ONLINE       0     0     0
>            da3     UNAVAIL      0     0     0  corrupted data
>          mirror    UNAVAIL      0     0     0  insufficient replicas
>            da4     FAULTED      0     0     0  corrupted data
>            da5     FAULTED      0     0     0  corrupted data
>            da6     FAULTED      0     0     0  corrupted data
>          mirror    UNAVAIL      0     0     0  insufficient replicas
>            da7     FAULTED      0     0     0  corrupted data
>            da8     FAULTED      0     0     0  corrupted data
>            da9     FAULTED      0     0     0  corrupted data
>          mirror    UNAVAIL      0     0     0  insufficient replicas
>            da10    FAULTED      0     0     0  corrupted data
>            da11    FAULTED      0     0     0  corrupted data
> "

Your analysis is incorrect, I'm afraid. ZFS in FreeBSD can cope really
well with disks name changes. Your problem is somewhere else. My guess
is that you booted your machine in single-user mode and you didn't run:

	# /etc/rc.d/hostid start

ZFS has protection for SAN/NAS environments where it keeps hostid in its
metadata, so when you try to import the pool on different machine by
accident it will warn you and will require -f option if you really know
what you are doing. The rc.d/hostid script is there to configure hostid
for your system. It is not executed in single-user mode, so hostid of
your system is not set properly.

I do agree that running /etc/rc.d/hostid in single-user mode should be
documented better.

> Doing a zpool export, then a zpool import (which required '-f' to get past 
> "cannot import 'vol': pool may be in use from other system use '-f' to 
> import anyway")

Yes, -f is required, because hostid is now different (uninitialized),
but really you don't need export/import cycle if you first set your
hostid right.

If you could repeat your test, but executing the following command in
the following order once you boot into single-user mode:

	# /etc/rc.d/hostid start
	# zpool status

> Seems to have done the trick:
[...]

When you now boot in multi-user mode I guess you will have the same
problem, because now ZFS stored invalid (uninitialized) hostid in its
metadata.

As for read-only imports. This is not possible in the ZFS version we
have now, but such functionality is available in most recent ZFS, which
is not yet in FreeBSD.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20101023/03a8e495/attachment.pgp


More information about the freebsd-fs mailing list