zfs disk drive letter changed. how to reimport by id

zfs disk drive letter changed. how to reimport by id

I had a power outage that caused my drives to shuffle their assignment. /dev/sdk is now assigned to a drive in a different pool. I have been searching around but not found a proper way so far to assign a disk/by-id/ listing to the broken pool as the disk still exists with no errors.

I've tried zpool import -d /dev/disk/by-id/scsi-SATA_HGST.... <disk pool> but it errors with pool exists. here is a listing of the pool

NAME                     STATE     READ WRITE CKSUM
disks                    DEGRADED     0     0     0
 mirror-0                DEGRADED     0     0     0
  6016369452066203690    UNAVAIL      0     0     0  was /dev/sdk1
  sdj                    ONLINE       0     0     0

previously I had recorded drives and their sdX mapping

scsi-SATA_HGST_HUS726060AL_AR31051EJP72EJ -> ../../sdk

which is now

scsi-SHGST_HUS726060AL5210_K1GJGWED -> ../../sdk

and the former sdk is now [which was part of the disks pool]

scsi-SATA_HGST_HUS726060AL_AR31051EJP72EJ -> ../../sdl

答案1

First: The import -d option is not meant to specify the drives, but the directory in which they are exposed:

zpool import [-d dir | -c cachefile] [-D]
    Lists pools available to import. If the -d option is not specified, this command searches for devices in "/dev/dsk". The -d option can be specified multiple times, and all directories are searched. 
...
    -d dir 
    Searches for devices or files in dir. The -d option can be specified multiple times. 
...

For more information on the usage of zpool, have a look into man zpool.

About the drive that ended up in a different pool: I cannot imagine how that ended up happening. Try removing it from the different pool with zfs remove

The following should import your pool with disk ID:

  1. Try zpool import without any argument, it should list you the available pools.

  2. Import the pool by name with zpool import <poolname>

  3. check the status with zpool status and make sure that there are no errors and wait for any resilvering to be finished before proceeding.

  4. export the pool with zpool export

  5. then reimport with zpool import -d /dev/disk/by-id/ <poolname>, only specifying the directory, not the drives files itself.

  6. If necessary, you can specify a new pool name with zpool import -d /dev/disk/by-id/ <poolname> <newpoolname>

相关内容