1 votes

Comment restaurer un disque dégradé dans un zpool ?

J'ai eu un problème avec mon zpool - le dev id a changé et l'un des disques est apparu comme dégradé.

J'ai exporté le pool et l'ai réimporté en utilisant cette commande :

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

L'état apparaît maintenant comme suit :

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

Affichage de la liste des identifiants de disques :

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

Quel est le moyen le plus simple de "réparer" le disque hors ligne ? Il était précédemment dégradé et je l'ai mis hors ligne pour effectuer l'exportation, etc.

Puis-je le faire en répétant le processus d'exportation/importation ? Lors de la nouvelle importation, il n'était pas clair si je devais spécifier l'identifiant de chaque lecteur à inclure. Si c'est le cas, à quoi ressemblerait la commande ? Je suppose que l'identifiant que je veux utiliser est wwn-0x5000cca252f6d327 (c'est-à-dire sans le 'part1' à la fin).

Sinon, dois-je "remplacer" le disque dans le zpool et le resilver ?

1voto

千里ちゃん Points 353

Je l'ai corrigé en expérimentant (puisque l'exportation et l'importation sont non-destructives).

En regardant blkid, j'ai pu voir que les deux disques avaient le même 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"

J'ai donc importé le lecteur en utilisant l'UUID (et en validant l'importation avec 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

La piscine était opérationnelle, mais avec des identifiants inhabituels :

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

Je l'ai ensuite exporté à nouveau, et enfin réimporté en utilisant 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

J'espère que cela aidera quelqu'un d'autre. J'ai appris à la dure comment construire des raids et des fstab etc. avec des identifiants dev/sdx. Je ne referai pas cette erreur.

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X