Tuesday, 28 August 2012

Solaris Volume Manager

Configuration file and Process details of SVM


I won't get into the details of solaris volume manager, as there are many articles available on the internet which will provide you a plenty of information.
Few of the information which i would like to share, that will be handy in understanding the important concept of SVM.
As you know,for each and every software configured on a machine there are few configuration files involved and there are few processes associated with it.

So first, lets discuss the main configuration files for SVM,

The configuration located in /etc/lvm

-rw-r--r--   1 root     sys          101 Aug 28 20:01 md.cf
-rw-r--r--   1 root     sys           95 Aug 28 20:35 mddb.cf


md.cf - metadevice configuration file 

Cat output of the file is shown below

# cat md.cf
# metadevice configuration file
# do not hand edit
d0 -m d10 d11 1
d10 1 1 c2t3d0s6
d11 1 1 c2t4d0s6

The above file content can be displayed using the below command.

#metastat -p
mddb.cf - metadevice database location details

Below is the output of cat on that file

# cat mddb.cf
#metadevice database location file do not hand edit
#driver minor_t daddr_t device id       checksum
sd      512     16      id1,sd@n6000c29d87e38ec3b5a13a31456d14c1/a      -3659
sd      512     8208    id1,sd@n6000c29d87e38ec3b5a13a31456d14c1/a      -11851
sd      512     16400   id1,sd@n6000c29d87e38ec3b5a13a31456d14c1/a      -20043

From the above output what we can extract is, there are three metadatabase created on the same device.
Daemon for SVM

disabled         20:34:50 svc:/network/rpc/meta:default
disabled        20:34:50 svc:/system/metainit:default


You need not to start it manually, when you create your first metadatabase on the machine, it will start on its own and when you delete all the metadatabase, the above processes goes into disabled mode.

As you know metadatabase is the foundation of any metadevice. If by some reason, all metadatabase replicas are corrupted then you loose the complete SVM configuration.

Recovering SVM configuration from a corrupted metadatabase.

Follow the below steps incase all metadatabase are deleted or corrupted.

Step 1:

Recreate the metadatabase on the same slice which were existed earlier or use a different slice

# metadb -d -f /dev/dsk/c2t3d0s0

Step 2:

Now you need to rebuild the metadevice configuration. First question that may be arising in your mind how do we find which metadevice is configured on which slice, whether it was mirrored. Don't worry the configuration file(/etc/lvm/md.cf) which i explained earlier still has the complete details. Now you may be thinking even this file will be emptied as a result of metadatabase corruption. No, as i mentioned earlier SVM maintains configuration of metadevice and metadatabase in different files so even if you delete all metadatabase your metadevice configuration file content will remain intact.

# cat md.cf
# metadevice configuration file
# do not hand edit
d0 -m d10 d11 1
d10 1 1 c2t3d0s6
d11 1 1 c2t4d0s6

Now using the above, you can easily rebuild your metadevice. As you see from the above,  d0 is mirror metadevice which has two submirrors d10 and d11

#metainit  d10 1 1 c2t3d0s6
#metainit  d11 1 1 c2t4d0s6

#metainit d0 -m d10

#metattach d0 d11

So your metadevice is place.

NOTE: Don't create a new filesystem on this metadevice else you will loose all the previous data. Just mount  the metadevice and access your old data.








No comments:

Post a Comment