OpenIndiana: EFI-Label entfernen

Ich wollte heute dem rpool auf einem OpenIndiana-System (151a3) eine weitere Festplatte hinzufügen um einen mirror draus zu machen. Die Festplatte war bereits vorher in einem Raid-Z-Verbund im Einsatz gewesen und hierdurch bereits mit einem EFI-Label versehen:

# fdisk /dev/rdsk/c4d0p0
Total disk size is 60800 cylinders
 Cylinder size is 16065 (512 byte) blocks
Cylinders
 Partition Status Type         Start End Length %
 ========= ====== ============ ===== === ====== ===
     1             EFI            0 60800 60801 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)
Enter Selection:

Der erste Fehler den ich gemacht habe, war das ganze Device (z. B. c4d0) hinzufügen zu wollen: Ein root pool muss auf einer Disk mit slices (also z. B. c4d0s0) installiert werden anstatt auf einer ganzen Festplatte (siehe hier):

# zpool attach rpool c5d0 c4d0
cannot label 'c4d0': EFI labeled devices are not supported on root pools.

Der slice c4d0s0 existiert nicht und muss erzeugt werden. Ausserdem kann man Solaris nicht von EFI-Partionen booten, so dass zuvor eine Solaris2-Partition auf der Festplatte erzeugt werden muss:

# fdisk -B /dev/rdsk/c4d0p0

Im nächsten Schritt wird der benötigte slice erzeugt. Zur besseren Übersicht habe ich nach jeder Eingabe einen neuen Code-Block angefangen:

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c4d0
          /pci@0,0/pci-ide@a/ide@0/cmdk@0,0
       1. c5d0
          /pci@0,0/pci-ide@a/ide@1/cmdk@0,0
Specify disk (enter its number): 0
selecting c4d0
Controller working list found
[disk formatted, defect list 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
        !     - execute , then return
        quit
format> p
PARTITION MENU:
        0      - change `0' partition
        1      - change `1' partition
        2      - change `2' partition
        3      - change `3' partition
        4      - change `4' partition
        5      - change `5' partition
        6      - change `6' partition
        7      - change `7' partition
        select - select a predefined table
        modify - modify a predefined partition table
        name   - name the current table
        print  - display the current table
        label  - write partition map and label to the disk
        ! - execute , then return
        quit
partition> modify
Select partitioning base:
        0. Current partition table (original)
        1. All Free Hog
Choose base (enter number) [0]? 1
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0                0         (0/0/0)             0
  1       swap    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 60796      465.73GB    (60797/0/0) 976703805
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 alternates    wm       1 -     2       15.69MB    (2/0/0)         32130

Do you wish to continue creating a new partition
table based on above table[yes]?
Free Hog partition[6]? 0

Die nächsten sechs Eingaben einfach mit (sechs mal) Enter bestätigen.

Enter size of partition '1' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '3' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '4' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '5' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '6' [0b, 0c, 0.00mb, 0.00gb]:
Enter size of partition '7' [0b, 0c, 0.00mb, 0.00gb]:
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       3 - 60796      465.71GB    (60794/0/0) 976655610
  1       swap    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 60796      465.73GB    (60797/0/0) 976703805
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
  8       boot    wu       0 -     0        7.84MB    (1/0/0)         16065
  9 alternates    wm       1 -     2       15.69MB    (2/0/0)         32130

Okay to make this the current partition table[yes]?
Enter table name (remember quotes): "disk0"
Ready to label disk, continue? yes
partition> q
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
        !     - execute , then return
        quit
format> q

Jetzt kann man das zweite Device zum rpool hinzufügen:

# zpool attach -f rpool c5d0s0 c4d0s0
Make sure to wait until resilver is done before rebooting.

Mit zpool status kann man sich den Fortschritt des Resilver-Prozesses anschauen:

# zpool status
  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.
  scan: resilver in progress since Thu Apr 26 11:00:36 2012
    6.14G scanned out of 146G at 42.7M/s, 0h55m to go
    6.13G resilvered, 4.20% done
config:

        NAME        STATE     READ WRITE CKSUM
        rpool       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            c5d0s0  ONLINE       0     0     0
            c4d0s0  ONLINE       0     0     0  (resilvering)

errors: No known data errors

Nun noch Grub installieren, damit die zweite Platte im Ernstfall auch bootfähig ist:

# installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c4d0s0
stage2 written to partition 0, 275 sectors starting at 50 (abs 16115)
stage1 written to partition 0 sector 0 (abs 16065)