Tuesday, 17 March 2009

VxVm cheat sheet

Veritas Volume Manager

VM daemons

vxconfigd

Maintains system configuration in the kernel & disk (private region). If the daemon is stopped it does not disable any configuration state loaded into the kernel, it only affects the ability to make configuration changes until vxconfigd is restarted.

It can be in three states:
Enabl = Normal mode
Disable = Most operations cannot be be used
Booted = Normal startup while using boot disk group

vxrelocd Monitors for failure events and relocates failed subdisks

vxconfigbackupd Used to backup configuration chnages, the files created can be used with vxmake to restored lost groups.

vxnotify Display vertias volume manager events used with the vxconfigd daemon
Kernel Info
Kernel States
The kernel can be in three states:

Enabled - both private and public regions are accessible
Disabled - no private or public regions are accessible
Detached - only private regions are accessible


VM utilities

VxVM debug
vxconfigd -k -m enable -x

-x log log to /var/vxvm/vxconfigd.log
-x logfile = log to filename
-x syslog log to syslog
-x timestamp date and timestamp every entry
-x tracefile=name log all possible tracing to file

vxiod
The vxiod utility starts, stops, or reports on VERITAS Volume Manager (VxVM) I/O daemons. An I/O daemon provides a process context for performing I/O in VxVM.Manage extended disk i/o & handles dirty regions, logging

vxiod set = set number of runnning viod daemon

Note: when run on its own it displays # of vxiod daemons that are running.

vxdctl [option]
The vxdctl utility manages aspects of the state of the volume configuration daemon vxconfigd and also manages aspects of configuration for bootstrapping the rootdg disk group.

mode = what mode the vxconfigd is running in
enable = enable the vxconfigd daemon (reread the db)
disable = disable the vxconfigd daemon
stop = kill the vxconfigd daemon (Use 'vxconfigd -k -m disable' to start again)
license [init] = print out license info or reread licenses
support = display version and components
list = display entries in /etc/vx/volboot
init [dmp] = recreate /etc/vx/volboot

Note: when is disabled or stop mode no VX commands will be able to run

vxinstall
Install volume manger (use /etc/vx/disk to exclude any disks or controllers)

Disk Regions

Private
This is were veritas holds the meta data regarding the disk. A copy of the configuration database is copied to each private region within the disk group. Veritas will try and keep 5 copies of the configuration database.

Normally configured as slice 3

Public
This is the area that will store the users data.

Normally configured as slice 4.

Disk Layouts
Sliced Disk layout
private region and public region slices are on seprate partitions (3 & 4), tis type of disk is not suitable for moving between different O/S's but are suitable for boot partitions

Can be converted to CDS

CDS (Cross-platform Data Sharing) private and public regions are one slice (slice 7) , this type is suitable for moving between different O/S's but not suitable for boot parttions.
Simple
Private and public are the same partition but continuous (slice 3)

Can be converted to CDS

None None partitioning
VxVM Configuration Database

DB size vxdg list | grep permlen - the size of the configuration db
DB location vxdisk list | grep -i configs - db location
File Locations

vxinstall has not be run /etc/vx/reconfig.d/state.d/install-db
Host ID's /etc/vx/volboot
backup config files (vxconfigbackupd) /etc/vx/cbr/bk
delete or deported disk group config files /etc/vx/dgcfg/deport
All commands logs /var/adm/vx/veacmdlog
Licenses /etc/vx/licenses/lic
Imported disk groups info
/var/vxvm/tempdb

Note: to clear the tempdb file:
vxconfigd -k -x cleartempdir - clear the /var/vxvm/tempdb

vxconfigd log file /var/vxvm/vxconfigd.log
Backup & Restore

Backup
/usr/lib/vxvm/bin/vxconfigbackup -l /var/vxvm/backups

-l = location where to store backup

Restore (precommit/commit)
vxconfigrestore -p

# either one of the below after the precommit
vxconfigrestore -d
vxconfigrestore -c

Note:
-p = when you want to check that the restore is correct (use vxprint to check)
-d = abort the precommit
-c = commit the precommit

Disks

Initialize disk
vxdisksetup -i c2t0d0 privlen=768
vxdisksetup -i format=sliced - initialized a disk as a sliced disk

Note: format can be either sliced, simple, cdsdisk or none (see above - Disk Regions)

Uninitialize disk vxdiskunsetup -C c2t0d0
Disk Information vxdisk -g list
vxdisk -s list
Resize a LUN vxdisk -g resize length=8G
Add a disk slice to volboot vxdctl add disk type=simple
Add a disk slice vxdisk –f type=simple
Add a disk vxdiskadd c1t0d0 or c1 (all disk on controller)
vxdisksetup -i
Remove a disk totally from VM vxdisk rm
Remove a disk from a volume vxdg -g rmdisk
Remove a disk slice from VM vxdctl rm disk
Clear any host ID flags vxdisk clearimport
Renaming a disk vxedit -g rename
Move disk to different disk group vxdg move
Offline a disk
vxdisk offline

Note: disk must not be in a disk group

Online a disk
vxdisk online

Note: disk must have a private region otherwise you need to initialise the disk

Hot spare vxedit –g set spare=on
NoHotUse vxedit –g set nohotuse=on
Turn off failing flag vxedit -g set failing=off
Encapsulate a disk vxdisk define c0t0d0s0 type=nopriv
Reattach disk (SAN)
vxreattach [-br | -c]

-b = Background process
-r = Recover volumes
-c = Checks to see if reattach is possible

Discover new disks vxdisk scandisks [new | fabric ]
Disk Comment vxedit -g set comment="......."

Disk Group

Create a disk group vxdg init group =
vxdg init = cds=off - initialize a non-cds disk group
Remove a group vxdg destroy
Add a disk to a group vxdg –g adddisk =
Remove a disk from a group vxdg –g rmdisk
Replace failed disk
vxdg -k -g adddisk =

-k = forces vxvm to take media name of the failed disk & assign it to the new disk

Import a group
vxdg import
vxdg -n import
vxdg -C import
Import group (clear any flags)
vxdg import -C

-C - clears any exist host flags

Depot a group vxdg deport
vxdg -n deport
List no hot use on disk vxdg –g nohotuse
List spare space on disk vxdg –g spare
Display free space vxdg –g free
Backup disk group (vxvm 4.0) vxconfigbackup
Restore disk group (vxvm 4.0) vxconfigrestore [-p|-d|-c]
Diskgroup Version vxdg list | grep -i version
Upgrade disk version vxdg upgrade - upgrade to current version
vxdg -T 50 upgrade - upgrade to version 50
vxdg -T 50 init = - creater new group @ version 50
Boot/Default DG vxdg bootdg
vxdg defaultdg

vxdctl defaultdg - set defaultdg

Volume

Adding mirror to root /etc/vx/bin/vxrootmir create rootvol, swap vol,
Create a simple volume
vxassist make
vxassist -g make !ctrl:c2 - don't use controller 2

vxassist make layout=[stripe-mirror|concat-mirror|mirror-concat|mirror-stripe]

stripe-mirror = layered volume
concat-mirror = layered volume
mirror-concat = non-layered volume
mirror-stripe = non-layered volume

Mirror a simple volume vxassist mirror >disk>
vxassist -g remove mirror !disk01 - remove the disk01 mirror
Create a stripped volume
vxassist make layout=stripe

vxassist -g -o ordered make layout=stripe ncol=3

Create mirrored volume with log vxassist make layout=mirror, log nmirror=# nlog=#
Create a raid volume vxassist make layout=raid5
Remove a volume
vxedit –rf rm
vxassist -g remove volume

Note: you must disable the volume first

Initializing a volume vxvol init state [plex]state=clean,enable,active
Online Relayout
vxassist -g relayout layout=stripe ncol=2
vxassist -g relayout layout=stripe ncol=+1
vxassist -g relayout layout=stripe ncol=-1
vxassist -g relayout layout=stripe stripe=32k ncol=5
vxassist -g relayout layout=raid5 stripeunit=32k ncol3
vxassist -g convert layout=stripe-mirror

# Display the relayout operation
vxrelayout -g [status|reverse|start]
vxtask list

Starting a volume vxvol start
Start a disabled volume
vxrecover –sb

-s = start volume after recovery
-b = background the recovery task

Disable a volume vxvol -g stop
Evacuate a volume vxevac -g
Maintenance mode vxvol maint
Not clean vxmend mirror clean
No kernel state vxplex att
Extending a volume size vxresize
vxresize -g +100m - increase the volume by 100Mb
Shrinking a volume size vxresize
vxresize -g -100m - decrease the volume by 100Mb
add a DRL log to a volume vxassist addlog
remove a DRL log from a volume vxassist remove log
Extending log size vxvol set loglen = 2m
Detering volume size vxassit -g maxsize layout=mirror - the maximum size you can create a mirror
vxassist -g maxgrow - the maximum size the volume can grow too
Recover a volume
Vxmend fix clean

Change volumes permissions vxedit -g set owner= group= mode=

Plexs

Creating a plex vxmake plex sd =
Remove a plex vxplex –o rm dis
vxplex -g dis
vxedit -g -rf rm
Moving a plex vxplex mv
Copying a plex vxplex cp
Attaching a plex vxplex att
Detaching a plex vxplex det
Offlining a plex vxmend off vol01-02

Sub-disks

Creating sub-disk vxmake sd , offset, len
Removing sub-disk vxedit rm
Moving sub-disk vxsd mv
Associating with a plex vxmake plex sd=, …
i.e vxmake plex home-1 sd= disk02-01, disk02-00, disk02-02
Dissociating vxsd dis
Splitting vxsd –s split sd
Joining vxsd join
relocating a sub disk vxassist -g move !disk05 disk02
relocating a whole disk sub disks
vxprint -g rootdg -se 'sd_orig_dmname="disk02"'
vxunreloc -g rootdg disk02


Volume Manager Information

Disks
Display all the physical disks
vxdisk list
vxdisk -o alldgs list

Display detailed disk info vxdisk list
Check for disk failures vxstat –g –ff –d
Disk Group
Display group properties vxdg list
Display detailed group info vxdg list
vxinfo -p -g
Volume
Display volume info vxprint –Aht
Display volume properties vxprint –vl
Display unstartable volume vxinfo -g
Check for volume failures vxstat –g –ff -v
Plex
Display plex properties vxprint –vp
Check for plex failures vxstat –g –ff -p
Sub-Disks
Display sub-disk properties vxprint –st
Veritas Tasks
Display tasks
vxtask list
vxtask monitor - continuously monitor

States:
r = running
p = pause
a = aborting

Statistics and Tracing
Iostats vxstat -g -r –d - reset all stats on disk
vxstat -g -d - display stats
vxstat -g -i 1 -d - display stats every 1 sec intervals for volume
vxstat -g -i 10 -c 5 -d - display 5 sets @ 10 secs intervals
Tracing vxtrace -d -o dev,disk
vxtrace -f -o dev,disk | more
Licensing

Add vxlicinst - versions greater than 3.5
vxlicense -c - versions below 3.5
View vxlicrep - versions greater than 3.5
vxlicense -p - versions below 3.5
Paths
/etc/vx/licenses/lic - versions greater than 3.5
/etc/vx/elm - versions below 3.5

Reload new license vxdctl license init
VEA

Start/Stop /etc/init.d/isisd [start|stop|restart]
Status
vxsvcctrl status
vxsvc [-m|-k|-v]

-m = status
-k = kill
-v = version

Daemons /opt/VRTSob/bin/vxsvc
/opt/VRTSob/bin/vxsvcctrl
Start VEA GUI
/opt/VRTSob/bin/vea

You must have X-windows running

Logging

Logging help in recovery and can speed it up dramatically, the main form of logging in veritas is the DRL (dirty region log) which performs the following

log keeps track of changed regions
if system fails only the changed regions of the volume are recovered
Add vxassist -g addlog logtype=drl
vxassist -g addlog - used for raid logs (no type)
Remove vxassist -g remove log [nlog=n]
Volume Read Policy

Policies can be used if you have slower disks within a volume and you wish to use the faster disks.

Round Robin vxvol -g rdpol round
Preffered Plex vxvol -g rdpol prefer
Selected Plex vxvol -g rdpol select
Storage Expert (vxse)

Veritas have created some scripots that can check the integrity of the vxvm setup i.e mirrored volumes, spares, etc. The scripts are based on rules and there are a number of differents rules veritas has set, look in the rules directory to see all of them.

Display Description vxse_raid5log1 info
Check rules vxse_raid5log1 -g check
List spare rules vxse_spares list
Run spare run
vxse_spares run

Note: you need to run "/etc/init.d/isisd start" to start the necessary daemons first

VXSE Paths
Rules /opt/VRTS/vxse/vxvm
Default Parameters /etc/default/vxse

No comments: