How to mirror the disk in Solaris
1) Making both drives the same.
We start with slicing the second drive in the same way as our first drive, the master. # prtvtoc /dev/rdsk/c1t0d0s2 fmthard -s - /dev/rdsk/c1t1d0s2 No need to newfs the second drive slices here, that will automaticaly done by the mirror syncing later
2 ) Metadbs
We can now setup our metadbs. # metadb -a -f –c2 c1t0d0s6 c1t1d0s6 Since its the initial creation of the metadbs, we need to force it with -f -a adds the metadbs, and -c tells it how many to create. You can see the results with metadb -i. metadb -i is a very handy tool to determine the state of your metadb states.
3) Initializing the devices
Now we go to setup the initial metadevices. # metainit -f d0 1 1 c1t0d0s0 / # metainit -f d11 1 1 c1t0d0s1 /swap # metainit -f d31 1 1 c1t0d0s3 /tmp # metainit -f d71 1 1 c1t0d0s7 /apps
# metainit -f d1 1 1 c1t1d0s0 / # metainit -f d12 1 1 c1t1d0s1 /swap # metainit -f d32 1 1 c1t1d0s3 /tmp # metainit -f d72 1 1 c1t1d0s7 /apps Like metadb metainit must be forced with -f, but this time not because its the initial creation, but because we work on mounted filesystems. So, here we create a 1 way concatenation of our actual slices and form the needed submirrors.
4) Mirroring fun part 1!
# metainit d2 -m d0 / # metainit d13 -m d11 /swap # metainit d33 -m d31 /tmp # metainit d73 -m d71 /apps
Here are the actualy mirroing intialized, the -m tells SDS that we want to build a mirror with the name in the first colum and consiting of the submirror in the third colum. We now have a one way mirror of our system drive, but its not active yet.
5) Setting the root device
# cp /etc/vfstab /etc/vfstab_pre_sds # cp /etc/system /etc/system_pre_sds # metaroot d2 6) Setting up /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 - # # sds drives # /dev/md/dsk/d13 - - swap - no - /dev/md/dsk/d2 /dev/md/rdsk/d2 / ufs 1 no logging /dev/md/dsk/d33 /dev/md/rdsk/d33 /tmp ufs 1 no logging,noatime /dev/md/dsk/d73 /dev/md/rdsk/d73 /apps ufs 2 yes logging # non sds drives # #/dev/dsk/c1t0d0s0 - - swap - no - #/dev/dsk/c1t0d0s1 /dev/rdsk/c1t0d0s1 / ufs 1 no logging #/dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s2 /var ufs 1 no logging,noatime
#/dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4 /opt ufs 2 yes logging
#/dev/dsk/c1t0d0s5 /dev/rdsk/c1t0d0s5 /export/home ufs 2 yes logging
# # swap slices # swap - /tmp tmpfs - yes -
7) Making sure we can boot in case of disk failure.
To make sure we can boot in case a disk fails, we need to tell the kernel to ignore the quota on metadbs, otherwise we can't boot in a two disk setup, because we can't never fullfill the requirments. For that we add the following to /etc/system set md:mirrored_root_flag=1
# echo "set md:mirrored_root_flag=1" >> /etc/system
8) Our first reboot!
Bring down the system to the OBP, don't reboot yet fully. We need to setup the boot devices now. OK setenv boot device disk0:b disk1:b Make sure the devaliases of disk0 and disk1 are actualy pointing to the correct hardware decives. Now we boot our system up for the first time on the mirror. If all went well we are up and running in a few seconds. 9) Mirroring fun part 2!
Now its time to hook up the second drive so we have actualy mirrored slices. # metattach d2 d1 / # metattach d13 d12 /swap # metattach d33 d32 /tmp # metattach d73 d72 /apps This will take considereble amount of time. Use metastat to check on the progress of the syncing Example metastat d2
10) All done,
Post a Comment