What are the configuration files used in SVM ?
1. The file is empty by default. The file is only used when metainit command is issued by the administrator. It is configured manually.
2. It can be populated by appending the output of # metastat -p. For example #metastat -p >> /etc/lvm/md.tab.
3. It can be used to recreate all the metadevices in one go. Best used in recovery of SVM configurations.
# metainit -a (to create all metadevices mentioned in md.tab file) # metainit dxx (create metadevice dxx only)
4. DO NOT use it on root file system though.
SVM uses the configuration files /etc/lvm/mddb.cf to store the location of state database replicas. Do not edit this file manually.
The configuration file /etc/lvm/md.cf contains the automatically generated configuration information for the default (unspecified or local) disk set.
This file can also be used to recover the SVM configuration If your system loses the information maintained in the state database.
Again do not edit this file manually.
The configuration file md.conf contains fields like nmd (i.e. number of volumes (metadevices) that the configuration supports) etc. The file can be edited to change the default values for various such parameters.
The RC script configures and starts SVM at boot and can be used to start/stop the daemons.
The RC script checks the SVM configuration at boot, start sync of mirrors if necessary and start the active monitoring daemon (mdmonitord).
If one of the root disk under mirrored SVM fails and you have to reboot the system, would the system reboot without any error ?
This is one of the most common question asked on SVM. Now in case of losing any state database replica (metadb) SVM determines the valid state database replica by using majority consensus algorithm. According to the algorithm it is required to have atleast (half + 1) to be available at boot time to be able to consider any of them to be valid. So in our case we if we had 6 metadb in total (3 on each disk), then we would need atleast 4 metadbs to be able to boot the system successfully, which we do not have. Hence we can’t boot the system.
To avoid this we need to add one entry in the /etc/system file to bypass the majority consensus algorithm. This enable us to boot from a single disk, which may be the requirement in many cases in production like patching the system etc. The entry is :
set md:mirrored_root_flag = 1
How to create different RAID layouts in SVM ?
RAID 0 (stripe and concatenation)
1. Creating a concatenation from slice S2 of 3 disks :
# metainit d1 3 1 c0t1d0s2 1 c1t1d0s2 1 c2t1d0s2
d1 - the metadevice 3 - the number of components to concatenate together 1 - the number of devices for each component.
2. Creating a stripe from slice S2 of 3 disks :
# metainit d2 1 3 c0t1d0s2 c1t1d0s2 c2t1d0s2 -i 16k
d2 - the metadevice 1 - the number of components to concatenate 3 - the number of devices in each stripe.
-i 16k – the stripe segment size.
3. Creating three, 2 disk concatenation and stripe them together :
# metainit d3 3 2 c0t1d0s2 c1t1d0s2 -i 16k 2 c3t1d0s2 c4t1d0s2 -i 16k 2 c6t1d0s2 c7t1d0s2 -i 16k
d3 - the meatadevice 3 - the number of stripes 2 - the number of disk (slices) in each stripe -i 16k - the stripe segment size.
How to create a mirrored (RAID 1) layout in SVM ?
In SVM mirroring is a 2 step procedure – create the 2 sub-mirrors (d11 and d12) first and associate them with the mirror (d10).
# metainit -f d11 1 1 c0t3d0s7 # metainit -f d12 1 1 c0t4d0s7 # metainit d10 -m d11 # metattach d10 d12
Here d10 is the device to mount and and d11 and d12 hold the 2 copies of the data.
How to creare a RAID 5 layout in SVM ?
To setup a RAID 5 mirror using 3 disks :
# metainit d1 -r c0t1d0s2 c1t1d0s2 c2t1d0s2 -i 16k
how to remove a metadevice ?
The metadevice can be removed if they are not open (i.e. not mounted):
# metaclear d3
To delete all the metadevices (use it carefully as it blows away entire SVM configuration):
# metaclear -a -f
How to view the SVM configuration and status of metadevices ?
To view the entire SVM configuration and status of all the metadevices :
# metastat -p
To check the configuration and status of a particular device :
# metastat d3
Another command to view SVM configuraion is :
# metastat -c
How to extend a metadevice ?
To grow a metadevice we need to attach a slice to the end and then grow the underlying filesystem:
# metattach d1 c3t1d0s2
If the metadevice is not mounted :
# growfs /dev/md/rdsk/d1
If the metadevice is mounted :
# growfs -M /export/home /dev/md/rdsk/d1
How to create metasets in SVM ?
Example below has 2 nodes (node01 and node02) with 2 shared disks assigned to both.
metadb -afc 3 c0d0s7
Create disk set
Add hosts to the diskset
On node01 :
# metaset -s [disk_set] -a -h node01 node02
Take ownership of the disk set
# metaset -s nfs1 -t -f -t --> for taking ownership -f --> forcefully
Add disks to the disk set :
# metaset -s [disk_set] -a /dev/did/rdsk/c15t0d0 /dev/did/rdsk/c15t1d0
Create the volumes in the diskset :
# metainit -s [disk_set] d11 1 1 c15t0d0 [disk_set]/d11: Concat/Stripe is setup
# metastat -s [disk_set]
How to do a root encapsulation and mirroring under SVM ?
How to grow a concat metadevice ?
How to grow a RAID 5 metadevice ?
How to grow a Mirrored metadevice ?
How to replace a failed root disk under SVM ?