Solaris 10 - Create software RAID 1

I worked on Unix many years ago, however, Solaris, AIX and HP-Unix are the platforms I often did with. I'm DBA, but there are not any System Administrator in my company, and I .. do the System's business at all.

Before ZFS becomes popular, UFS was always the best choice for Solaris, especially in M's series, example: Sun M-3000, M-4000, M-5000 ...etc. The M series does not support Hardware Raid, but only software, and this article do the brief of creating the software raid in. It's one of task list before configuration and installation Oracle in Solaris 10.

1- Duplicate the layout from the first harddrive to the 2nd harddrive
a. Define the disks

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

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    14      132.10MB    (15/0/0)        270540
  1       swap    wu      15 -    29      132.10MB    (15/0/0)        270540
  2     backup    wu       0 - 64985      558.89GB    (64986/0/0) 1172087496
  3        usr    wm      30 - 29098      250.00GB    (29069/0/0)  524288484
  4        usr    wm   29099 - 60493      270.00GB    (31395/0/0)  566240220
  5 unassigned    wu       0                0         (0/0/0)              0
  6 unassigned    wu       0                0         (0/0/0)              0
  7 unassigned    wm   60496 - 60507      105.68MB    (12/0/0)        216432

b. Duplicate the layout

# prtvtoc /dev/rdsk/c0t5000CCA03C6563D0d0s2 | fmthard -s - /dev/rdsk/c0t5000CCA03C574254d0s2
fmthard:  New volume table of contents now in place.

c. Note: In which disks, the slice 2 is the whole disk using name backup (VTOC_BACKUP)

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

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    14      132.10MB    (15/0/0)        270540
  1       swap    wu      15 -    29      132.10MB    (15/0/0)        270540
  2     backup    wu       0 - 64985      558.89GB    (64986/0/0) 1172087496
  3        usr    wm      30 - 29098      250.00GB    (29069/0/0)  524288484
  4        usr    wm   29099 - 60493      270.00GB    (31395/0/0)  566240220
  5 unassigned    wu       0                0         (0/0/0)              0
  6 unassigned    wu       0                0         (0/0/0)              0
  7 unassigned    wm   60496 - 60507      105.68MB    (12/0/0)          216432

Note: Do not device remain disk, using format 1 disk, copy the layout to disk 2

2- Create a slice to contain the metadb

7 unassigned    wm   60496 - 60507      105.68MB    (12/0/0)          216432

Note:
- The slice 7 is contains metadb, slice 3 & 4 is used for file system

3- Create the metadb

# metadb -af -c 2 /dev/rdsk/c0t5000CCA03C6563D0d0s7 /dev/rdsk/c0t5000CCA03C574254d0s7
# metadb
        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t5000CCA03C6563D0d0s7
     a        u         8208            8192            /dev/dsk/c0t5000CCA03C6563D0d0s7
     a        u         16              8192            /dev/dsk/c0t5000CCA03C574254d0s7
                    a        u         8208            8192            /dev/dsk/c0t5000CCA03C574254d0s7

4- Initialize the RAID device

# metainit -f d10 1 1 /dev/dsk/c0t5000CCA03C6563D0d0s0
d10: Concat/Stripe is setup
# metainit -f d20 1 1 /dev/dsk/c0t5000CCA03C574254d0s0
d20: Concat/Stripe is setup
# metainit d0 -m d10
d0: Mirror is setup
# metainit -f d11 1 1 /dev/dsk/c0t5000CCA03C6563D0d0s1
d11: Concat/Stripe is setup
# metainit -f d21 1 1 /dev/dsk/c0t5000CCA03C574254d0s1
d21: Concat/Stripe is setup
# metainit d1 -m d11
              d1: Mirror is setup
# metainit d13 1 1 /dev/dsk/c0t5000CCA03C6563D0d0s3
d13: Concat/Stripe is setup
# metainit d23 1 1 /dev/dsk/c0t5000CCA03C574254d0s3
       d23: Concat/Stripe is setup
       # metainit d3 -m d13
       # metainit d14 1 1 /dev/dsk/c0t5000CCA03C6563D0d0s4
       d14: Concat/Stripe is setup
       # metainit d24 1 1 /dev/dsk/c0t5000CCA03C574254d0s4
# metainit d4 -m d14 
d4: Mirror is setup

5- Attach the primary disk devices to RAID devices

# lockfs -fa
       # init 6
# metattach  d0 d20
d0: submirror d20 is attached
#metattach  d1 d21
d1: submirror d21 is attached
#metattach  d3 d23
d3: submirror d23 is attached
#metattach  d4 d24
d4: submirror d24 is attached

6- Verify

# metastat d20
d20: Concat/Stripe
    Size: 270540 blocks (132 MB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc Hot Spare
        /dev/dsk/c0t5000CCA03C574254d0s0          0     No            Okay   Yes 

Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c0t5000CCA03C574254d0   Yes    id1,sd@n5000cca03c574254
# metastat d21
d21: Concat/Stripe
    Size: 270540 blocks (132 MB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc Hot Spare
        /dev/dsk/c0t5000CCA03C574254d0s1          0     No            Okay   Yes 

Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c0t5000CCA03C574254d0   Yes    id1,sd@n5000cca03c574254
# metastat d23
d23: Concat/Stripe
    Size: 524288484 blocks (250 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc Hot Spare
        /dev/dsk/c0t5000CCA03C574254d0s3          0     No            Okay   Yes 

Device Relocation Information:
Device                           Reloc  Device ID
/dev/dsk/c0t5000CCA03C574254d0   Yes    id1,sd@n5000cca03c574254
# metastat d24
d24: Concat/Stripe
    Size: 566240220 blocks (270 GB)
    Stripe 0:
        Device                             Start Block  Dbase        State Reloc Hot Spare
        /dev/dsk/c0t5000CCA03C574254d0s4          0     No            Okay   Yes 

Device Relocation Information:
Device                           Reloc  Device ID
      /dev/dsk/c0t5000CCA03C574254d0   Yes    id1,sd@n5000cca03c574254

7- Format and mount the new file system (/u01)

# newfs -i 8192 /dev/md/rdsk/d3
newfs: /dev/md/rdsk/d3 last mounted as /u01
newfs: construct a new file system /dev/md/rdsk/d3: (y/n)? y
Warning: 3612 sector(s) in last cylinder unallocated
/dev/md/rdsk/d3:        524288484 sectors in 85334 cylinders of 48 tracks, 128 sectors
        256000.2MB in 5334 cyl groups (16 c/g, 48.00MB/g, 5824 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920,
Initializing cylinder groups:
...............................................................................
...........................
super-block backups for last 10 cylinder groups at:
 523372064, 523470496, 523568928, 523667360, 523765792, 523864224, 523962656,
       524061088, 524159520, 524257952
       # cat /etc/vfstab 
       #device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
#
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s1        -       -       swap    -       no      -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s0        /dev/rdsk/c1t3FE5F2A4BF195FB2d0s0       /       ufs     1       no      -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s3        /dev/rdsk/c1t3FE5F2A4BF195FB2d0s3       /usr    ufs     1       no      -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s2        /dev/rdsk/c1t3FE5F2A4BF195FB2d0s2       /var    ufs     1       no      -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s5        /dev/rdsk/c1t3FE5F2A4BF195FB2d0s5       /bh     ufs     2       yes     -
/dev/dsk/c1t3FE5F2A4BF195FB2d0s4        /dev/rdsk/c1t3FE5F2A4BF195FB2d0s4       /bhapp  ufs     2       yes     -
/dev/md/dsk/d3                          /dev/md/rdsk/d3                         /u01    ufs     2       yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
       swap    -       /tmp    tmpfs   -       yes     -

8- Guideline:
a. This document is used to make a metadb and mirror without root, swap slice. The disks contain the root, swap but they are not usable. The real is in another disks
b. The mirror creation is 1-1 but not resynchronization
c. In step 7, using “newfs –i 8192 /dev/md/rdsk/d3” only enough demonstration, the others can be configured same.
d. In Solaris 10, not necessary to create RAID 0+1 or RAID 1+0 which must be configure in Solaris 9. In Solaris 9, a whole RAID 0 contains 2 disk must be configure, then, RAID 1 mirroring slice by slice inside.

In my attached file, there is demonstration by image.
Hope this help
TAT