SVM-2
What we will learn
in Next Few Pages,
·
Root Disk mirroring
Well we tried some of svm in our first part, but I think that in last
few pages due to taking soft partitions with mirroring, it might be confusing.
So here we will start with fresh,
For Root Mirroring we should consider few things in mind,
·
Always take the bkp of /etc/system &
/etc/vfstab before root mirror
·
First run the prtvtoc|fmthard, then go for
creating metadb
·
Svm will do changes for / only in /etc/vfstab, do
remember to change others manually
***better free at least 20-25gb in
the drive where u had created your VM
I attached one disk of same size via VM settings.
Then
We have 2 disks c1t0d0s2 & c1t1d0s2 of same size but with
different layout,
root@sol-test-1:>/#
prtvtoc /dev/rdsk/c1t0d0s2 |fmthard -s - /dev/rdsk/c1t1d0s2
This will update the partition layout as same as c1t0d0s2
Though I had already created a 100mb slice on c1t0d0s7… b’coz of
prtvtoc |fmthard it is already created in c1t1d0s7
root@sol-test-1:>/#metainit
–afc 3 c1t0d0s7 c1t1d0s7
Now just take the bkp of these files
root@sol-test-1:>/# cp /etc/system
/etc/system.org
root@sol-test-1:>/# cp /etc/vfstab
/etc/vfstab.org
Now do some change
root@sol-test-1:>/#
vi /etc/system
set md:mirrored_root_flag=1 [add this line at the end of file]
root@sol-test-1:>/#
init 6
Now we can start our root disk mirroring
root@sol-test-1:>/#
cat /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
-
/dev/dsk/c1t0d0s1 - -
swap - no
-
/dev/dsk/c1t0d0s0
/dev/rdsk/c1t0d0s0 / ufs
1 no -
/dev/dsk/c1t0d0s3
/dev/rdsk/c1t0d0s3
/export/home ufs 2 yes
-
/dev/dsk/c1t0d0s4
/dev/rdsk/c1t0d0s4 /opt ufs
2 yes -
/devices - /devices devfs
- no -
sharefs -
/etc/dfs/sharetab sharefs
- no -
ctfs - /system/contract ctfs
- no -
objfs - /system/object objfs
- no -
swap - /tmp
tmpfs - yes
-
We have to mirror
c1t0d0s0 /
C1t0d0s1 swap
c1t0d0s3 /export/home
c1t0d0s4 /opt
Let’s start
root@sol-test-1:>/#
metainit -f d11 1 1 c1t0d0s0
d11: Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d12 1 1 c1t1d0s0
d12: Concat/Stripe is setup
#metainit d2 –m d11
root@sol-test-1:>/#
metaroot d2
root@sol-test-1:>/#
metainit -f d21 1 1 c1t0d0s1
d21:
Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d22 1 1 c1t1d0s1
d22:
Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d31 1 1 c1t0d0s3
d31:
Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d32 1 1 c1t1d0s3
d32:
Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d41 1 1 c1t0d0s4
d41:
Concat/Stripe is setup
root@sol-test-1:>/#
metainit -f d42 1 1 c1t1d0s4
d42:
Concat/Stripe is setup
root@sol-test-1:>/#
init 6
Now system is back
root@sol-test-1:>/#
who -b
. system boot Oct 2
12:37
root@sol-test-1:>/#
cat /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
-
/dev/dsk/c1t0d0s1 -
- swap -
no -
/dev/md/dsk/d2 /dev/md/rdsk/d2 / ufs
1 no -
/dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3 /export/home ufs
2 yes -
/dev/dsk/c1t0d0s4 /dev/rdsk/c1t0d0s4 /opt
ufs 2 yes
-
/devices -
/devices devfs -
no -
sharefs - /etc/dfs/sharetab sharefs - no
-
ctfs -
/system/contract ctfs
- no -
objfs -
/system/object objfs -
no -
swap -
/tmp tmpfs -
yes -
See the changes for /
And other slices are same as previous.
(Actually following steps I have to do before reboot, but anyways let’s
see)
root@sol-test-1:>/#
metainit d3 -m d21
d3: Mirror is setup
root@sol-test-1:>/#
metainit d4 -m d31
d4: Mirror is setup
root@sol-test-1:>/#
metainit d5 -m d41
d5: Mirror is setup
Now attach the submirrors to mirror device
root@sol-test-1:>/#
metattach d2 d12
d2: submirror d12 is attached
root@sol-test-1:>/#
metattach d3 d22
d3: submirror d22 is attached
root@sol-test-1:>/#
metattach d4 d32
d4: submirror d32 is attached
root@sol-test-1:>/#
metattach d5 d42
d5: submirror d42 is attached
root@sol-test-1:>/#
metastat |grep sync
State: Resyncing
Resync in progress: 1 %
done
State: Resyncing
State: Resyncing
Resync in progress: 9 %
done
State: Resyncing
State: Resyncing
Resync in progress: 20 %
done
State: Resyncing
State: Resyncing
Resync in progress: 20 %
done
State: Resyncing
Well, let it sync until we understand that what we did,
We had 4 slices to mirror including root
/ swap /opt /export/home
Means 4 original and 4 mirrors… total 8. Good, Now we have to convert
all 8 to concat volumes individually.
c1t0d0s0 c1t0d0s1 c1t0d0s3 c1t0d0s4 slices
<d11> <d21> <d31> <d41> metadevices/submirrors
c1t1d0s0 c1t1d0s1 c1t1d0s3 c1t1d0s4 slices
<d12> <d22> <d32> <d42> metadevices/submirrors
#metainit –f
<metadevice> 1 1 <slice>
After making concat to all,We need metaroot only for root slice.
#metaroot <root
metadevice>
Now we need another metadevice to control submirrors like,
D2 for d11 & d12 [after making d2, we suppose to deal with d2
only]
D3 for d21 & d22
D4 for d31 & d32
D5 for d41 & d42
Now we need to mirror that metadevice with original subvolume
#metainit d2 –m d11
After that we need to attach that metadevice with other subvolume.
#metattach d2 d12
root@sol-test-1:>/#
metastat |grep sync
State: Resyncing
Resync in progress: 52 %
done
State: Resyncing
root@sol-test-1:>/#
metastat |grep sync
State: Resyncing
Resync in progress: 93 %
done
State: Resyncing
root@sol-test-1:>/#
metastat |grep sync
root@sol-test-1:>/#
OK sync has been done,
Now make changes in /etc/vfstab, after changes it should look like
root@sol-test-1:>/#
cat /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
-
/dev/md/dsk/d3 -
- swap -
no -
/dev/md/dsk/d2 /dev/md/rdsk/d2
/ ufs 1
no -
/dev/md/dsk/d4 /dev/md/rdsk/d4 /export/home ufs
2 yes -
/dev/md/dsk/d5 /dev/md/rdsk/d5 /opt ufs
2 yes -
/devices - /devices devfs
- no -
sharefs -
/etc/dfs/sharetab sharefs
- no -
ctfs - /system/contract ctfs
- no -
objfs - /system/object objfs
- no -
swap - /tmp
tmpfs - yes
-
root@sol-test-1:>/#
init 6
Now time to finger crossed
Well, its back
root@sol-test-1:>/#
who -b
. system boot Oct 2
13:02
root@sol-test-1:>/#
metastat -c
d5 m 2.3GB d41 d42
d41 s
2.3GB c1t0d0s4
d42 s
2.3GB c1t1d0s4
d4 m 1.0GB d31 d32
d31 s
1.0GB c1t0d0s3
d32 s
1.0GB c1t1d0s3
d3 m 1.0GB d21 d22
d21 s
1.0GB c1t0d0s1
d22 s
1.0GB c1t1d0s1
d2 m
7.3GB d11 d12
d11 s
7.3GB c1t0d0s0
d12 s
7.3GB c1t1d0s0
root@sol-test-1:>/# metadb -i
flags first blk block count
a m
p luo 16 8192 /dev/dsk/c1t0d0s7
a p
luo 8208 8192 /dev/dsk/c1t0d0s7
a
p luo 16400 8192 /dev/dsk/c1t0d0s7
a
p luo 16 8192 /dev/dsk/c1t1d0s7
a
p luo 8208 8192 /dev/dsk/c1t1d0s7
a
p luo 16400 8192 /dev/dsk/c1t1d0s7
OK… Let’s do some
more
Now I will try to
boot the system with Second disk to confirm the mirror is OK,
[for x86]
root@sol-test-1:>/# installgrub
-fm /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1t1d0s0
stage1 written to
partition 0 sector 0 (abs 16065)
stage2 written to
partition 0, 273 sectors starting at 50 (abs 16115)
stage1 written to
master boot sector
root@sol-test-1:>/# ls -l /dev/rdsk/c1t1d0s0
lrwxrwxrwx 1 root
root 50 Sep 30 14:38
/dev/rdsk/c1t1d0s0 -> ../../devices/pci@0,0/pci15ad,1976@10/sd@1,0:a,raw
root@sol-test-1:>/# eeprom
altbootpath=/pci@0,0/pci15ad,1976@10/sd@1,0:a
root@sol-test-1:>/# eeprom |grep
-i boot
bootpath=/pci@0,0/pci15ad,1976@10/sd@0,0:a
altbootpath=/pci@0,0/pci15ad,1976@10/sd@1,0:a
Well we are all set
to do the test for disk2
root@sol-test-1:>/# metadetach d2
d11
d2: submirror d11 is
detached
root@sol-test-1:>/# init 6
Again finger crossed
Well… again system
is back
But how do we know
that it has booted from second disk?
root@sol-test-1:>/# metastat d2
d2: Mirror
Submirror 0: d12
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 15374205 blocks (7.3 GB)
d12: Submirror of d2
State: Okay
Size: 15374205 blocks (7.3 GB)
Stripe 0:
Device Start Block Dbase
State Reloc Hot Spare
c1t1d0s0 0
No Okay Yes
Device Relocation
Information:
Device Reloc
Device ID
c1t1d0 Yes
id1,sd@n6000c29700f5a0d6df10f3adfcb373e3
See… there is only
d12 which is disk2
Now I should attach
d11 again to d2 for redundancy
root@sol-test-1:>/# metastat
|grep -i sync
State: Resyncing
Resync in progress: 1 % done
State: Resyncing
root@sol-test-1:>/# metastat
|grep -i sync
State: Resyncing
Resync in progress: 70 % done
State: Resyncing
OK… now the sync is
done…
That Sounds good?
Really?
[take snapshot before doing this]
Now remove 1st
or 2nd any one disk from VM settings.
I had removed 1st
disk,
root@sol-test-1:>/# devfsadm -c
disk
root@sol-test-1:>/# metastat -c
d5 m 2.3GB d41 d42
d41
s 2.3GB c1t0d0s4
d42
s 2.3GB c1t1d0s4
d4 m
1.0GB d31 d32
d31
s 1.0GB c1t0d0s3
d32
s 1.0GB c1t1d0s3
d3 m 1.0GB d21 d22
d21
s 1.0GB c1t0d0s1
d22
s 1.0GB c1t1d0s1
d2 m 7.3GB d12 d11 (maint)
d12
s 7.3GB c1t1d0s0
d11
s 7.3GB c1t0d0s0 (maint)
Ok… seems we are
getting something,
root@sol-test-1:>/# metastat d2
d2: Mirror
Submirror 0: d12
State: Okay
Submirror 1: d11
State: Needs maintenance
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 15374205 blocks (7.3 GB)
d12: Submirror of d2
State: Okay
Size: 15374205 blocks (7.3 GB)
Stripe 0:
Device Start Block Dbase
State Reloc Hot Spare
c1t1d0s0 0
No Okay Yes
d11: Submirror of d2
State: Needs maintenance
Invoke: metareplace d2 c1t0d0s0 <new
device>
Size: 15374205 blocks (7.3 GB)
Stripe 0:
Device Start Block Dbase
State Reloc Hot Spare
c1t0d0s0 0
No Maintenance Yes
Device Relocation
Information:
Device Reloc
Device ID
c1t1d0 Yes
id1,sd@n6000c29700f5a0d6df10f3adfcb373e3
c1t0d0 Yes
id1,sd@n6000c2994ebc0f69c69f8d652a64edd2
root@sol-test-1:>/# metadb
flags first blk block count
Wm
p l 16 8192 /dev/dsk/c1t0d0s7
W
p l 8208 8192 /dev/dsk/c1t0d0s7
W
p l 16400 8192 /dev/dsk/c1t0d0s7
a
p luo 16 8192 /dev/dsk/c1t1d0s7
a
p luo 8208 8192 /dev/dsk/c1t1d0s7
a
p luo 16400 8192 /dev/dsk/c1t1d0s7
#metadb –i [for
detail of flags]
Shall we reboot the
machine?
root@sol-test-1:>/#
init 6
This time Crossed
Fingers will not work,
OMG… system is back…
but how?
root@sol-test-1:>/# metastat -c
d5 m 2.3GB d41 (maint) d42
d41
s 2.3GB c1t0d0s4 (maint)
d42
s 2.3GB c1t1d0s4
d4 m 1.0GB d31 (maint) d32
d31
s 1.0GB c1t0d0s3 (maint)
d32
s 1.0GB c1t1d0s3
d3 m 1.0GB d21 (maint) d22
d21
s 1.0GB c1t0d0s1 (maint)
d22
s 1.0GB c1t1d0s1
d2 m 7.3GB d12 d11 (maint)
d12
s 7.3GB c1t1d0s0
d11
s 7.3GB c1t0d0s0 (maint)
root@sol-test-1:>/# metadb
flags first blk block count
M Wm
p l 16 unknown /dev/dsk/c1t0d0s7
M W
p l 8208 unknown /dev/dsk/c1t0d0s7
M W
p l 16400 unknown /dev/dsk/c1t0d0s7
a m
p luo 16 8192 /dev/dsk/c1t1d0s7
a
p luo 8208 8192 /dev/dsk/c1t1d0s7
a
p luo 16400 8192 /dev/dsk/c1t1d0s7
root@sol-test-1:>/# who -b
.
system boot Oct 2 14:37
We know that half+1
replicas are required to boot the system in svm, but here only 3 replicas are
there, so how the system does survived the reboot?
Have u remembered we
did altered a file /etc/system by adding a line at the bottom, what was that?
It said svm that
just boot the system even with half.
Great Na?
Well… we will remove
the disk and do some here & there in Next Post.
Now you might
thought that what to do with this mess?
[if u had taken
snapshot then just revert or delete this and make new setup]
Till then just relax
and do some practice, till u do all the things without cheating.
No comments:
Post a Comment