Replacing a disk with different geometry in DiskSuite

In this example, c0t1d0 failed and was replaced with a slightly larger disk with different geometry.

# format
c0t0d0          Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU  Product: MAB3091S SUN9.0G Revision: 2107 Serial No: 00D82262    
Size: 9.06GB <9055065600 bytes>

c0t1d0          Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST39102LC        Revision: 7C03 Serial No: LJA1448400001922
Size: 9.10GB <9102471168 bytes>

# prtvtoc /dev/rdsk/c0t0d0s2
* /dev/rdsk/c0t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     133 sectors/track
*      27 tracks/cylinder
*    3591 sectors/cylinder
*    4926 cylinders
*    4924 accessible cylinders

# prtvtoc /dev/rdsk/c0t1d0s2
* /dev/rdsk/c0t1d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     214 sectors/track
*      12 tracks/cylinder
*    2568 sectors/cylinder
*    6924 cylinders
*    6922 accessible cylinders

It is possible to change the geometry of the larger disk to match that of the smaller disk using the format command. An easy way to do this is to select the disk and then change the disk's type to that of the smaller disk.

# format
Searching for disks...done

AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /sbus@3,0/SUNW,fas@3,8800000/sd@0,0
       1. c0t1d0 <SEAGATE-ST39102LC-7C03 cyl 6922 alt 2 hd 12 sec 214>
          /sbus@3,0/SUNW,fas@3,8800000/sd@1,0

Specify disk (enter its number): 1
selecting c0t1d0
[disk formatted]

format> type
        18. SUN9.0G
        19. SEAGATE-ST39102LC-7C03
Specify disk type (enter its number)[19]: 18
selecting c0t1d0
[disk formatted]

The partition table of c0t1d0 (SEAGATE-ST39102LC-7C03) is now identical to c0t0d0 (SUN9.0G). Use the label command to write the new partition table to disk.

format> label
Ready to label disk, continue? y

The mirrors may now be resynchronized.

# metastat | grep 'Invoke: metareplace'
    Invoke: metareplace d0 c0t1d0s0 <new device>
    Invoke: metareplace d1 c0t1d0s1 <new device>
    Invoke: metareplace d3 c0t1d0s3 <new device>
    Invoke: metareplace d5 c0t1d0s5 <new device>

# metareplace -e d0 c0t1d0s0
d0: device c0t1d0s0 is enabled
# metareplace -e d1 c0t1d0s1
d1: device c0t1d0s1 is enabled
# metareplace -e d3 c0t1d0s3
d3: device c0t1d0s3 is enabled
# metareplace -e d5 c0t1d0s5
d5: device c0t1d0s5 is enabled

More information:
http://www.sunmanagers.org/pipermail/sunmanagers/2005-February/034842.html

Deprecated notes

In this example, c0t1d0 failed and was replaced with a disk with the same product identification, but different geometry.

# iostat -En
c0t0d0          Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST318203LC       Revision: 0002 Serial No: 
Size: 18.11GB <18110967808 bytes>
c0t1d0          Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST318203LC       Revision: 0002 Serial No: 
Size: 18.19GB <18190006272 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0

# prtvtoc /dev/rdsk/c0t0d0s2
* /dev/rdsk/c0t0d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     248 sectors/track
*      19 tracks/cylinder
*    4712 sectors/cylinder
*    7508 cylinders
*    7506 accessible cylinders

# prtvtoc /dev/rdsk/c0t1d0s2
* /dev/rdsk/c0t1d0s2 partition map
*
* Dimensions:
*     512 bytes/sector
*     303 sectors/track
*      12 tracks/cylinder
*    3636 sectors/cylinder
*    9772 cylinders
*    9770 accessible cylinders

It is possible to mirror data using Solaris Volume Manager/DiskSuite on disks with different geometry, provided the submirrors on the mirror disk are at least as large as the submirrors on the original disk.

Here is the partition table of the original disk:

partition> p
Current partition table (original):
Total disk cylinders available: 7506 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm     891 - 2226        3.00GB    (1336/0/0)  6295232
  1       swap    wu       0 -  890        2.00GB    (891/0/0)   4198392
  2     backup    wm       0 - 7505       16.86GB    (7506/0/0) 35368272
  3        var    wm    2227 - 2672        1.00GB    (446/0/0)   2101552
  4 unassigned    wm    2673 - 2674        4.60MB    (2/0/0)        9424
  5 unassigned    wm    2675 - 7490       10.82GB    (4816/0/0) 22692992
  6 unassigned    wm    7491 - 7505       34.51MB    (15/0/0)      70680
  7 unassigned    wu       0               0         (0/0/0)           0

First, I create a partition table on the mirror disk that slice sizes similar to those of the original disk.

partition> p
Current partition table (unnamed):
Total disk cylinders available: 9770 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0       root    wm    1160 - 2896        3.01GB    (1737/0/0)  6315732
  1       swap    wu       0 - 1159        2.01GB    (1160/0/0)  4217760
  2     backup    wu       0 - 9769       16.94GB    (9770/0/0) 35523720
  3        var    wm    2897 - 3479        1.01GB    (583/0/0)   2119788
  4 unassigned    wm    3480 - 3483        7.10MB    (4/0/0)       14544
  5 unassigned    wm    3484 - 9730       10.83GB    (6247/0/0) 22714092
  6 unassigned    wm    9731 - 9769       69.24MB    (39/0/0)     141804
  7 unassigned    wm       0               0         (0/0/0)           0

Next, I create state database replicas on the mirror disk.

# metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0t0d0s6
     a    p  luo        8208            8192            /dev/dsk/c0t0d0s6

# metadb -a -c 2 /dev/dsk/c0t1d0s6

# metadb
        flags           first blk       block count
     a m  p  luo        16              8192            /dev/dsk/c0t0d0s6
     a    p  luo        8208            8192            /dev/dsk/c0t0d0s6
     a        u         16              8192            /dev/dsk/c0t1d0s6
     a        u         8208            8192            /dev/dsk/c0t1d0s6

I then remove and clear the submirror in "Needs maintenance" state from each mirror, and recreate the submirrors on the mirror disk.

# metadetach -f d0 d20
d0: submirror d20 is detached
# metadetach -f d3 d23
d3: submirror d23 is detached
# metadetach -f d5 d25
d5: submirror d25 is detached

# metaclear d20
d20: Concat/Stripe is cleared
# metaclear d23
d23: Concat/Stripe is cleared
# metaclear d25
d25: Concat/Stripe is cleared

# metainit d20 1 1 c0t1d0s0
d20: Concat/Stripe is setup
# metainit d23 1 1 c0t1d0s3
d23: Concat/Stripe is setup
# metainit d25 1 1 c0t1d0s5
d25: Concat/Stripe is setup

The submirrors on the mirror disk are then attached.

# metattach d0 d20
d0: submirror d20 is attached
# metattach d3 d23
d3: submirror d23 is attached
# metattach d5 d25
d5: submirror d25 is attached

If the submirror on the mirror disk is not at least as large as the submirror on the original disk, you will receive an error.

# metattach d0 d20
metattach: hostname: d20: submirror too small to attach

# metastat d10
d10: Concat/Stripe
    Size: 6295232 blocks (3.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c0t0d0s0          0     No            Okay   Yes

# metastat d20
d20: Concat/Stripe
    Size: 6293916 blocks (3.0 GB)
    Stripe 0:
        Device     Start Block  Dbase   Reloc
        c0t1d0s0          0     No      Yes

More information:
http://www.sunmanagers.org/pipermail/summaries/2005-August/006676.html

Back to brandonhutchinson.com.
Last modified: 2007/05/17