Thursday, September 16, 2010

veritas volume manager Question

VxVM Disk




Q-1 How to add a disk to a disk group in Veritas Volume Manager?

Ans: To add the physical disk c0t0d0 in the disk group homedg calling it disk90 in Veritas Volume Manager:

# vxdg -g homedg adddisk disk90=c0t0d0



Q-2 How to remove a disk from a disk group in Veritas Volume Manager?

Ans: To remove a disk, disk90, from a disk group, homedg, in Veritas Volume Manager:

# vxdg -g homedg rmdisk disk90



Q-3 How to clear an import in Veritas Volume Manager after a crash?

Ans: # vxdisk clearimport c0t0d0s0



Q-4 How to list all disks and display their status in VxVM?

Ans: # vxdisk list



Q-5 How to remove a grayed out or obsolete disk, or remove a disk from a disk group in Veritas Volume Manager?

Ans: # vxdisk rm disk01



Q-6 How to remove a disk so that it is no longer under Veritas Volume Manager controls?

Ans: # vxdisk rm c0t0d0



Q-7 How to add or bring a disk under Veritas Volume Manager control?

Ans: To add or bring a disk under Veritas Volume Manager control:

# vxdiskadd c0t0d1

or

# vxdisksetup -i c0t0d1



Note: It might help to newfs the s2 slice of the disk and perform a vxdctl enable to get it to add a disk.



Q-8 How to remove a volume and any subdisks and plexes associated in VxVM?

Ans: # vxedit -rf rm volume_name





Q-9 How to rename the disk disk90 to be called disk80 in the group rootdg in Veritas Volume Manager?

Ans: # vxedit -g rootdg rename disk90 disk80



Q-10 How to set disk90 in the group homedg to be a hot spare in Veritas Volume Manager?

Ans: # vxedit -g homedg set spare=on disk90



Q-11 How to set the comment field of subdisk subdisk01-01 to "comments are here"?

Ans: # vxedit set comment"comments are here" subdisk01-01





Q-12 How to sets the user to ep, the group to epgrp and the mode rw-rw-rw on the volume vg01?

Ans: # vxedit set user=ep group=epgrp mode=0666 vg01



Disk Group



Q-1 How to display the default disk group?

Ans: #vxdg defaultdg



Q-2 How to set the default disk group?

Ans: # vxdctl defaultdg



Q-3 How to display disk group information?

Ans: # vxdg list or

# vxdg list



Q-4 How to display free disk space in disk group?

Ans: # vxdg free or

# vxdg –g free



Q-5 How to create a disk group?

Ans: # vxdg init cds=on
off



Q-6 How to create a disk group with a specified disk group version no.?

Ans: # vxdg –T init



Q-7 How to make a non CDS disk group to CDS disk group or vice versa?

Ans: # vxdg –g set cds=on
off



Q-8 How to import a disk group?

Ans # vxdg import



Q-9 How to import a destroyed disk group?

Ans: First you must know the DG ID of the destroyed disk group name. You can get the DG ID by displaying the included disk of destroyed DG.

# vxdg import



Q-10 How to disable/deport a disk group?

Ans: # vxdg deport



Q-11 How to rename a disk group during import operation?

Ans: # vxdg –t –n import



Q-12 How to rename a disk group during deport operation?

Ans: # vxdg –n deport



Q-13 How to clear locks on disk group during import?

Ans: # vxdg –C import



Q-14 How to forcible import the disk group?

Ans: # vxdg –f import



Q-15 How to move disk group object from one DG to another?

Ans: # vxdg –o expand move

# vxdg –o expand move datadg newdatadg disk01

It will move the entire associated object with disk02 from datadg to newdatadg.



Q-16 How to split a disk group to form a new disk group?

Ans: # vxdg –o expand split disk01 disk02

It will create a new DG with two specified disks.



Q-17 How to join two DGs into one?

Ans: # vxdg join



Q-18 How to destroy a disk group?

Ans: # vxdg destroy



Q-19 How to upgrade a Disk group?

Ans: # vxdg upgrade

It will upgrade the DG to the highest DG version supported by VxVM.

Or

# vxdg –T

To upgrade to a specified version no.



Mixed Questions:



Q-1 How to get volume information in Veritas Volume Manager?

Ans: # vxinfo



Q-2 How set the number of kernel thread in Veritas Volume Manager?

Ans: # vxiod set 10



Note: This is the daemon that allows for extended I/O calls without blocking calling processes. As this is a kernel thread you cannot see it with ps command so you have to use the vxiod command to see if it is running.



Q-3 How to create a plex from a subdisk in Veritas Volume Manager?

Ans: # vxmake plex sd=



Q-4 How to make a subdisk from a disk in Veritas Volume Manager?

Ans: To make a subdisk called subdisk-80 at the beginning of the disk disk80 of size 10000 blocks:

# vxmake sd subdisk-80 disk80,0,10000



If you wanted to put another subdisk on this disk then you would have an offset of the size of the previous subdisk (10000 in our case):

# vxmake sd subdisk-81 disk80,10000,20000



Q-5 How to set a plex offline in Veritas Volume Manager?

Ans: # vxmend off





Q-6 How to set a plex online in Veritas Volume Manager?

Ans: # vxmend on



Q-7 How to set a plex to a clean state in Veritas Volume Manager?

Ans: # vxmend fix clean plex-name



Q-8 How to mirror all the volumes on the disk rootdisk to disk90 in Veritas Volume Manager?

Ans: # vxmirror rootdisk disk90



Q-9 How to rebuild the partition table after a root disk failure in Veritas Volume Manager?

Ans: To rebuild the partition table after recovering from a root disk failure after re-mirroring the disk in Veritas Volume Manager:

# vxmksdpart -g rootdg diskpart 1 0x03 0x01



Q-10 How to attach a plex to a volume in Veritas Volume Manager?

Ans: # vxplex att



Q-11 How to display all the available information in Veritas Volume Manager?

Ans: # vxprint –ht



Q-12 How to display all the information about plexes in Veritas Volume Manager?

Ans: # vxprint -l

OR

# vxprint –lp



Q-13 How to display all the information about subdisks in Veritas Volume Manager?

Ans: # vxprint -l

OR

# vxprint –st



Q-14 How to display all the information about volumes in Veritas Volume Manager?

Ans: # vxprint -l volumename

OR

# vxprint -vl

OR

# vxprint –vt



Q-15 How to list all the volumes on a boot disk Veritas Volume Manager?

Ans: # vxprint -t -v -e 'aslist.aslist.sd_disk="boot-disk-name"'



Q-16 How to bring a volume back online in background mode in Veritas Volume Manager?

Ans: # vxrecover -b volume



Q-17 How to recover a volume in Veritas Volume Manager?

Ans: # vxrecover -s



Q-18 How to recover all volumes in Veritas Volume Manager?

Ans: To start recovery of all volumes in Veritas Volume Manager:

# vxrecover –s



Q-19 How to add a log disk to a volume in Veritas Volume Manager?

Ans: # vxsd aslog



Q-20 How to join subdisks in Veritas Volume Manager?

Ans: To join subdisk-88 and subdisk-77 to create the new bigger subdisk-99:

# vxsd join subdisk-88 subdisk-77 subdisk-99



Q-21 How to move the contents of a subdisk to another in Veritas Volume Manager?

Ans: To move the contents of subdisk-90 to subdisk-80 in Veritas Volume Manager:

# vxsd mv subdisk-90 subdisk-80



Q-22 How to report disk statistics in Veritas Volume Manager?

Ans: # vxstat –d



Q-23 How to trace all the I/O on the selected volume in Veritas Volume Manager?

Ans: # vxtrace



Q-24 Veritas Volume Manager GUI

Ans: # vxva



Q-25 How to put a volume in maintenance mode in Veritas Volume Manager?

Ans: # vxvol maint



Q-26 How to stop a volume in a disk group in Veritas Volume Manager?

Ans: # vxvol -g stop



Q-27 How to check which tasks is running in Veritas Volume Manager?

Ans: # vxtask list

Or

# vxtask monitor



Q-28 How to change the naming scheme?

Ans: # vxddladm set namingscheme=



Q-29 How to get the list of all enclosure?

Ans: # vxdmpadm listenclosure all



Q-30 How to check how many disks are in a particular enclosure?

Ans # vxdmpadm getdmpnode enclosure=



Q-31 How to get the path of a particular disk or how to check the enclosure of a particular device?

Ans # vxdmpadm getsubpaths dmpnodename=

Or

# vxdisk list



Q-32 How to restart VxVM configuration Daemon?

Ans # vxconfigd -k



Q-33 How to find the actual disk device name while disks are showing in enclosure based naming scheme?

Note: When disks are showing in enclosure based scheme, is shows disks name as EMC0_0, EMC0_1 rather than c0t0d0

Ans # vxdisk list –e



Q-34 How to start failed VxVM object, which got failed due to changed from OS based naming scheme to enclosure based naming.

Ans (1) First deport the disk group

(2) Run below given command

# /etc/vx/bin/vxdarestore

(3) Now import the disk group.



Q-35 How to reserve a disk for special purpose or vice versa? (Reserve disk can’t use for normal volume operation)



Ans: # vxedit –g set reserve=on diskname

And

# vxedit –g set reserve=off diskname



Q-36 How do you determine by how much a Veritas Volume can be expanded?

Ans: # vxassist –g maxgrow



Q-37 How do you grow a Veritas VXVM volume?

Ans: # vxresize –g +5g



Q-38 How many partitions are created in a disk when we initialize the disk under VxVM?

Ans: 2 partitions

Private region created on slice 3

Public region created on slice4



Q-39 What is the length of Private Region?

Ans: VxVM 5.0 = 32Mb

VxVM 4.0 = 1 Mb



Q-40 How do you determine Volume Status in Veritas VxVM?

Ans: # vxprint -htv



Q-41 Why would you deport a diskgroup in VxVM?

Ans: Normally we deport a disk group when we want to import that disk group on

other host.

# vxdg deport



Q-42 Interactive front end to the vxdisk program in VxVM?

Ans: # vxdiskadm



Q-43 How to display free space on the disks in Veritas volume Manager?

Ans: # vxdg free



Q-44 How to find how much a volume can be grown by in Veritas Volume Manager?

Ans: # vxassist maxgrow



Q-45 How to find the largest raid5 partition you can have in Veritas Volume Manager?

Ans: # vxassist maxsize layout=raid5



Q-46 How to find the largest stripe you can have in VxVM?

Ans: # vxassist maxsize layout=stripe



Q-47 How to move a volume to another disk except a particular one in Veritas Volume Manager?

Ans: To move a volume vg01 to any other disk except disk90 in Veritas Volume Manager:

# vxassist move vg01 !disk90



Q-48 How to set a preferred plex to read from in Veritas Volume Manager?

Ans: # vxvol rdpol prefer



Q-49 How to set a round robin read policy on the volume in Veritas Volume Manager?

Ans: # vxvol rdpol round volume_name



Q-50 How to verify and enable largefile support on a vxfs filesystem?

Ans: To verify if largefile support is enabled on a VXFS filesystem:

# fsadm -F vxfs /dir_name



If you need to enable largefile support:

# fsadm -F vxfs -o largefiles /dir_name



Q-51 How to add a log disk for a volume in Veritas Volume Manager?

Ans: To add a log disk for a raid5 or mirror of a volume in Veritas Volume Manager:

# vxassist addlog volume-name



Q-52 How to encapsulate the root disk?

Ans: We can encapsulate the root disk by vxdiskadm command.

# vxdiskadm  Encapsulate one or more disks



Q-53 How to mirror the root volume?

Ans: We can mirror all the volumes needed to boot with the below command:

# vxrootmir

It will mirror all the file systems needed to boot on the c0t1d0 disk.



Q-54 How to remove rootability?

Ans: We can un-encapsulate the root disk and take it out from all the file systems needed to boot the system from VxVM control by command vxunroot. This utility make the necessary changes to boot the system without VxVM support.

# vxunroot



Q-55 how to create a mirror on a previously defined volume in Veritas Volume Manager

Ans: Example to use the disks disk80 and disk90 to make a mirror on the volume called vg01:

# vxassist mirror vg01 disk80 disk90



Example to make a 50 mb mirror on volume called vg01 using any two free disks:

# vxassist mirror vg01 50m layout=mirror



Q-56 How to create a raid5 volume in Veritas Volume Manager?

Ans: To create a raid5 volume in Veritas Volume Manager using any available disks:

# vxassist make vg01 100m layout=raid5



Q-57 How to create a volume in Veritas Volume Manager?

Ans: Example to make a volume called vg01 of size 100m using any available disk:

# vxassist –g make 100m



Example to make a volume called vg01 to be 100m big using the disk disk80:

# vxassist –g make 100m disk80



Q-58 How to create a volume with a mirror and log in Veritas Volume Manager?

Ans: Example to make a volume named vg01 with 50mb stripe disk using disks disk80 and disk90 and mirror this on a stripped mirror using disk92 and disk95 and use a log subdisk:

# vxassist–g make layout=mirror,stripe,log disk80 disk90 disk92 disk95



Q-59 How to create a volume with a mirror in Veritas Volume Manager?

Ans: Example to make a volume vg01 with a 50mb mirror using the two disks disk80 and disk90:

# vxassist –g make 100m layout=mirror disk80 disk90



Q-60 How to grow the size of a volume in Veritas Volume Manager?

Ans: Examples to grow the size of the volume vg01 to 2000 512byte sectors:

# vxassist growto vg01 2000

OR

# vxassist growby vg01 2000



Q-61 How to mirror a volume on any free disk in Veritas Volume Manager?

Ans: To mirror a volume vg01 on any free disk in Veritas Volume Manager:

# vxassist mirror vg01



Q-62 How to mirror volumes in a disk group in Veritas Volume Manager?

Ans: Example to mirror volume vol80 to vol90 in the disk group rootdg:

# vxassist -g rootdg mirror vol80 vol90



Q-63 How to shrink the size of a volume in Veritas Volume Manager?

Ans: Examples to shrink the volume vg01 by 2000 512byte sectors:

# vxassist shrinkto vg01 2000

OR

# vxassist shrinkby vg01 2000



Q-64 How to verify the main daemon for Veritas Volume Manager?

Ans: vxconfigd is the main daemon of Veritas Volume Manager which must be running at all times. It is started at system startup.

We can check its status by below given way:

# vxdctl mode



Or we can verify it is running with a ps command:

# ps -ef
grep vxconfigd



Q-65 How to enable, disable or verify the vxconfigd daemon in Veritas Volume Manager?



To verify the vxconfigd daemon in Veritas Volume Manager:

# vxdctl mode



To enable the vxconfigd daemon:

# vxdctl enable



To disable the vxconfigd daemon:

# vxdctl disable





Q-66 How to upgrade VxVM?

Ans:





Q-67 What is vxbootsetup utility?

Ans: The vxbootsetup utility configures physical disks so that they can be used to boot the system. Before vxbootsetup is called to configure a disk, mirrors of the root, swap, /usr and /var volumes (if they exist) should be created on the disk. These mirrors should be restricted mirrors of the volume. The vxbootsetup utility configures a disk by writing a boot track at the beginning of the disk and by creating physical disk partitions in the UNIX VTOC that match the mirrors of the root, swap, /usr and /var.

With no medianame arguments, all disks that contain usable mirrors of the root, swap, /usr and /var volumes are configured to be bootable. If medianame arguments are specified, only the named disks are configured.

vxbootsetup requires that the root volume is named rootvol and has a usage type of root. The swap volume is required to be named swapvol and to have a usage type of swap. The volumes containing /usr and /var (if any) are expected to be named usr and var, respectively.

Q-68 What is vxrootmir utility?

Ans: The vxrootmir script creates mirrors of volumes required in booting. It creates a mirror for rootvol, swapvol and standvol. It also creates mirrors of usr, var and home if they exist as separate volumes on the boot disk. The mirror is created on the specified disk media device.

The specified disk media device should have enough space to contain the mirror for all the source volumes mentione above, or else it will fail. Also, corresponding slices must be free because it is used to create the partition for root.

All disk partitions for the new volume mirrors are created.



This script is called by the vxmirror command if the root disk is required to be mirrored. It is also called from the vxdiskadm menus through the choice of the mirror volumes on a disk operation.



Q-69 What is vxmirror utility?

Ans: The vxmirror command provides a mechanism to mirror all the contents of a specified disk, to mirror all currently un-mirrored volumes in the specified disk group, or to change or display the current defaults for mirroring. All volumes that have only a single plex (mirror copy), will be mirrored by adding an additional plex.

Volumes containing subdisks that reside on more than one disk will not be mirrored by vxmirror.

vxmirror is generally called from the vxdiskadm menus. It is not an interactive command and once called, will continue until completion of the operation or until a failure is detected.

Q-70 What is vxunroot utility?

Ans: The vxunroot script causes the root, swap, usr and var file systems to be converted back into being accessible directly through disk partitions instead of through volume devices. Other changes made to ensure the booting of the system from the root volume are also removed such that the system will boot with no dependency on the Volume Manager.



For vxunroot to work properly, all but one plexes of rootvol, swapvol, usr and var should be removed. The plexes left behind for the above volumes should be the ones created by vxrootmir or the original ones created when the root disk was encapsulated. This will ensure that the underlying subdisks will have equivalent partitions defined for them on the disk. If none of these conditions are met, the vxunroot operation will fail and none of the volumes will be converted to disk partitions.



Q-71 How to recover from the root disk and root-mirror disk failure?

Ans:

1) Boot the system into single user mode from Solaris installation CD.

ok boot cdrom –s



2) Use the format command to create partitions on the new root disk (c0t0d0s2). These should be identical in size to those on the original root disk before encapsulation unless you are using this procedure to change their sizes.

3) Create the file system on this slice

# mkfs –F ufs /dev/rdsk/c0t0d0s0



4) Mount the root slice on /a

# mount /dev/dsk/c0t0d0s0 /a



5) Now restore the / file system from backup.



6) Now run the installboot command to install bootblk.

# cd /usr/platform/`uname –i`/lib/fs/ufs

# installboot bootblk /dev/rdsk/c0t0d0s0

Or

# installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0



7) Now restore /usr file system if it is there.



8) Create /etc/vx/reconfig.d/state.d/install-db file to prevent the configuration daemon from starting.

# touch /a/etc/vx/reconfig.d/state.d/install-db



9) Now comment 2 lines in /etc/system file as given below

# cp /a/etc/system /a/etc/system.orig

# vi /a/etc/system

* set vxio:vol_rootdev_is_volume=1

* rootdev:/pseudo/vxio@0:0



10) Now edit the vfstab file to replace the volume device names with the disk slices.



11) Now remove the /a/dev/vx/dsk/bootdg and /a/dev/vx/rdsk/bootdg

# rm /a/dev/vx/dsk/bootdg

# rm /a/dev/vx/rdsk/bootdg



12) Now reboot the system. System will be booted into multi user mode.

# init 6







Q-72 How to recover the VxVM configuration after reinstallation of Solaris?

Ans: Reinstallation is necessary if all copies of your root disks are damaged, or if certain critical files are lost due to file system damage. Disconnect all the disks which are not involved in reinstallation process.



1) Install the Solaris OS



2) Install the VxVM software and also install the VxVM license also.



2) Recover the VxVM configuration.

1) touch the /etc/vx/reconfig.d/state.d/install-db file

2) Shut down the system

3) Reattach the disks which were removed before installation.

4) Reboot the system and when the system comes up, bring it into single user mode.

5) Remove the /etc/vx/reconfig.d/state.d/install-db file

6) Start VxVM IO daemons.

# vxiod set 10

7) Start the VxVM daemon in disable mode

# vxconfigd –m disable

8) Initialize the vxconfigd daemon

# vxdctl init

9) Initialize the DMP subsystem

# vxdctl initdmp

10) Now start the vxconfigd daemon

# vxdctl enable

11) Now reboot the system



Now the configuration preserved on the disks not involved in the reinstallation has now been recovered.





Q-73 How to convert the SVM meta devices into VxVM volumes?

Ans: There are three utilities used to convert SVM meta devices into VxVM volumes.



1) Run the preconvert utility to analyze the current SVM configuration:

# preconvert

The preconvert utility analyzes the current Solaris Volume Manager configuration and builds a description for the new VxVM configuration. preconvert does not make any changes to the Solaris Volume Manager configuration or to the host system.



2) Now run the showconvert utility to display the preconvert conversions plan into readable format.

# showconvert



3) Now run the convertname utility to display the VxVM volume names .

# convertname /dev/md/dsk/d12

Note: The convertname utility takes Solaris Volume Manager device paths as arguments (metadevice paths or raw disk paths) and returns the VxVM volume path for the device as it will show after the conversion.



4) Now run the doconvert utility to start the actual conversion process

# doconvert



5) Now reboot the system to make the changes.

Monday, September 6, 2010

Add multiple user in solaris

1:Create a file username , in which add  all new usernames.
2: Run the below script

#!/bin/sh


x=201

for i in `cat /tmp/username`

do

x=`expr $x + 1`

useradd -u $x -g 10 -m -d /export/home/$i -s /bin/sh $i

done

ssh login without password

First log in on 192.168.30.72 as user user1 and generate a pair of authentication keys. Do not enter a passphrase:


----------------------------------------------------------------

user1@192.168.30.72:~> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/a/.ssh/id_rsa):

Created directory '/home/a/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/a/.ssh/id_rsa.

Your public key has been saved in /home/a/.ssh/id_rsa.pub.

The key fingerprint is:

3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

--------------------------------------------------------------------



Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):

-----------------------------------------------------------------------

user1@192.168.30.72:~> ssh user1@192.168.30.178 mkdir -p .ssh

user1@192.168.30.178's password:

------------------------------------------------------------------------

Finally append a's new public key to user1@192.168.30.178:.ssh/authorized_keys and enter user1's password one last time:

-----------------------------------------------------------------------------------------------------

user1@192.168.30.72:~> cat .ssh/id_rsa.pub
ssh user1@192.168.30.178 'cat >> .ssh/authorized_keys'

user1@192.168.30.178's password:

----------------------------------------------------------------------



From now on you can log into B as b from A as a without password:

------------------------------------------------------------------------

user1@192.168.30.72:~> ssh user1@192.168.30.178