Hetzner - DokuWiki

OpenSolaris RAID einrichten

Um die Ausfallsicherheit Ihrer Daten zu erhöhen, können Sie die Daten Ihres ZPools automatisch auf die zweite Festplatte (sofern vorhanden) spiegeln. Gehen Sie dabei wie folgt vor:

Lassen Sie sich zunächst anzeigen, welche der Festplatten in Ihrem ZPool bereits vorhanden ist:

$ zpool status
  pool: rpool
 state: ONLINE
 scrub: none requested
config:
        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          c7d0s0    ONLINE       0     0     0

errors: No known data errors

Mit dem Befehl "format" können Sie nun auf der zweiten Platte eine Solaris-Partition erstellen. Wählen Sie hierzu die zweite Festplatte aus, geben Sie anschließend im Menü den Befehl "fdisk" ein und bestätigen Sie das Erstellen der Solaris-Partition (Benutzereingaben sind unterstrichen):

$ pfexec format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c7d0 <DEFAULT cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c7d1 <DEFAULT cyl 2086 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@1,0
Specify disk (enter its number): 1
selecting c7d1
Controller working list found
[disk formatted, defect list found]
No Solaris fdisk partition found.


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        fdisk      - run the fdisk program
        repair     - repair a defective sector
        show       - translate a disk address
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> fdisk
No fdisk table exists. The default partition for the disk is:

  a 100% "SOLARIS System" partition

Type "y" to accept the default partition,  otherwise type "n" to edit the
 partition table.
y
format> quit

Anschließend können Sie das Solaris-Label auf die zweite Festplatte kopieren:

$ pfexec prtvtoc /dev/rdsk/c7d0s2 | pfexec fmthard -s - /dev/rdsk/c7d1s2
fmthard:  New volume table of contents now in place.

/dev/rdsk/c7d0s2 ist hierbei die erste Festplatte (s2 referenziert die vollständige Festplatte), während /dev/rdsk/c7d1s2 auf die zweite Festplatte verweist. Die Namen können sich hierbei je nach Servertyp unterscheiden.

Fügen Sie nun die zweite Festplatte in Ihren ZPool ein:

$ pfexec zpool attach -f rpool c7d0s0 c7d1s0
Please be sure to invoke installgrub(1M) to make 'c7d1s0' bootable.

Der ZPool sollte innerhalb weniger Minuten vollständig resilvered sein. Den jeweiligen Status können Sie mit "zpool status" beobachten:

$ zpool status rpool
  pool: rpool
 state: ONLINE
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.
 scrub: resilver in progress for 0h0m, 13.87% done, 0h3m to go
config:
        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror    ONLINE       0     0     0
            c7d0s0  ONLINE       0     0     0
            c7d1s0  ONLINE       0     0     0  516M resilvered

errors: No known data errors

Damit Sie im Bedarfsfall auch von der zweiten Festplatte booten können, müssen Sie noch wie folgt GRUB installieren:

$ pfexec installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c7d1s0
Updating master boot sector destroys existing boot managers (if any).
continue (y/n)?<u>'''y'''</u>
stage1 written to partition 0 sector 0 (abs 16065)
stage2 written to partition 0, 271 sectors starting at 50 (abs 16115)
stage1 written to master boot sector


© 2012. Hetzner Online AG. Alle Rechte vorbehalten.