zpool replace

Dieser Artikel ist im Juni 2018 erschienen


Wird benötigt, um defekte Platten in einem zpool gegen intakte auszutauschen. Normalerweise hätte man natürlich keinen RAID-Controller im Einsatz - gehört aber zur Standardausstattung der Server, die wir für Linux einsetzen. Deshalb muß man entsprechend damit leben, wenn man SmartOS dort installiert. Im ersten Schritt muss man mit "format -e" herausfinden, was überhaupt für Platten verbaut sind (und ob die neue Platte richtig konfiguriert ist). So sollte eine "gesunde" Konfiguration aussehen:

[root@hh24-gts2-de35 (de-gt-2) ~]# format -e
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <LSI-RAID 5/6 SAS 6G-2.13-278.88GB>
          /pci@0,0/pci8086,e02@1/pci1734,1176@0/sd@0,0
       1. c1t1d0 <LSI-RAID 5/6 SAS 6G-2.13-278.88GB>
          /pci@0,0/pci8086,e02@1/pci1734,1176@0/sd@1,0
       2. c1t2d0 <LSI-RAID 5/6 SAS 6G-2.13-278.88GB>
          /pci@0,0/pci8086,e02@1/pci1734,1176@0/sd@2,0
       3. c1t3d0 <LSI-RAID 5/6 SAS 6G-2.13-278.88GB>
          /pci@0,0/pci8086,e02@1/pci1734,1176@0/sd@3,0
       4. c1t4d0 <LSI-RAID 5/6 SAS 6G-2.13-278.88GB>
          /pci@0,0/pci8086,e02@1/pci1734,1176@0/sd@4,0
Specify disk (enter its number):

Ist das nicht der Fall (fehlt z. B. die neue Platte), dann wird man nicht darum herum kommen, die Maschine zu booten (wenn man nicht storcli für Solaris heruntergeladen und installiert hat) und die Platte mit storcli mit dem RAID-Controller zu verheiraten. Zeigt die neue Platte eine "seltsame" Geometrie, muß sie ggfs. mit "fdisk", "label" oder "partition" weiterbehandelt werden.

Fehlt die neue Platte in der Übersicht, muss zunächst mit storcli sichergestellt werden, dass die Platte als virtuelles RAID-0 Device für den RAID-Controller verfügbar ist. Zur Not muß auf der neuen Platte z. B. mit

storcli /c0 add vd type=r0 drives=252:0

ein neues, virtuelles RAID-0 Device angelegt werden. Die Platte sollte danach den Status "Online" haben. Wieder unter SmartOS gebootet, sollte der Output von "fdisk" ungefähr so aussehen:

             Total disk size is 36404 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 EFI               0  36404    36405    100


SELECT ONE OF THE FOLLOWING:
   1. Create a partition
   2. Specify the active partition
   3. Delete a partition
   4. Change between Solaris and Solaris2 Partition IDs
   5. Edit/View extended partitions
   6. Exit (update disk configuration and exit)
   7. Cancel (exit without updating disk configuration)

Die Ausgabe von "partition" sieht dann etwa so aus:

partition> print                                 
Current partition table (original):              
Total disk sectors available: 584826813 + 16384 (reserved sectors)

Part      Tag    Flag     First Sector         Size         Last Sector
  0        usr    wm                34      278.87GB          584826846    
  1 unassigned    wm                 0           0               0    
  2 unassigned    wm                 0           0               0    
  3 unassigned    wm                 0           0               0    
  4 unassigned    wm                 0           0               0    
  5 unassigned    wm                 0           0               0    
  6 unassigned    wm                 0           0               0    
  7 unassigned    wm                 0           0               0    
  8   reserved    wm         584826847        8.00MB          584843230

Steht die Platte zur Verfügung kann man sie dann mit

[root@hh24-gts2-de35 (de-gt-2) ~]# zpool replace zones 9675023404691582778 c1t0d0s0

in den Pool übernehmen. "zpool status" wird dann etwa Folgendes ausgeben:

[root@hh24-gts2-de35 (de-gt-2) ~]# zpool status
  pool: zones                                   
 state: DEGRADED
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Wed Jun 27 10:59:14 2018
        15.5M scanned out of 336G at 3.11M/s, 30h44m to go
    2.66M resilvered, 0.00% done
config:                                         

        NAME                       STATE     READ WRITE CKSUM
        zones                      DEGRADED     0     0     0
          raidz2-0                 DEGRADED     0     0     0
            replacing-0            DEGRADED     0     0     0
              9675023404691582778  FAULTED      0     0     0  was /dev/dsk/c1t0d0s0/old
              c1t0d0s0             ONLINE       0     0     0
            c1t1d0                 ONLINE       0     0     0
            c1t2d0                 ONLINE       0     0     0
            c1t3d0                 ONLINE       0     0     0
            c1t4d0                 ONLINE       0     0     0

Ist der Resilvering-Prozess abgeschlossen, sollte "zpool status" wieder so aussehen:

[root@hh24-gts2-de35 (de-gt-2) ~]# zpool status
  pool: zones                                   
 state: ONLINE                                  
  scan: resilvered 66.8G in 1h2m with 0 errors on Wed Jun 27 12:04:03 2018
config:                                         

        NAME          STATE     READ WRITE CKSUM
        zones         ONLINE       0     0     0
          raidz2-0    ONLINE       0     0     0
            c1t0d0s0  ONLINE       0     0     0
            c1t1d0    ONLINE       0     0     0
            c1t2d0    ONLINE       0     0     0
            c1t3d0    ONLINE       0     0     0
            c1t4d0    ONLINE       0     0     0

errors: No known data errors