Force ZFS to always look for devices in a defined location

Freddie Cash fjwcash at gmail.com
Wed Dec 28 17:17:01 UTC 2016


On Dec 27, 2016 11:03 PM, "Ben RUBSON" <ben.rubson at gmail.com> wrote:

Hello,

My zpools are made of devices from /dev/label.
Example :

NAME               STATE     READ WRITE CKSUM
my-zpool           ONLINE       0     0     0
  mirror-0         ONLINE       0     0     0
    label/slotone  ONLINE       0     0     0
    label/slottwo  ONLINE       0     0     0
(...)

For some reasons, it may happen that access to some devices fails and
devices (quickly) toggle between ONLINE and UNAVAIL/REMOVED state.
Then, sometimes, ZFS re-use the device using the /dev/da path, instead of
waiting for the /dev/label path to be rediscovered by the system.

It then leads to something like this, with is not nice, and not really
correct (as last sector of /dev/da contains the label) :

NAME               STATE     READ WRITE CKSUM
my-zpool           ONLINE       0     0     0
  mirror-0         ONLINE       0     0     0
    label/slotone  ONLINE       0     0     0
    da14           ONLINE       0     0     0
(...)

My question is then, how to force ZFS to look for devices in a defined
location ?
(/dev/label/ in this example)

I tried to offline / online impacted devices (da*), but it does not work,
they do not come back with their /dev/label path.
Zpool export / import works, but of course this is something we would like
to avoid.

Many thanks !

Ben


Export the pool.

Then use -d to import it using the labels:

zpool import -d /dev/label my-zpool

That will search the label directory for pool devices and use that path
into the GEOM layer. And it will remember it for future imports. Aft least
until things get confused again in the future. :)

Cheers,
Freddie


More information about the freebsd-fs mailing list