To mirror root is
a good practice as
it provides high-availability in
production environments and also minimum
downtime. I have to
make the document as
simple as I could
though I cant help
with the commands that
seem to be so
unfriendly. In this tutorial
I would be ignoring
the installation part of solaris10
update9.
As you can see
that slice 7 is
dedicated for the replicas.
Format command output
As we have two hard disks c0t0d0 and
c0t1d0 and our OS is installed on c0t0d0, we need to partition the second disk
exactly as the first to perform root mirror. So we shall copy the VTOC of
c0t0d0 to c0t1d0.
# prtvtoc /dev/rdsk/c0t0d0s2 |
fmthard -s - /dev/rdsk/c0t1d0s2
Now
that we have partitioned
the second hard disk
same as the first
one we need to
prepare a layout of
what other slices do
we need to mirror
apart from the root
slice.
Preparing
mirroring strategy
/ d10 d11
+ d12 c0t0d0s0 +
c0t1d0s0
swap d20 d21
+ d22 c0t0d0s1 +
c0t1d0s1
/var d30 d31
+ d32 c0t0d0s3 +
c0t1d0s3
/export/home d40 d41 +
d42 c0t0d0s4 +
c0t1d0s4
/data d50 d51
+ d52 c0t0d0s5 +
c0t1d0s5
Once
we have prepared the
strategy, we can go
ahead and carry out
further steps to root
mirroring.
First
of all we need
to create replicas on
the slice 7 of
each disk.
# metadb -afc3 c0t0d0s7
# metadb -afc3 c0t1d0s7
Next
we create mirrors on
both disks, create main mirrors and attach the first mirror
to the main mirror.
Creating
slice 0 mirrors or
root mirrors
# metainit -f d11
1 1 c0t0d0s0 ## slice 0
stripe d11 on disk1
# metainit -f d12
1 1 c0t1d0s0 ## slice 0
stripe d12 on disk2
# metainit d10 -m
d11 ## attaching slice
0 stripe d11 to
main mirror d10
Creating
slice 1 mirrors or
swap mirrors
# metainit -f d21
1 1 c0t0d0s1
# metainit -f d22
1 1 c0t1d0s1
# metainit d20 -m
d21
Creating
slice 3 mirrors
# metainit -f d31
1 1 c0t0d0s3
# metainit -f d32
1 1 c0t1d0s3
# metainit d40 -m
d41
Creating slice 4 mirrors
# metainit -f d41
1 1 c0t0d0s4
# metainit -f d42
1 1 c0t1d0s4
# metainit d50 -m
d51
Creating slice 5 mirrors
# metainit -f d51
1 1 c0t0d0s5
# metainit -f d52
1 1 c0t1d0s5
# metainit d50 -m
d51
After creating the main mirrors, we need to
run metaroot command specifying the root mirror. After which you will see a
notable change in the /etc/vfstab and /etc/system files which in turn will
confirm us about the root mirror.
# metaroot d10
This
line shows in /etc/vfstab,
notice the
partitions and you can find that there are changes in / file system line.
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
Before
issuing metaroot
After
issuing metaroot
These lines show 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)
Change all the partitions mounted in /etc/vfstab as shown below. The below made changes are
according to the metadevices that were applicable in my case, hence do not copy
unless you are sure about it.
# sync; sync;
# lockfs -fa
# init 6
After the system has rebooted open up the
terminal again and attach rest of the mirrors that were created to the main
mirrors one by one
# metattach d10 d12
# metattach d20 d22
# metattach d40 d42
# metattach d50 d52
# metattach d60 d62
You can check the syncing status of the
mirror using below mentioned commands.
# metastat
# metastat | grep -i %
After attaching all the mirrors one after
the other, run the below mentioned command to check and confirm the mirror
status.
Now that we have set up the mirrors, we have to set
boot device. This can be done as follows.
# ls -ll /dev/md/dsk/d10
We can also set the bootpath as the first
disk and alternate bootpath as second disk. We will go with the root mirror
d10.
#eeprom
bootpath=/devices/pci@0,0/pci8086,2829@d/disk@0,0:a
As soon as the bootpath is set to root
mirror d10, the
file /boot/solaris/bootenv.rc shows these lines:
setprop bootpath
'/devices/pseudo/md@0:0,10,blk'
Now we need to set up grub on the second
disk. The following command does that for us.
# installgrub -m /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t1d0s0
Edit
/etc/system file and append the below mentioned lines
to avoid the system to enter the maintenance mode if one of the hard disks
fails.
set
md:mirrored_root_flag=1
That was all we had to do while root mirroring two disks. Cheers !!!
Babs thank you so much for your explanation
ReplyDelete