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

Karl Pielorz kpielorz_lst at tdx.co.uk
Tue Oct 19 14:52:54 UTC 2010


Hi,

On FreeBSD if I bring the system up 'single user' - the first time I do 
(for example):

"
zpool status
"

There's a pause, a flurry of disk activity - and the system appears to 
import any pools it finds, and the status appears.

I'd guess at this point - some data is written to the disks? - Is there any 
way of avoiding that, i.e. a kind of "If you were to import the 
pools/display a status, what would you show, without actually writing any 
data?" (or importing it) - i.e. to ensure the devices are opened read only?

The reason I ask is we recently had a pool that had a mishap. The backing 
RAID controller dropped a drive (we were using them in JBOD). This happened 
cleanly. The system got shutdown, and I think the wrong drive was replaced.

When it came up the RAID controller 'collapsed' the device list (so there 
was no gap where the old drive was) - that, plus the wrong drive being 
replaced meant when we looked at the system we had:

"
  pool: vol
 state: UNAVAIL
status: One or more devices could not be used because the label is missing
        or invalid.  There are insufficient replicas for the pool to
        continue functioning.
"

A number of devices were listed as 'corrupted data' - some devices were 
listed twice as members of the pool - i.e. pretty screwed up.

'undoing' the damage and restarting the server - just threw up the same 
status.

I'm wondering if through the action of having the pool imported/mounted 
etc. - ZFS has actually *written* to the drives that were available that 
other drives aren't available / corrupt - and basically, because that info 
was written, and check-summed correctly - it takes that as gospel now, 
rather than actually 're-checking' the drives (or is simply unable to 
re-check the drives - because the meta data has been changed from the 
previous boot).

If you see what I mean :)

In the end, we're fortunate - we have backups (and they're currently 
restoring now) - but I was just interested in if you 'attempt' to 
mount/import a messed up pool - it could potentially screwup any chances of 
mounting that pool cleanly again, even if you were to 'undo' the hardware 
changes.

I have a feeling that a zpool import or 'initial' zpool status has to be a 
read/write operation (i.e. would fail anyway if you could magically make 
the underlying devices read-only?)

-Kp


More information about the freebsd-fs mailing list