如何将降级的驱动器恢复到 zpool?

如何将降级的驱动器恢复到 zpool?

我的 zpool 出现了问题 - dev id 发生了改变并且其中一个驱动器因性能下降而退出了。

我已导出该池并使用此命令重新导入:

zpool import -d /dev/disk/by-id zpool_primary

现在状态显示为:

root@gomez:/home/nick# zpool status
pool: zpool_primary
state: DEGRADED
status: One or more devices has been taken offline by the administrator.
        Sufficient replicas exist for the pool to continue functioning in a
        degraded state.
action: Online the device using 'zpool online' or replace the device with
        'zpool replace'.
scan: none requested
config:

        NAME                        STATE     READ WRITE CKSUM
        zpool_primary               DEGRADED     0     0     0
          mirror-0                  DEGRADED     0     0     0
            wwn-0x5000cca27ec5c30d  ONLINE       0     0     0
            15142782844563214281    OFFLINE      0     0     0  was /dev/disk/by-id/wwn-0x5000cca252f6d327-part1

查看磁盘 ID 列表:

root@gomez:/# ls /dev/disk/by-id
ata-SAMSUNG_HD204UI_S2HGJD1B503074           ata-WDC_WD80EZAZ-11TDBA0_1EGDNY2Z        ata-WDC_WD80EZAZ-11TDBA0_7SKWLU6W-part1  wwn-0x5000cca252f6d327-part9  wwn-0x5001b44f1aef7769
ata-SAMSUNG_HD204UI_S2HGJD1B503074-part1     ata-WDC_WD80EZAZ-11TDBA0_1EGDNY2Z-part1  ata-WDC_WD80EZAZ-11TDBA0_7SKWLU6W-part9  wwn-0x5000cca27ec5c30d        wwn-0x5001b44f1aef7769-part1
ata-SanDisk_SDSSDHII120G_154876410729        ata-WDC_WD80EZAZ-11TDBA0_1EGDNY2Z-part9  wwn-0x5000cca252f6d327                   wwn-0x5000cca27ec5c30d-part1  wwn-0x50024e9004e3d4f2
ata-SanDisk_SDSSDHII120G_154876410729-part1  ata-WDC_WD80EZAZ-11TDBA0_7SKWLU6W        wwn-0x5000cca252f6d327-part1             wwn-0x5000cca27ec5c30d-part9  wwn-0x50024e9004e3d4f2-part1

“修复”离线驱动器的最简单方法是什么?它之前已降级,我将其设置为离线以进行导出等操作。

我可以通过重复导出/导入过程来完成此操作吗?当我再次导入时,不清楚是否应该指定要包含的每个驱动器的 ID。如果是这种情况,命令会是什么样子?我假设我想要使用的 ID 是 wwn-0x5000cca252f6d327(即末尾没有“part1”)

否则,我是否需要“替换” zpool 中的驱动器并重新镀银?

答案1

我通过实验修复了这个问题(因为导出和导入都是无损的)。

查看 blkid,我发现两个驱动器具有相同的 UUID:

root@gomez:/dev/disk/by-uuid# blkid
/dev/sda1: LABEL="OS" UUID="e82b3fae-dce5-4b41-bd87-1f7bbd5f8039" TYPE="ext4" PARTUUID="5805358e-01"
/dev/sdb1: LABEL="zpool_primary" UUID="9579775147971336578" UUID_SUB="6175940412684032547" TYPE="zfs_member" PARTLABEL="zfs-efd142ee34d8cfea" PARTUUID="018883e2-0067-ac4b-8126-a2c02d0cfa45"
/dev/sdc1: LABEL="CCTVPartition" UUID="6b35ec61-13aa-46f9-b6b7-dfd4b264318f" TYPE="ext4" PARTLABEL="primary" PARTUUID="a31f929b-0989-4baa-8faf-082be6fca607"
/dev/sdd1: LABEL="zpool_primary" UUID="9579775147971336578" UUID_SUB="15142782844563214281" TYPE="zfs_member" PARTLABEL="zfs-693944edaab7d9e6" PARTUUID="91203b94-8387-1e4e-8646-5ba2cb6c461f"
/dev/sdb9: PARTUUID="e18a4bf7-b4c9-2149-bcd2-19ab9ba2182c"
/dev/sdd9: PARTUUID="009580ae-4c61-ab4d-a923-b7dc6ba14faa"

因此,我使用 UUID 导入了驱动器(并使用 zdb 验证导入):

root@gomez:/dev/disk/by-id# zpool import -d /dev/disk/by-uuid/ zpool_primary
root@gomez:/dev/disk/by-id# zdb
zpool_primary:
    version: 5000
    name: 'zpool_primary'
    state: 0
    txg: 1160981
    pool_guid: 9579775147971336578
    errata: 0
    hostname: 'gomez'
    com.delphix:has_per_vdev_zaps
    vdev_children: 1
    vdev_tree:
        type: 'root'
        id: 0
        guid: 9579775147971336578
        children[0]:
            type: 'mirror'
            id: 0
            guid: 17679195099076183548
            metaslab_array: 256
            metaslab_shift: 36
            ashift: 12
            asize: 8001548713984
            is_log: 0
            create_txg: 4
            com.delphix:vdev_zap_top: 129
            children[0]:
                type: 'disk'
                id: 0
                guid: 6175940412684032547
                path: '/dev/sdb1'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 130
            children[1]:
                type: 'disk'
                id: 1
                guid: 15142782844563214281
                path: '/dev/disk/by-uuid/9579775147971336578'
                whole_disk: 1
                create_txg: 4
                com.delphix:vdev_zap_leaf: 131
    features_for_read:
        com.delphix:hole_birth
        com.delphix:embedded_data

该矿池已启动并运行,但带有不寻常的标识符:

root@gomez:/dev/disk/by-id# zpool status
  pool: zpool_primary
 state: ONLINE
status: One or more devices has experienced an unrecoverable error.  An
        attempt was made to correct the error.  Applications are unaffected.
action: Determine if the device needs to be replaced, and clear the errors
        using 'zpool clear' or replace the device with 'zpool replace'.
   see: http://zfsonlinux.org/msg/ZFS-8000-9P
  scan: none requested
config:

        NAME                     STATE     READ WRITE CKSUM
        zpool_primary            ONLINE       0     0     0
          mirror-0               ONLINE       0     0     0
            sdb                  ONLINE       0     0     0
            9579775147971336578  ONLINE       0     0     1

然后我再次将其导出,并最后使用 by-id 重新导入:

root@gomez:/dev/disk/by-id# zpool export zpool_primary
root@gomez:/dev/disk/by-id# zpool import -d /dev/disk/by-id/ zpool_primary
root@gomez:/dev/disk/by-id# zpool status
  pool: zpool_primary
 state: ONLINE
  scan: none requested
config:

        NAME                        STATE     READ WRITE CKSUM
        zpool_primary               ONLINE       0     0     0
          mirror-0                  ONLINE       0     0     0
            wwn-0x5000cca27ec5c30d  ONLINE       0     0     0
            wwn-0x5000cca252f6d327  ONLINE       0     0     0

errors: No known data errors

希望这能帮助其他人。我通过艰苦的方式学到了使用 dev/sdx 标识符构建 raid 和 fstab 等。不会再犯这个错误了。

相关内容