Thursday, December 16, 2010

ZFS in Solaris 10

Features:
•    256 quadrillion zettabytes
•    RAID 0/1 & RAID Z (RAID 5 with enhancements) (2 required virtual devices)
•    Snapshots – read-only copies of file systems or volumes
•    Creates volumes
•    Uses storage pools to manage storage – aggregates virtual devices
•    File systems attached to pools grow dynamically as storage is added
•    File systems may span multiple physical disks
•    ZFS is transactional
•    Pools & file systems are auto-mounted. No need to maintain /etc/vfstab
•    Supports file system hierarchies: /pool1/{home(5GB),var(10GB),etc.}
•    Supports reservation of storage: /pool1/{home(10GB),var}
•    Provides a secure web-based management tool
•    Requires devices of min size 128mb
•    Web GUI - https://localhost:6789/zfs - served by smcwebserver




### Storage Pool ###

Commands:

1. To list the known pools :
# zpool list

2. To create a pool using a disk :
# zpool create pool1 c0t1d0s2

3. To  add a disk to an existing pool :
# zpool add pool1 /dev/dsk/c1t2d2

4. To list pools and the associated mount points :
# zfs mount 

5. To show the virtual devices that constitues all the pools :
# zpool status

6. To show the virtual devices associated with pool1 :
# zpool status –v pool1

7.To destroy a pool and its associated file systems :
# zpool destroy pool1

8. To change the mount point of a pool :

# zfs set mountpoint=/firstpool pool1



### File System ###

Commands :
 
1. To create ‘home’ file system in pool1 :
# zfs create pool1/home          

2. To set 10G quota to pool1/home :
# zfs set quota=10G pool1/home       

3. To create a file system under pool1/home :
# zfs create pool1/home/unixcbt       

4. To list quota related values for pool1 and its file systems :
# zfs get –r quota pool1           

5.  To list compression property for file systems associated with pool1 :
# zfs get –r compression pool1       

6. To rename a file system :
# zfs rename pool1/home1 pool1/home2



### ZFS Redundany/Replication ###

1.    Mirroring – RAID-1
2.    RAID-Z    - RAID-5

Note: Redundancy/Replication is associated with the pool

Commands :

1. To create a mirror pool :
# zpool create pool1 mirror c0t1d0 c0t2d0    Creates a mirror pool

2. To create a RAID-Z pool :

# zpool create pool2 raidz c0t1d0 c0t2d



### ZFS Snapshots ###

1.    Read only copies of volumes or file systems
2.    Use no additional space, initially

Commands :

1. To list the available snapshots :
# zfs list –t snapshot      

2. To create a snapshot for pool1/home :
# zfs snapshot pool1/home@homesnap1   

3.To destroy a snapshot :
# zfs destroy pool1/home@homesnap1  

4. To rename homesnap2 to homesnap3 :
# zfs rename pool1/home@homesnap2 pool1/home@homesnap3

5.  To rollback a file system using a snapshot :
# zfs rollback –f pool1/home@homesnap3   


### ZFS Clone ###

1.    Writable file systems or volumes
2.    Linked to a snapshot
3.    Clone can be stored anywhere in ZFS hierarchy

Commands :

1. Creates a clone file system using a snapshot :
# zfs clone pool1/home@homesnap3 pool2/home

Zones in Sun Servers

Features:
  • Virtualization
  • Solaris Zones can hosts only instances of Solaris. Not other OS
  • Limit 8192 zones per Solaris host
  • Primary (global) zone has access to ALL zones
  • Non-global zones, do NOT have access to other non-global zones
  • Default non-global zones derive packages from global zone
  • Program isolation – zone1 (Apache), zone2 (MySQL)
  • Provides ‘z’ commands to manage zones
  • At least 100mb required for the creation of non-global zone
  • Type:
    1. Sparse Root Zones – Share key files (/usr, /lib) with global zone. Default zone type.
    2. Whole Root Zones – Require more storage

### Global Zones ###
  1. Solaris ALWAYS boots to the global zone
  2. Knows about ALL hardware devices attached to the system
  3. Knows about ALL non-global zones

### Non-Global Zones ###
  1. Installed at a location on the file system of the Global zone ‘zone root path’ - /export/home/zones/{zone1,zone2,zone3,…}
  2. Share packages with the global zone
  3. Manage distinct hostname and tables files
  4. Cannot communicate with other non-global zones by default. Use standard tcpip
  5. GLOBAL zone admin can delegate non-global zone administration
  6. Requirements: hostname, zone rootpath, IP address,

### Zone Configuration ###

Commands:
zonename      Lists current zone name
zonecfg         Configure zones. Can run interactively, non-interactively, command-file modes
zlogin            To open the console fo zones
zoneadm       To administrate the zones


Steps for configuring non-global zone:
1.       mkdir /export/home/zones/testzone1 && chmod 700 /export/home/zones
2.       zonecfg –z testzone1
zonecfg:testzone1> create
zonecfg:testzone1> set zonepath=/export/home/sonez/testzone1
zonecfg:testzone1> add net
zonecfg:testzone1:net> set address=192.168.1.60
zonecfg:testzone1:net> set physical=e1000g0
zonecfg:testzone1:net> end
zonecfg:testzone1> info
zonecfg:testzone1> set autoboot=true    (OPTION)
zonecfg:testzone1> add attr                     (OPTION)
zonecfg:testzone1:attr> set name=comment
zonecfg:testzone1:attr> set type=string
zonecfg:testzone1:attr> set value=”TestZone1”
zonecfg:testzone1:attr> end
zonecfg:testzone1> verify
zonecfg:testzone1> commit
zonecfg:testzone1> exit

Other Commands:

1. To show details of a zone :
# zonecfg –x testzone1 info    

2. To install a zone :
# zoneadm –z testzone1 install

3. To view the state of the zones :  
# zoneadm list –iv

4. ReBoot the non-global zone :  
# zoneadm –x testzone1 boot|reboot

5. Login to console mode :
# zlogin –C testzone1

6. Login Interactively :                    
# zlogin –l username zonename

7. Login Non-Interactive :               
# zlogin options zonename

8. Safe mode Login : 
# zlogin –S zonename

NTP in Solaris

Configuration File :

/etc/inet/ntp.conf
server 192.168.2.1 version 3
server 192.168.2.2 version 3

Daemon :
/usr/lib/inet/xntpd - Normally called as xntpd

Commands :
1. To start ntp service :
# svcadm enable network/ntp

2. To stop ntp service :
# svcadm disable network/ntp

3. To synchronize date and time from another system :
# rdate server_name

NFS in Solaris

Configuration Files (along with a sampel content):

/etc/dfs/dfstab
       share -F nfs -o rw /data
       share -F nfs -o ro=-client1:.max.com /export/share/man

/etc/default/fs        -  Lists the default file system type for local file systems
/etc/dfs/fstypes      -  Lists the default file system types for remote file systems
/etc/default/nfs       -  Lists the lockd and nfsd configuration details

/etc/default/nfslogd - Lists the nfslogd configuration details
/etc/mnttab            -  Lists the file systems currently mounted
/etc/rmtab              - Lists the filesystems (shares) currently mounted by the clients

Daemons :

automountd - Used by Autofs
lockd          - Used for file locking purposes
mountd       - Handles mount requests from the clients
nfsd            - Main NFS server daemon which handled the client requets
nfslogd       - Handles operational logging

Commands:

1. To share all the filesystems as defined in /etc/dfs/dfstab file
# shareall

2. To view the currently shared filesystems :
# share

3. To start the NFS server services :
# svcadm enable network/nfs/server

4. To mount a share as read only in a nfs client :

# mount -F nfs -o ro server10:/oracle /data/oracle

5. To start auto fs :
# svcadm enable system/filesystem/autofs

6. To check if NFS server service is running on the server :
# svcs network/nfs/server

7. To check nfs services on a server from a client machine :
# rpcinfo -s nfsserver| egrep 'nfs|mountd'

8. To list the file systems shared by a server from a client machine :
# showmount -e servername
# dfshares servername

9. To list the shares currently mounted by the clients :
# dfmounts

System Dump (Crash) Management in Solaris

dumpadm

User and Group Administration in Solaris

Configuration Files (and their contents) :

/etc/passwd :
UserName:x:UID:GID:comment:home_directory:login_shell

/etc/shadow :
UserName:password:lastchg:min:max:warn:inactive:expire:

/etc/group :
GroupName:group-password:GID:Username-list

/etc/default/password :

MAXWEEKS=
MINWEEKS=
PASSLENGTH=6
#MINDIFF=3
#MINALPHA=2
#MINNONALPHA=1
#MINUPPER=0
#MINLOWER=0
#MAXREPEATS=0
#MINSPECIAL=0
#MINDIGIT=0
#WHITESPACE=YES

/etc/security/policy.conf :
#LOCK_AFTER_RETRIES=NO

System-Wide Initialization Files:
Korn Shell     : /etc/profile
Bourne Shell  : /etc/profile
Bash Shell      : /etc/profile
C Shell          : /etc/.login

User Initialization Files:
Korn Shell     : $HOME/.profile, $HOME/.kshrc
Bourne Shell  : $HOME/.profile
Bash Shell      : $HOME/.profile
C Shell           : $HOME/.cshrc, $HOME/.login

Skeleton(Template) files for User Intialization Files :
Korn Shell     : /etc/skel/local.profile
Bourne Shell  : /etc/skel/local.profile
Bash Shell      : /etc/skel/local.profile
C Shell           : /etc/skel/local.cshrc and /etc/skel/local.login


Commands :

1. To add a user : (user any of the below commands)
# useradd -u 102 -g dba -d /export/home/jack -m -s /bin/bash -c "Jack Smith" jack

# smuser add -- -n jack -u 102 -g dba -d /export/home/jack -s /bin/bash -c "Jack Smith" -x

2. To modify a user's shell:
# usermod -s /bin/ksh jack

3. To modify a user's login name:
# usermod -l jsmith jack
# smuser modify -- -n jack -N jsmith

4. To delete a user :
# userdel jsmith
# smuser delete -- -n jack

5. To delete a user along with his/her home directory:
# userdel -r jsmith

6. To create a group :
# groupadd -g 402 dba
# smgroup add -- -n dba -g 402  -m jack

7. To modify a group's property :
# groupmod -g 410 dba
# smgroup modify -- -n dba -g 410

8. To delete a group :
# groupdel dba
# smgroup delete -- -n dba

9. To list all the users :
# listusers

10. To list the currently logged in users :
# who

11. To list last login report :
# last

12. To list all the users logged in the local and remote hosts :
# rusers -l

13. To display user information :
# finger jack

14. To record failed logins :
# touch /var/adm/loginlog
# chown root.sys /var/adm/loginlog
# chmod 600 /var/adm/loginlog


15. To prohibit a user from using ftp.

Add him in /etc/ftpd/ftpusers file.

16. To enable password-less login from remote servers :
Add the hsotname and username in the below format to /etc/hosts.equiv or $HOME/.rhosts file

hostname
hostname username
+

17. To list the groups the current user belongs to :
# groups

18. To list the groups an user belongs to :
# groups jack

19. To list the uid, gid of the current user :
# id

20. To display the uid and Primary gid of a user :
# id jack

21. To display the uid and Primary as well as secondary gids of a user :
# id -a jack

Managing Services in Solaris

This post is mainly based on SMF facility in Solaris 10. But also contains few commands for older versions.

Points to remember about run levels / milestones :

Runlevels are used in Solaris 9 to describe the set of services. "who -r" tells you which level you're in.

Starting from Solaris version 10, runlevels are replaced by milestones.

Run Levels in Solaris 8/9 :
S : Single user state (useful for recovery)
0 : Access Sun Firmware ( ok> prompt)
1 : System administrator mode
2 : Multi-user w/o NFS
3 : Multi-user with NFS
4 : Unused
5 : Completely shutdown the host (like performing a power-off @ OBP) [ thanks to Marco
6 : Reboot but depend upon initdefault entry in /etc/inittab

Different milestones in Solaris 10 :
single-user           : Single User Mode
multi-user             : Multi-User with/o NFS
multi-user-server  : Multi-User with/o NFS
all                        :  Starts all the services
none                    :  Doe not start any services. Normally used for troubleshooting purposes.

Different states of services in SMF:
online                 : Service instance enabled and running.
offline                 : Service instance enabled, but not running due to some fault.
disabled             : Service instace is disabled and not running.
maintenance       : Service instance encountered an error, troubleshooting is required.
legacy_run         : Legacy service (controlled by /etc/rcx.net scripts).
                            SMF can only monitor this service, but  can't control it.
degraded           : Service instance enabled but running at limited capacity.
uninitialized        : This is the initial stat for all services before their configuration has been read.

Commands :

1. To list all the services and their status :
# svcs -a

2. To stop SSH service :
# svcadm disable -t network/ssh:default      <--- Solaris 10
# /etc/init.d/sshd stop                      <--- Solaris 9

3. To start SSH service :
# svcadm enable -t network/ssh:default       <--- Solaris 10

# /etc/init.d/sshd start                    <--- Solaris 9

4. To refresh SSH service :

# svcadm refresh -t network/ssh:default      <--- Solaris 10

# ps -ef | grep ssh
# kill -HUP pid                            
<--- Solaris 9 

5. To restart SSH service :

# svcadm restart -t network/ssh:default     <--- Solaris 10

# /etc/init.d/sshd stop                  
# /etc/init.d/sshd start                    <--- Solaris 9 

6. To find out what went wrong or the reason behind a service shutdown :
# svcs -x

7. To find out the dependents of a failed service :
# svcs -x -v

8. To find out the status and PID of a service :
# svcs -p network/smtp:sendmail

9. To find out the dependent services :
# svcs -d milestone/multi-user:default

10. To show on what service, the current service depends on :
# svcs -D network/smtp:sendmail

11. To view the detailed status of a service :
# svcs -v network/smtp:sendmail

12. To view the details of a service :
# svcs -l network/smtp:sendmail

13. To list all the internet services :
# inetadm

Note:
/etc/inet/inetd.conf is not used in Solaris 10.

14. To enable a internet service :
# inetadm -e network/telnet

15. To disable a internet service :
# inetadm -d network/telnet

16. To show the details of telnet service :
# inetadm -l network/telnet

17. To modify a property of ftp service :
# inetadm -m network/ftp exec="/usr/sbin/in.ftpd -l"


18. To change the default milestone (run level) :
# svcadm milestone -d milestone/single-user:default
In solaris 9, you have to change it in /etc/inittab.

19. To go to a milestone (run level) :

# svcadm milestone milestone/single-user:default

In solaris 9, # init 1

20. To boot a machine in single user mode from OK prompt :
ok> boot -m milestone=single-user

21. To boot a machine in multi user mode from OK prompt :
ok> boot -m milestone=multi-user

22. To restore SMF repository :
# /lib/svc/bin/restore_repository

23. Daemon that controls SMF :
While booting the system, svc.startd gets started via /etc/inittab and it starts the services based on the milestone selected.

Wednesday, December 15, 2010

Managing HBA adapter in Sun Servers


How to view the HBA controllers ?

You can use any of the below commands

# /usr/sbin/lpfc/lputil
# vxdmpadm listctlr all
# cfgadm -al

How to reset a HBA ?

Method 1:
# /usr/sbin/hbanyware/hbacmd Reset 10:01:00:00:bc:c9:3b:ca

Method 2:
# /usr/sbin/lputil/lputil
LightPulse Common Utility for Solaris/SPARC. Version 2.0a5 (4/7/2005).
Copyright (c) 2005, Emulex Corporation

Emulex Fibre Channel Host Adapters Detected: 3
Host Adapter 0 (lpfc3) is an LP9802 (Ready Mode)
Host Adapter 1 (lpfc4) is an LP9802 (Ready Mode)
Host Adapter 2 (lpfc5) is an LP9802 (Ready Mode)

MAIN MENU

1. List Adapters
2. Adapter Information
3. Firmware Maintenance
4. Reset Adapter
5. Persistent Bindings

0. Exit

Enter choice => 4
0. lpfc3
1. lpfc4
2. lpfc5

Select an adapter => 0

MAIN MENU

1. List Adapters
2. Adapter Information
3. Firmware Maintenance
4. Reset Adapter
5. Persistent Bindings

0. Exit

Enter choice => 0

Once the adaptor is reset, you should see a message similar to the following in the system logfile:

lpfc: [ID 728700 kern.warning] WARNING: lpfc3:1303:LKe:Link Up Event x1 received Data: x1 x0 x8 x14

Emulex makes a killer HBA, and provides several awesome software utilities to manage host side SAN connectivity.


Some Commands :

1. To view ports :
# luxadm -e port
# cfgadm -o show_FCP_dev -al

2. To view detailed information of a LUN :
# luxadm diplay /dev/rdsk/c2t2d12s2

3. To scan for new luns in a HBA :
# luxadm -e forcelip /devices/pci@8,700000/SUNW,qlc@2/fp@0,0:devctl

4. To show all devices :
# luxadm probe

5. To display all the HBA:
# fcinfo hba-port

6. To display WWN for each HBA
# /usr/sbin/lpfc/lputil listhbas

7. To list info about HBA :
# prtpicl -v -c scsi-fcp
# prtpicl -v -c scsi-fcp | grep port-wwn
# prtpicl -v -c scsi-fcp | grep devfs-path

8.  To see if the Qlogic driver is loaded :
# modinfo | grep qlc

9. To see if QLogic driver is configured to load on boot :
# grep qlc /etc/system
forceload: drv/qlc

10. To see the number of HBA instances/devices :
# prtdiag -v | grep qlc

Device Management in Solaris

Associated Directories:

/dev - Contains logical device files
/devices - Contains physical device files

Commands :

1. To clean up the files for non-existent devices :
# devfsadm -C

2. To clean up the files for non-existent tape drive devices with detailed output :
# devfsadm -C -c tape -v

3. To scan for new devices :
# devfsadm

4. To scan for new disk drive :
# devfsadm -c disk

5. How to do a reconfigure reboot for connecting a new device :

Option 1:
# touch /reconfigure
# sync;sync;sync
# shutdown -y -i 0
# connect the new devce
# Boot the server

Option 2:
# shutdown -i -i 0
# Connect the new device
# "boot -r" from OK prompt

Option 3:
# reboot -- -r

System Information in Solaris

1. To view the timezone:

 # grep '^TZ' /etc/TIMEZONE

2. To change the timezone :

a. Check for the available timezones :
# cat /usr/share/lib/zoneinfo

b. Set the timezone by modifying the TZ= line in /etc/TIMEZONE file

c. Reboot the machine :
# shutdown -y -i 0

3. To display processor information :
# psrinfo -v

4. To enable a processor of id 0 :
# psradm -f 0

5. To enable it :
# psradm -n 0

6. To display RAM size :
# prtconf | grep Memory

7. To display processor bits :
# isainfo -bv

8. To display kernel bits :
# isainfo -kv

9. To determine the current boot device :

a. Find the boot path of the device
# prtconf -vp | grep bootpath
bootpath: '/pci@1f,700000/scsi@2/disk@0,0:a'

b. Find the device name using the boot path (replace 'disk' with 'sd')
# ls -l /dev/dsk | grep "/pci@1f,700000/scsi@2/sd@0,0:a"
lrwxrwxrwx 1 root root 43 Dec 13 2006 c1t1d0s0 -> ../../devices/pci@1f,700000/scsi@2/sd@0,0:a

10. To display the values of environment values :
# env

11. To find the architecture of the server
# arch -k

returns sun4u in Ultra 5 System and sun4m in SPARC system.

12. To display general system information :
# showrev -a

13. To display host id :
# hostid

14. To display the solaris release version details :
# cat /etc/release

15. To display system name and model :
# prtconf -b

16. To display system name, model, prom version :
# prtconf -vb

17. To dispaly the currently installed locales :
# localeadm -l

18. To determine if a locale is installed in the system :
# localeadm -q ja

19. To install a locale :
# localeadm -a ja -d /mnt/install/latest/Solaris/Product

20. To remove an installed locale :
# localeadm -r ja

Network Configuration in Solaris

Configuration Files :

File containing the domain name:
/etc/defaultdomain

File containing the IP address of default router:
/etc/defaultrouter

File containing the name resolution order:
/etc/nsswitch.conf

File containing the ip address on hme0 interface :
/etc/hostname.hme0

To set DNS server and search order :
/etc/resolv.conf

To set hostname :
/etc/nodename

File containing the IP Address to hostname mapping :
/etc/inet/hosts

File containing network services and their corresponding port numbers :
/etc/inet/services

File containing the subnet mask:
/etc/inet/netmask

Create the below file to prevent the startup of in.routed daemon :
/etc/notrouter

Internet Super Daemon Configuration File:
/etc/inet/inetd.conf

Commands :

1.. To show link status of a network adapter :
 
a. To show link status on ce1
# kstat ce:1 | grep link

        link_asmpause             0
        link_duplex                  2 
        link_pause                   0
        link_speed                  100
        link_T4                        0
        link_up                        1

where link_duplex = 0 means link down
                                1 means half duplex
                                2 means full duplex

where link_speed=0 means link down
                             10 means 10MBPS
                             100 means 100MBPS
                             1000 means 1GBPS

For ce and bge interface, you should use kstat command to return NIC settings.
All other interfaces should use ndd  to determine NIC settings.

b. To how link status of hme0

# ndd -set /dev/hme instance 0
# ndd -get /dev/hme link_mode
# ndd -get /dev/hme link_speed

2. To set duplex and link speed of a network interface :

a. To set 100 full dupled on hme1 interface

# ndd -set /dev/hme instance 1
# ndd -set /dev/hme adv_100hdx_cap 0
# ndd -set /dev/hme adv_100fdx_cap 1
# ndd -set /dev/hme adv_autoneg_cap 0
# ndd -set /dev/hme link_speed 100

Then add the below lines to /etc/system

 set hme:hme_adv_autoneg_cap=0
 set hme:hme_adv_100hdx_cap=0
 set hme:hme_adv_100fdx_cap=1
 set hme:hme_link_speed=100

For ce interface,
Use the below command to set the current values and add these to a startup script.

DONT ADD THIS TO /etc/system as it would not work. !!!!

ndd -set /dev/ce instance 0
ndd -set /dev/ce adv_1000fdx_cap 0
ndd -set /dev/ce adv_1000hdx_cap 0
ndd -set /dev/ce adv_100fdx_cap 1
ndd -set /dev/ce adv_100hdx_cap 0
ndd -set /dev/ce adv_10fdx_cap 0
ndd -set /dev/ce adv_10hdx_cap 0
ndd -set /dev/ce adv_autoneg_cap 0

3. To set default router :

# route add default 192.168.1.1
Also add this into /etc/detaultrouter to make this permanent.

4. To remove the current default route :

# route delete default 192.168.1.1
Also remove it from /etc/defaultrouter to make this change permanent.

5.How to change the hostname?

a. Change the hostname in the file /etc/nodename to make this change permanent.
b. Use uname command to change the current value
# uname -S newname
c. Change the name in /etc/hosts
d. Chagne the name in DNS records
e. Change the hostname in /etc/hostname.networkinterface
f. Change the name in the files /etc/net/ticlts/hosts, /etc/net/ticots/hosts, /etc/net/ticotsord/hosts if applicable.
g. Change the name in /etc/inet/ipnodes (For solaris 10 only).
h. Please reboot the system to avoid any issues.

6. To disable a network interface :
# ifconfig hme1 unplumb

7. To enable it :
# ifconfig hme1 plumb

8. To down id :
# ifconfig hme1 down

9. To display network interface table :
# ifconfig -a
# netstat -i
# netstat -in

10. To set IP address on qfe0 network interface :
# ifconfig qfe0 191.133.23.10 netmask 255.255.255.0 up

Also set the ip label in /etc/hostname.qfe0, add hostname, IP mapping in /etc/hosts and add the netmasks into /etc/netmasks

11. To set IP alias on qfe0 :
ifconfig qfe0:1 191.133.23.10 netmask 255.255.255.0 up

Also set the ip label in /etc/hostname.qfe0:1, add hostname, IP mapping in /etc/hosts and add the netmasks into /etc/netmasks

12. To add static route to a network :

# route add -net 140.110.43.0 140.110.3.1

Also add this command to a startup script (normally located under /etc/rc2.d).

Patch Management in Solaris

Associated Directory :
/var/sadm/patch            Contains the list of applied patches

Commands :

1. To install a patch :
# patchadd 123456-78   

2. To find out if a patch has been already installed :
# showrev –p | grep 123456-78

3. To uninstall a patch :
# patchrm 123456-78

4. To display all patches applied to the system :
# patchadd –p

5. Installs the recommended patch cluster :
# install_cluster –q –nosave

Software (Package) Management in Solaris

Files involved:
/var/sadm/install/contents    - Contains the list of installed packages

Commands:

1. To install all packages available in the cdrom :
# pkgadd –d /cdrom/cdrom       

2. To install a specific package from the /mnt directory :
# pkgadd –d /mnt SUNWaudio   

3. To copy a package from the /mnt directory to spool :
# pkgadd –d /mnt –s SUNWaudio   

4. To list the contents of spool directory :
# pkginfo –d spooldir       

5. To find out the package “abc” in the installed package list :
# pkginfo | grep abc       

6. To list detailed info on an installed package :
# pkginfo –l SUNWcar       

7. To check the consistency of a package :
# pkgchk –v SUNWaudio       

8.To find out which package a file belongs to :
# pkgchk -l -p /usr/bin/ls       

9. To uninstall a package :
# pkgrm SUNWaudio       

10.Removes a package from a spool directory :
# pkgrm –s spooldir SUNWcar

Open Boot PROM Commands in Sun Servers

1. To display all the current device aliases :
ok> devalias

2. To define an alias ofr a device path :
ok> devalias alias device-path

3. To delete an alias from NVRAMRC :
ok> nvunalias alias           

4. To list the available disks :
ok> show-disks

5. To boot from default boot device :
ok> boot       

6. To boot from cdrom :
ok> boot cdrom   

7. To boot from the alia "disk" :
ok> boot disk           

8. To boot from network :
ok> boot net       

9. To start jumpstart boot :
ok> boot net – install

10. To do an interactive boot from the default boot device :
ok> boot –a   

11. To do a reconfigure boot from the default boot device :
ok> boot –r       

12. To boot from 32bit kernel :
ok> boot kernel/unix   

13. To boot from 64bit kernerl :
ok> boot kernel/sparcv9/unix   

14. To do a verbose boot :
ok> boot –v    

15. To boot in single user mode :
ok> boot –s   

15. To diplay OBP verion :
ok> .version       

16. To display ethernet address :
ok> .enet-addr       

17. To diplay poweron banner :
ok> banner               

18. To display processor and bus speeds :
ok> .speed               

19. To display major/minor CPU firmware version :
ok> firmware-version           

20. To call OS to write information to harddisk :
ok> sync               

Normally we do it thrice. ie., sync;sync;sync

21. To reset entire system :
ok> reset       

22. To reset entire system :       
ok> reset-all       

23. To reset all PROM setting to factory default :
ok> set-defaults           

24. To set PROM password :
ok> setenv security –password password

25. To set autoboot :
ok> setenv auto-boot? true       

26. To display the current boot-device :
ok> printenv boot-device       

27. To identify devices attached to a SCSI bus :
ok> probe-scsi           

28. To identify devices attached to all SCSI buses :
ok> probe-scsi-all           

29. To test the primary network adapter :
ok> test net               

30. To test the primary scsi adapter :
ok> test scsi               

31. To test all devices available with self test capability :
ok> test-all               

Encapsulation and Rootability

Encapsulation :

Solaris :

Encapsulation is the process of converting partitions into volumes to bring those partitions under VxVM control. Only sliced layout is allowed on encapsulated disk. Boot disk can not be in cds layout.
You can not use stripe, Raid-5, concat-mirror or strip-mirror layouts for root disks. Also do not use DRL on system volumes except in opt and var.

You should use the menu based tool vxdiskadm tool to "Encapsulate one or more disks".

Partition table of an encapsulated disk :
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -  2060       10.00GB    (2061/0/0)   20972736
  1       swap    wu    2063 -  5358       15.99GB    (3296/0/0)   33540096
  2     backup    wm       0 - 14086       68.35GB    (14087/0/0) 143349312
  3        usr    wm    5359 -  8450       15.00GB    (3092/0/0)   31464192
  4 unassigned    wm    8451 - 10511       10.00GB    (2061/0/0)   20972736
  5          -    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
  6        var    wm   12161 - 14086        9.35GB    (1926/0/0)   19598976
  7          -    wu    2061 -  2062        9.94MB    (2/0/0)         20352

Mappping of Volumes and slices in an encapsulated disk :

root slice -> rootvol
usr slice ->  usr
var slice -> var
swap slice -> swapvol


HP-UX :

Conversion is the process of enabling LVM PVs to be used by VxVM.
You can convert unused physical volumes and PVs in the Volume groups.

Following are limitations of LVM conversion :
a. A VG containing /, /usr, dump or primary swap volumes
b. A VG with insufficient space for metadata
c. Disk usedused by Service Guard cluster
d. Disk containing bad blocks

To convert unused PVs :

1. Check for any LVs in the PV. There should not be any data on the PV
# pvdisplay /dev/dsk/c1t0d0

2. Remove the LVM disk information.
# pvremove /dev/dsk/c1t0d0

3. Put the disk into VxVM control
# vxdisksetup c1t0d0

To convert volume Groups :
1. You can use vxvmconvert utility.

Volume requirements :
1. All volumes on the root disk must be in the disk group that you  choose to be the bootdg disk group.
2. The names of the volumes with entries in the LIF LABEL record must be standvol, rootvol, wapvol and dumpvol. The names of the volumes for other file systems on the rootdg are  generated by appending vol to the name of their mount point under /.
3. Any volume with an entry in the LIF LABEL record must be contiguou. It can have only one subdisk and it cannot span multiple disks.
4. The rootvol and swapvol must have the special  volume usage types root and swap respectively.
5. Disk layout should be hpdisk and you should not use DRL on the rootdg volumes


Rootability :
It is the proces of putting the root file system, swap and other file systems (/usr,..) on the boot disk under VxVM control.

Limitations of VxVM Boot disk :
1. You have to perform additional steps during OS upgrades on Solaris machines.
2. You should not grow or change the layout of boot disk volumes as the volumes are mapped to the underlying partition (slice).

Solaris :
Include rotdisk and rootmirror in the bootlist using eeprom.

HP-UX :
Set primary or alternative boot path from the boot menu or from the command line.
Main Menu -> co pa alt path
setboot - p primary_path -a alternative_path


Creation of Alternate Boot Disk:

Solaris:
1. Mirror root volume only
# vxrootmir alternate_disk

2. Mirror other volumes
# vxmirror -g rootdg boot_dik alternate_disk

3. Setup boot information
# vxbootsetup

HP-UX :
1. Mirror the root volume :
# vxrootmir -v -b alternate_disk

2. To mirror individual volumes manually :
# vxdisksetup -iB c0t1d0 format=hpdisk
# vxdg -g rootdg adddisk rootdisk02=c0t1d0
# vxassist -g bootdg mirror standvol dm:rootdisk02

3. Create the boot information on the alternative disk
# vxvmboot -v /dev/rdsk/c0t1d0


To boot from alternative disk in Solaris :

1. Set the eeprom variable use-nvramrc?
ok> setenv use-nvramrc? true
ok> reset

2.  Check for available boot disk aliases
ok> devalias
rootdisk
rootmirror

3. Boot from the alternate boot dik
ok> boot rootmirror

To boot from alternative disk in HP-UX :

1. Interrupt the boot process by pressing any key within 10 seconds of seeing the first message in the console.

2. In the main menu, check forthe alternate boot path
co alt path

3. If the alternate path is found, you can boot from it.
bo alt

Tuesday, December 14, 2010

Hot Relocation - VxVM

Points to Remember:




Commands:
1. To set datadg01 disk as spare disk in datadg :
 # vxedit -g datadg set spare=on datadg01

2. To unset datadg01 disk as spare disk in datadg :
# vxedit -g datadg set spare=off datadg01

3. To exclude datadg01 disk for hot relocation :
# vxdit -g datadg set nohotuse=on datadg01

4. To include datadg01 disk for hot relocation :
# vxdit -g datadg set nohotuse=off datadg01

5. To force hot relocation to use only pare disks :

Add the below line into /etc/default/vxassist

spare=only

File System Administration - VxVM - VxFS

This post is common to Solaris, HP-UX, Linux and AIX Operating Systems.

How to create the VxFS Filesystem ?

On Solaris :

To create and mount a VxFS filesystem :
# mkfs -F vxfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount -F vxfs /dev/vx/dsk/datadg/datavol /data

To create and mount a UFS filesystem :
# newfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount /dev/vx/dsk/datadg/datavol /data

On Linux :
To create and mount a VxFS filesystem :
# mkfs -t vxfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount -t vxfs /dev/vx/dsk/datadg/datavol /data

On HP-UX :
To create and mount a VxFS filesystem :
# mkfs -F vxfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount -F vxfs /dev/vx/dsk/datadg/datavol /data

To create and mount a HFS filesystem :
# newfs -F hfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount -F hfs /dev/vx/dsk/datadg/datavol /data

On AIX :
To create and mount a VxFS filesystem :
# mkfs -V vxfs /dev/vx/rdsk/datadg/datavol
# mkdir /data
# mount -V vxfs /dev/vx/dsk/datadg/datavol /data

To create and mount a VxFS filesystem using crfs :
# crfs -v vxfs -d /dev/vx/rdsk/datadg/datavol -m /data -A yes
# mount /data

To create and mount a jfs2 filesystem using crfs :
# crfs -v jfs2 -d /dev/vx/rdsk/datadg/datavol -m /data -A yes
# mount /data

Note:
You have to add the filsystem details to the OS Filesystem table (/etc/fstab or /etc/vfstab) in solaris, HP and Linux. If you use crfs, filesystem table will be updated automatically in AIX.

Additional Commands :

1. To create a VxFS filesystem in solaris with nolargefiles and block size of 2048 :
# mkfs -F vxfs -o nolargefiles -o bize=2048 /dev/vx/rdsk/datadg/datavol

Note: By default, largefiles flag i enabled and the default block size is 1024.

2. To create a VxFS filesystem of version 4 in solaris :
# mkfs -F vxfs -o version=4 /dev/vx/rdsk/datadg/datavol

Note:  Default VxFS filesystem version is 6 in VxFS 4.1

3. To upgrade the file system layout version :
# vxupgrade -n 5 /data

Note: You must upgrade in stages only. ie., from version 4 to 5, and then version 5 to 6.

4. To display the current file system layout version :
# vxupgrade /data

5. To monitor directory fragramentation on a file system :
# fsadm -D /data


6. To monitor extent fragramentation on a file system :
# fsadm -E /data

7.  To do directory fragramentation on a file system :
# fsadm -d -D /data

8.  To do extent fragramentation on a file system :
# fsadm -e -E -s /data

9. To check full file system consistency using intent log :
# fsck -F vxfs -o full /dev/vx/rdsk/datadg/datavol


10. To check file system consistency with out using intent log :
# fsck -F vxfs -o nolog /dev/vx/rdsk/datadg/datavol

11. To check two file systems in parallel :
# fsck -F vxfs -o p /dev/vx/rdsk/datadg/datavol /dev/vx/rdsk/datadg/dbvol

12. To display intent log information of a file system :
# fsadm -L /data

13. To change the log size :
# fsadm -F vxfs -o logsize=256m /data

Note:
a. Default intent log size depends on the file system size.
b. Minimum log size is 256 KB and maximum size is 256 MM.

14. To enable FCL (File Change Log) on a file system :
# fcladm on /data


15. To disable FCL on a file system :
# fcladm off /data

16. To remove FCL from a file system  (You must switch off FCL before removing it):
# fcladm rm /data

17. To display the current FCL state of a file system :
# fcladm state /data

Monday, December 13, 2010

Volume Management - VxVM

Points to Remember on Mirroring:


1. A volume name can contain upto 31 characters.
2. A volume can have upto 32 plexes or mirrors.
3. Each mirror must reside on separate disks
4. We can mirror only concatenated or striped volumes.

Here are few commands for your reference,


1. To create a 10GB volume in datadg :
# vxasist -g datadg make myvol 10g

2. To create a 10GB concatenated volume in datadg using disks datadg01 and datadg02 :
# vxasist -g datadg make myvol 10g datadg01 datadg02

3. To create a 3GB striped volume in datadg with 3 columns using any disk except datadg02 :
# vxasist -g datadg make myvol 3g layout=stripe ncol=3 !datadg02

4. To create a 3GB striped volume in datadg with 3 columns with ordered allocation on datadg06 (column 1), datadg05 (column 2) and datadg02: (column 3)

# vxasist -g datadg -o ordered make myvol 3g layout=stripe ncol=3 datadg06 datadg05 datadg02


5. To create a 2GB striped volume in datadg with 2 columns using disks datadg01 and datadg04 with stripe stize of 256k :

# vxassist -g datadg make myvol 2g layout=stripe ncol=2 stripeunit=256k datadg01 datadg04

6. To create a 3GB RAID5 volume in datadg :
# vxassist -g datadg make oravol 3g layout=raid5

7. To create a 2 mirror volume of size 1g in datadg :
# vxassist -g datadg make db2vol 1g layout=mirror

8. To create a 3 mirror volume of size 1g in datadg :
# vxassist -g datadg make db2vol 1g layout=mirror nmirror=3

9. To create a 2 mirror volume of size 1g in datadg mirrored across controllers :
# vxassist -g datadg make db2vol 1g layout=mirror mirror=ctlr

Note: You can mirror across controllers (ctlr), enclosures (enclr) and targets (target).

10. To create a 2 mirror volume of size 1g in datadg with dirty region logging ::
# vxassist -g datadg make db2vol 1g layout=mirror logtype=drt

11. To determine the largest posible size for a new volume in datadg :
# vxassist -g datadg maxsize layout=raid5

12. To determine how much an existing volume can grow :
# vxassist -d datadg maxgrow dbvol

13. To display volumes in datadg :
# vxprint -g datadg -vt

14. To add a mirror to an existing concatenated volume :
# vxassist -g datadg mirror datavol datadg01

15. To remove a mirror(plex from datadg02) from a volume :
# vxassist -g datadg remove mirror datavol !datadg02

16. To add a DRL log to an existing volume :
# vxassist -g datadg addlog datavol logtype=drl

17. To remove a DRL from an existing volume :
# vxassist -g datadg remove log datavol

18. To set read policy to round robin for an existing volume :
# vxvol -g datadg readpol round datavol

Note: round, prefer, select are the different types of read log policies.

19. To resize a dynamic LUN :
# vxdisk -g datadg resize datadg05 length=100GB

20. To relayout a concat volume to stripe,

# vxassist -g datadg relayout datavol layout=stripe stripeunit=32k ncol=2

21: To create a volume using a detached plex,

# vxmake -g datadg -U fsgen vol datavoltemp plex=datavol02

22. To start a volume on datadg,

# vxvol -g datadg start datavol

23. To stop a volume on datadg,

# vxvol -g datadg stop datavol

24. To start all the volumes on datadg,

# vxvol -g datadg startall

25. To stop all the volumes in datadg,

# vxvol -g datadg stopall

26. To remove a volume and its children (plexes and sub disks),
# vxedit -g datadg -rf rm datavol

27. To remove a volume,
# vxassist -g datadg remove volume datavol

28. To add log to an existing volume,

#  vxassist -g datadg addlog testvol nlog=1

29. To remove all the logs of a volume,
# vxassist -g testdg remove log testvol nlog=0

30. To move a volume between disks,
# vxassist -g testdg move testvol !disk01 disk02
where disk01 is the soruce disk and  disk02 is the target.

Installation and Licensing - VxVM and VxFS

Veritas Infrastructure Packages :
VRTXvlic    License Utilities
VRTScpi        Common product/platform installer
VRTSperl    Perl used by installation technology
VRTSjre        Java Runtime Environment Redistribution

VxVM Packages :   
VRTSvxvm    VxVM Binaries
VRTSalloc    VxVM Intelligent Storage Provisioning
VRTSvmdoc    VxVM Documentation
VRTSvmman    VxVM Manual Pages (Not for HP)

VEA Packages :
VRTSob        VEA Service
VRTSobgui    VEA GUI
VRTSbuob    VEA Service Localized Package for Solaris
VRTSvmpro    Disk Management services provider
VRTSfspro    Filesystem service provider
VRTSddlpr    Device Discover Layer servics provider
VRTSap        Veritas Action Provider
VRTStep        Veritas Tast Exec Provider

VxFS Packages :
VRTSvxfs    VxFS software and manuals
VRTSfsdoc    VxFS Documentation
VRTSfsman    VxFS Manual Pages

How to install the product ?

You can use any of the below scripts to install VxVM and VxFS products,

installer    - Installs multiple VERITAS products
installvm  - Installs VxVM
installfs    - Installs VxFS
installsf   - Installs Storage Foundation (VxVM and VxFS)

You can also use the below OS specific installation commands to install the packages but finally run "vxinstall" to do initial configuration.

Solaris   : pkgadd
HP-UX : swinstall
AIX      : installp
Linux    : rpm


Commands :
1. To add a license Key :
# vxlicinst

2. To view installed the license key :
# vxlicrep

3. Where are the license keys are stored :
/etc/vx//licenses/lic

4. Where are the VxVM commands located :
/etc/vx/bin
/usr/sbin
/usr/lib/vxvm/bin

Sunday, December 12, 2010

Disk Group Operations - VxVM

Points to remember :
a. You cannot add a disk to more than a disk group
b. Disk (device) names must be unique within a disk group
c. A DG can not be named as  bootdg, defaultdg and nodg. These are system-wide reserved disk group
names:
d. A DG name can contain upto 31 characters.

Commands:

1. To create a disk group :
# vxdg init datadg datadg-01=c2t1d0s2

2. To add a disk into an existing disk group :
# vxdg -g datadg adddisk datadg-01=c2t1d0s2

3. To remove a disk from a disk group :
# vxdg –g datadg rmdisk datadg-02

Note: You can not remove the last disk from a dg.

4. To deport a disk group:
# vxdg deport datadg

5. To deport a disk group and rename it :
# vxdg -n newdatadg deport datadg

6. To deport a disk group and specify a new host :
# vxdg -h server2 deport datadg

Note:
a. You need to unmount the filesystems and then stop all the volumes (in datadg) before deporting it.
b. A deported disk group can not be accessed until its imported in the system.

7. To import a disk group :
# vxdg import datadg

8. To import and rename a disk group
# vxdg -n newdatadg import datadg

9. To temporarily import a disk group :
# vxdg -t import datadg

10. To import and rename a disk group temporarily :
# vxdg -t -n newdatadg import datadg

11. To clear import logs while importing a disk group :
# vxdg -C import datadg


12. To destroy a disk group:
# vxdg destroy datadg

13. To list all the disk groups along with their state and id :
# vxdg list

14.  To list detailed info about a disk group :
# vxdg list datadg

15. To show free space in a disk group :
# vxdg -g datadg free

16. To show spare space pool in a disk group :
# vxdg -g datadg spare

17. To upgrade a disk group to version 120 :
# vxdg -T 120 upgrade datadg

18. To upgrade a disk group to the latest version :
# vxdg upgrade datadg

18. To list the current bootdg :
# vxdg bootdg

19. To change the bootdg :
# vxdctl bootdg rootdg

19. To list the current defaultdg :
# vxdg defaultdg

20. To change the defaultdg :
# vxdctl defaultdg datadg

21. To create a non-cds disk group :
# vxdg init datadg datadg-01=c2t1d0s2 cds=off

22. To switch off the cds flag on a dg (It should not contain any cds disk) :
# vxdg -g datadg set cds=off

Disk Operations - VxVM

Few Points to remember:

a. A regular disk can be converted into VM disk (process of bringing under the control of VXVM).

b. A VM Disk contains 2 regios - Private and Public.

c. Private region contains the disk header, configurations details disk group IDs,  Kernel logs and Host ID.

d. Public region contains the Sub Disks (actual data).

e. A VM disk has got 2 types of names

DMN [Disk Media Name] - This name is given while adding a disk into a DG.
DAN [Disk Access Name] - Its the operating system given name. For Ex, c1t0d0

f. A disk can be initialised in 3 type of format

cdsdisk - Cross-platform Data Sharing (CDS) disk suitable for moving between different operating systems. Its the default format if you don't mention the disk format while initializing a disk.
sliced - The public and private regions are on different disk partitions. Mostly used for solaris boot disks only.
simple - The public and private regions are located sequentially on the same disk area

Here are few commands I normally use to manage VM disks,

1. Initialize a disk (It is the process of bringing a disk under VXVM control):

# vxdisksetup -i c2t0d1 (Solaris and HP-UX)
# vxdisksetup -i hdisk11 (AIX)
# vxdisksetup -i sdb2 (Linux)


Note: You can also use vxdiskadm , a menu based tool.

2. To initialise a disk in a different format :
# vxdisksetup -i c1t1d0 format=cdsdisk
# vxdisksetup -i c1t1d0 format=sliced
# vxdisksetup -i c1t1d0 format=simple


3. To view basic information about all disks :
# vxdisk list
# vxdisk -o alldgs list  (This command shows even deported DG names)

4. To display detailed information about a disk :
# vxdisk -g datadg list datadg01

5. To display summary of all disks :
# vxdisk -s list

6. List disk header :
# vxdisk list datadg01
# vxdisk list c2t0d1s2

7. Evacuate data from one disk to another :
# vxevac -g datadg datadg01 datadg02

8.  Evacuate data from a disk to any disk but datadg08 in datadg :
# vxevac -g datadg datadg01 !datadg08

9. To rename datadg04 device(disk) to datadg05 :
# vxedit -g datadg rename datadg04 datadg05

Note: Renaming a disk does not automatically rename subdisks on the disk.

10. To assign a disk as spare in datadg :
# vxedit -g datadg set spare=on datadg04

11. To unrelocate a disk in datadg :
# vxunreloc -g datadg datadg02

12. To remove a disk from datadg :
# vxdg -g datadg rmdisk datadg02

13. To remove a disk from VxVM control :
# vxdiskunsetup -C datadg02