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 |
# metainit d15 1 1 c1t0d0s5 # metainit d25 1 1 c1t1d0s5 |
# metainit d5 -m d15 |
# metattach d5 d25 |
# newfs /dev/md/rdsk/d5 |
/dev/md/dsk/d5 /dev/md/rdsk/d5 /myfs ufs 2 yes - |
# 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 |
# metaparam -w serial -r geometric -p 4 d5 |
# 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) |
Action \ FS type | FS can be unmounted - /myfs | FS cannot be unmounted - /usr | root 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 |
# metainit d11 1 1 c1t0d0s1 # metainit d21 1 1 c1t1d0s1 |
# metainit d1 -m d11 |
/dev/md/dsk/d1 - - swap - no - |
# metattach d1 d21 |
# dumpadm -d swap Dump content: kernel pages Dump device: /dev/md/dsk/d1 (swap) |
# prtvtoc /dev/rdsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2 |