Back to the main page

SVM - RAID 1 (Mirror) only for SPARC

Now we can have fully usage of RAID-0 volumes since they can be used as submirrors. By the way, the max number of submirrors is 4. 

Most people use 2 of them in two-way mirror. 

If you have three-way mirror, then you can take a submirror offline and perform backup (this submirror is read only). You still have redundancy as 2 others are online. 

Don't mix offline and detach actions. Offline-ing submirror is done for maintenance, detach-ing is done for (permanently) removing it.  

Basically, you start with creating one-way mirror (has only one submirror) and later attach second one. 

You can play around with RAID 0+1 (stripes that are mirrored) or 1+0 (mirrors that are striped)

Creating RAID-1 (from unused slices) - example

0. First you need state database replicas (create on 2 slices, total 6 replicas). 
# metadb -afc 3  c1t0d0s7 c1t1d0s7
# metadb
        flags           first blk       block count
     a        u    r    16              8192            /dev/dsk/c1t0d0s7
     a        u    r    8208            8192            /dev/dsk/c1t0d0s7
     a        u    r    16400           8192            /dev/dsk/c1t0d0s7
     a        u    r    16              8192            /dev/dsk/c1t1d0s7
     a        u    r    8208            8192            /dev/dsk/c1t1d0s7
     a        u    r    16400           8192            /dev/dsk/c1t1d0s7
1. Create two submirrors (stripes with one component):
# metainit d15 1 1 c1t0d0s5
# metainit d25 1 1 c1t1d0s5
2. Create one-way mirror (from one stripe)
# metainit d5 -m d15
3. Attach second submirror to the mirror
# metattach d5 d25
The resynchronization starts automatically. Note: Instead of steps 2 and 3, you could have created two-way mirror with: # metainit d5 -m d15 d25 But this DOES NOT start resynchronization automatically - trouble in the future! 4. Create new FS:
# newfs /dev/md/rdsk/d5
5. Add line in /etc/vfstab file (table of file system defaults) and mount FS, for example /myfs
/dev/md/dsk/d5 /dev/md/rdsk/d5 /myfs ufs 2 yes -
Check what you have now.
# metastat
d5: Mirror
    Submirror 0: d15
      State: Okay
     Submirror 1: d25
      State: Resyncing
    Resync in progress: 10 % done (resync-ing ...good!)
    Pass: 1 
    Read option: roundrobin (default)
    Write option: parallel (default)
    Size: 4195944 blocks (2.0 GB)

d15: Submirror of d5
    State: Okay
    Size: 4195944 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t0d0s5          0     No            Okay   No

d25: Submirror of d5
    State: Okay
    Size: 4195944 blocks (2.0 GB)
    Stripe 0:
        Device     Start Block  Dbase        State Reloc Hot Spare
        c1t1d0s5          0     No            Okay   No
SVM has different read/write policies for RAID-1. You can see default values above in red. Read more about other options in Sun doc 816-4520-12 on page 100. Pass number (0-9) shows resynchronized order for submirrors during boot time. Lower number resynchronized first. Zero means skipping resynchronization (use for read only mounted mirror). Example of changing these parameter values:
# metaparam -w serial -r geometric -p 4 d5
See what you have after change:
# metaparam d5
d5: Mirror current parameters are:
    Pass: 4
    Read option: geometric (-g)
    Write option: serial (-S)

# metastat
d5: Mirror
    Submirror 0: d15
      State: Okay
    Submirror 1: d25
      State: Okay
    Pass: 4
    Read option: geometric (-g)
    Write option: serial (-S)
Creating RAID-1 (from unused FS) - example No reboot is required if FS can be unmounted, otherwise if you deal with /, /usr, /swap - yes you need to reboot. For root FS you also need additional exercise like allowing boot from that FS and booting from second mirrored disk, but let's put stuff in the table.
Action \ FS typeFS can be unmounted - /myfsFS cannot be unmounted - /usrroot FS (/)
Creating 2 submirrors # metainit -f d14 1 1 c1t0d0s4
(-f = force it, since FS is mounted on this slice)

# metainit d24 1 1 c1t1d0s4
# metainit -f d13 1 1 c1t0d0s3
(-f = force it, since FS is mounted on this slice)

# metainit d23 1 1 c1t1d0s3
# metainit -f d10 1 1 c1t0d0s0
(-f = force it, since FS is mounted on this slice)

# metainit d20 1 1 c1t1d0s0
Creating one-way mirror # metainit d4 -m d14 # metainit d3 -m d13# metainit d0 -m d10
Unmount FS # umount /myfs Do nothing, since you cannot unmount Do nothing, since you cannot unmount
Edit /etc/vfstab - FS points to mirror Have this line:

/dev/md/dsk/d4 /dev/md/rdsk/d4 /myfs ufs 2 yes -
Have this line:

/dev/md/dsk/d3 /dev/md/rdsk/d3 /usr ufs 1 yes -
# metaroot d0
(This edits the /etc/vfstab and /etc/system files)

This line shows in /etc/vfstab
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 no -

This lines shows in /etc/system file
* Begin MDD root info (do not edit)
rootdev:/pseudo/md@0:0,0,blk
* End MDD root info (do not edit)

Mount FS # mount /myfs n/a n/a
Reboot no need to reboot here Reboot Reboot
Attach second submirror # metattach d4 d24
(resync starts)
# metattach d3 d23
(resync starts)
# metattach d0 d20
(resync starts)
Install bootblock on second slice n/a n/a # installboot /usr/platform/SUNW,UltraAX-i2/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0
(use uname -i to find directory SUNW,UltraAX-i2 )
Setup alternate boot path n/a n/a
Let's find path of alternate root device - slice we attached to one-way mirror

# ls -l /dev/dsk/c1t1d0s0
/dev/dsk/c1t1d0s0 -> ../../devices/pci@1f,0/pci@1/scsi@8/sd@1,0:a

Write down physical path (see what is after /devices directory) /pci@1f,0/pci@1/scsi@8/sd@1,0:a

Replace sd with disk, now you have: /pci@1f,0/pci@1/scsi@8/disk@1,0:a

Go to OpenBoot PROM with init 0

Define alias for mirror boot disk. Alias points to physical path. 
ok devalias mirrdisk /pci@1f,0/pci@1/scsi@8/disk@1,0:a 

Define order of boot devices 

ok setenv boot-device disk mirrdisk 
boot-device =         disk mirrdisk

Check if everything okay? 
ok printenv

Copy content of temp buffer to NVRAMRC and discard content of temp buffer. 
You have to do this since defining alias with devalias is NOT persistent across reboot.  
ok nvstore

Reset OpenBoot PROM to verify that the new info has been saved. 
ok reset ( or reset-all )

If instead of devalias, the nvalias has been used, then the alias will be persistent over reboot.  

Just make sure that use-nvramrc is true.
ok setenv use-nvramrc? true
use-nvramrc? =        true

ok nvalias mirrdisk /pci@1f,0/pci@1/scsi@8/disk@1,0:a
Creating RAID-1 (from /swap ) 1. Create two submirrors (stripes with one component):
# metainit d11 1 1 c1t0d0s1
# metainit d21 1 1 c1t1d0s1
2. Create one-way mirror (from one stripe)
# metainit d1 -m d11
3. Edit "swap" line in /etc/vfstab file
/dev/md/dsk/d1 - - swap - no -
4. Reboot 5. Attach second submirror to the mirror
# metattach d1 d21
6. Your dump device is still /dev/dsk/c1t0d0s1. Change it to the metadevice.
# dumpadm -d swap
Dump content: kernel pages
Dump device: /dev/md/dsk/d1 (swap)
Postscript: Before creating state database replicas, you may need to copy VTOC from current to mirror disk.
# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
prtvtoc - shows disk geometry and partitioning fmthard - create label on hard disks
Back to the main page