Disk Mirroring in Solaris
Disk mirroring in Solaris
Install the OS in one hard disk, and put the second one before turning on the Server.
Now go to the root and type format, it will list you the hard disk Number.
(i.e) c2t0d0 (Primary hard disk – with partition info) and c2t1d0 (secondary disk)
Normally the entire hard disk will be denoted as c2t0d0s2 ( S2 indicates the entire slice)
To transfer the partition information from primary hard disk to Secondary
#prtvtoc /dev/rdsk/c2t0d0s2 | fmthard –s - /dev/rdsk/c2t1dos2
prtvtoc is used to report information about a disk geometry and partitioning
It is used to copy the partition information from one hard disk to another hard disk.
Now we should to use metadb to transfer information’s.
ie) metadb is used to create and delete replicas of the meta device state database
# metadb –afc3 c2t0d0s2 c2t1d0s2
This shows how to add two replicas on two new disks that have been connected to a system currently running Disk Suite.
c2t0d0s2
In general the slice S2 denotes the whole disk space of the hard disk.
To know the status of the replicas, enter the command
# metadb -i
Now we have to configure meta devices.
# metainit –f d10 1 1 c2t0d0s0
# metainit –f d20 1 1 c2t1d0s0
The above example shows the concat / stripe option. ie ) the number 1 after d10 indicates the stripes in the concatenation and the number before the disk c2t0d0s0 indicates the the stripe is made up of single slice.
So the two sub mirrors, d10 and d20 are created with metainit command with simple concatenation. This has to be made in to a single mirror by using option –m.
# metainit d0 –m d10 < -m indicates the single mirror>
Like this we have to create mirror for all slices. While creating the meta devices be careful that you should not use the slice (s2) because it indicates the whole disk
(backup in the below example).
Example:
VTOC – volume table of contents in sparc
Disk is divided into 8 slices, numbered 0-7 in SPARC
VTOC - volume table of contents in sparc
The fdisk partition is divided into 10 slices, numbered 0-9.
# format
Searching for disks…done
AVAILABLE DISK SELECTIONS:
1. c2t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@0,0
2. c2t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
/pci@1c,600000/scsi@2/sd@1,0
Specify disk (enter its number): 1
selecting c2t0d0
[disk formatted]
partition> p
Current partition table (original):
Total disk cylinders available: 2036 + 2 (reserved cylinders)
===============================================================================
Part Tag Flag Cylinders Size Blocks
0 root wm 0 - 101 50.20MB (102/0/0) 102816
1 swap wu 102 - 305 100.41MB (204/0/0) 205632
2 backup wm 0 - 2035 1002.09MB (2036/0/0) 2052288
3 usr wm 306 - 1829 750.09MB (1524/0/0) 1536192
4 var wm 1830 - 2033 100.41MB (204/0/0) 205632
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
================================================================================
The second submirror is attached later using the metattach command
# metaattach d0 d20
List of things to do are
#metainit –f d10 1 1 c2t0d0s0 (creating the mirror 1 in first hard disk)
#metainit –f d20 1 1 c2t0d0s0 (creating the mirror 2 in second hard disk)
#metainit d0 –m d10 (one way mirror is created)
#metaattach d0 d20 (sub mirror d20 is attached to d0)
Like this we have to create for all slices
#metainit –f d11 1 1 c2t0d0s1 (creating the mirror 1 in first hard disk)
#metainit –f d21 1 1 c2t1d0s1 (creating the mirror 2 in second hard disk)
#metainit d1 –m d11 (one way mirror is created)
#metaattach d1 d21 (sub mirror d21 is attached to d1)
#metainit –f d12 1 1 c2t0d0s3 (creating the mirror 1 in first hard disk)
#metainit –f d22 1 1 c2t1d0s3 (creating the mirror 2 in second hard disk)
#metainit d2 –m d12 (one way mirror is created)
#metaattach d2 d22 (sub mirror d22 is attached to d2)
#metainit –f d13 1 1 c2t0d0s4 (creating the mirror 1 in first hard disk)
#metainit –f d23 1 1 c2t1d0s4 (creating the mirror 2 in second hard disk)
#metainit d3 –m d13 (one way mirror is created)
#metaattach d3 d23 (sub mirror d23 is attached to d3)
#metainit –f d14 1 1 c2t0d0s5 (creating the mirror 1 in first hard disk)
#metainit –f d24 1 1 c2t1d0s5 (creating the mirror 2 in second hard disk)
#metainit d4 –m d14 (one way mirror is created)
#metaattach d4 d24 (sub mirror d24 is attached to d4)
#metainit –f d15 1 1 c2t0d0s6 (creating the mirror 1 in first hard disk)
#metainit –f d25 1 1 c2t1d0s6 (creating the mirror 2 in second hard disk)
#metainit d5 –m d15 (one way mirror is created)
#metaattach d5 d25 (sub mirror d25 is attached to d5)
This can be verified by
#metastat –i | grep %
d5: Mirror
Submirror 0: d15
State: Okay
Submirror 1: d25
State: Resyncing
Resync in progress: 15 % done
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 2006130 blocks
Now we can use the metastat command to display the status of the meta device
Use metstat –p to display th elist of active metadevices.
# metastat –p
d5 -m d15 d25 1
d15 1 1 c2t0d0s6
d25 1 1 c2t1d0s6
d4 -m d14 d24 1
d14 1 1 c2t0d0s5
d24 1 1 c2t1d0s5
d3 -m d13 d23 1
d13 1 1 c2t0d0s4
d23 1 1 c2t1d0s4
d2 -m d12 d22 1
d12 1 1 c2t0d0s3
d22 1 1 c2t1d0s3
d1 -m d11 d21 1
d11 1 1 c2t0d0s1
d21 1 1 c2t1d0s1
d0 -m d10 d20 1
d10 1 1 c2t0d0s0
d20 1 1 c2t1d0s0
Then we should specify that the root file system is in metadevice d0, this edits both the /etc/system and /etc/vfstab.
# metaroot d0
Then we should specify that the file system was modified
# lockfs –a ( Apply command to all mounted file system.)
Then reboot the system and check the /etc/vfstab.

Thanks for the above
i think now i can go ahead with mirroring.
hi misile indeed gud post regarding mirror configuration..its very useful.Thanks!
Hi,
I want to upgrade my solaris 8 box to solaris10.
Please update me what are the minimum number of H/W required like HDD/Processor,Processor Type.
Can I perform it on single HDD?
Please provide me the complete step by step checklist for the same.
Thanks ins advance