Professional Documents
Culture Documents
FS COMMANDS
lsfs Lists all filesystems in the /etc/filesystems entry
lsfs -q List all filesystems with detailed info
lsfs -a To list all filesystems (default)
lsfs -l Specify the output in list format
lsfs -c Specify the output in column format
lsfs -v jfs Lists all jfs filesystems
chfs -a size=24576 /si Change size of FS /si to 24576 x 512 bytes blocks (12 MB)
chfs -a size=+24576 /si Add 24576 x 512 byte blocks to FS /si
chfs -asize=-500M /file/system you can also decrease size
chfs -m /si /bi Change the mount point from /si to /bi
chfs -A /si To auto mount the filesystem si
chfs -d account /si Remove account attribute of /si. ( from /etc/filesystems file)
chfs -a splitcopy=/backup -a copy=2 /oracle This will mount the 2nd copy of mirrored filesystem oracle
to
/backup in read-only mode
crfs -v jfs -g testvg -a size=64465 -m /siju Creates FS /siju of type jfs in VG testvg of blocksize 64465
crfs -v jfs -d /dev/lv00 -m /siju Create FS /siju of type jfs on device /dev/lv00
rmfs /siju Deletes FS /siju and associated LV
rmfs -r /siju Deletes FS /siju its mount point and associated LV
defragfs /sifs To defragment the file system /sifs
defragfs -q /sifs Display the current defrag status of the file system
fsck -y n /dev/lv00 To fsck the filesystem associated to /dev/lv00 assuming response "yes"
fsck -p /dev/lv00 To restore superblock from backup superblock
PV COMMANDS
lspv hdisk0 Display status and characteristics of the PV
lspv -p hdisk0 Display PP usage of hdisk0
lspv -l hdisk0 To list all logical volumes on PV hdisk0
chpv -v r hdisk1 Close the PV (Used while removing PV without varyon)
chpv -v a hdisk1 Open the PV
chpv -c hdisk0 Clear the master boot record on PV hdisk0
migratepv hdisk1 hdisk2 To move PPs from PV hdisk1 to hdisk2
migratepv -l silv hdisk1 hdisk2 To migrate LV silv from PV hdisk1 to hdisk2
LV COMMANDS
lslv -l lv00 Display info about LV by PV
lslv -p hdisk1 Display LV allocation map for hdisk1
chlv -t copy lv00 To change the lv00 to copy type
chlv –n silv lv00 To rename lv00 to silv
chlv -x 950 ora1data_lv To change the ora1data_lv to <XXX to 950 PP>
chlv -p r lv00 To change the lv00 to readonly mode
rmlv silv To remove silv
rmlv -f silv To remove silv without user intervention
mklv -s n -c 3 silv hdisk1 To make LV silv with three copies on hdisk1
extendlv silv 5 To extend the LV silv with 5 LPs
mklvcopy -s n lvsi 2 hdisk1 To mirror LV lvsi on same PV with 2 copies
mklvcopy lvsi 3 hdisk1 hdisk2 To mirror LV lvsi on PV hdisk1 and hdisk2 with 3 copies
rmlvcopy lvsi 2 hdisk1 Will remove one copy of LV lsvi from hdisk1
mklv -t jfslog -y log00 newvg 2 To create a jfslog with name log00 on VG newvg with 2LPs
logform /dev/log00 To format jfslog volume log00
mklv/extendlv -a = PP alocation policy
-am = middle -ac = center -ae = edge
-aie = inner edge -aim = inner middle
migratepv -l (lv) (old pv) (new pv)
Move a logical volume between physical volumes. Both physical volumes
must be in the same volume group !
mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional)
Creates a JFSlog logical volume.
logform (/dev/lv) Initialises an LV for use as an JFSlog
getlvcb -AT (lv) Displays Logical Volume Control Block information
BLV COMMANDS
bootlist -m normal -o To see the boot sequence in normal mode
bootlist -m service -o To see the boot sequence in service mode
bootlist -m normal cd0 hdisk0 To change boot sequence to cd0,hdisk0 in normal mode
bootlist -m service cd0 rmt0 hdisk0 To change boot sequence to cd0,rmt0,hdisk0 in service mode
bosboot -ad /dev/hdisk1 To create boot image on PV hdisk1
mkboot -cd /dev/hdisk1 To clear the boot image
bootinfo -b Specifies the bootable disk
bootinfo - t Specifies the type of boot
bootinfo -e Check the machine can boot from tape
bootinfo -T To see the machine hardware type
bootinfo -s hdisk0 To see the size of hdisk0
bootinfo -r To see the size of memory
bootinfo –k To see the key position
bootinfo –m To see the machine model code
bootinfo –o hdisk0 To list the location code of hdisk0
bootinfo –z To see the machine is multiprocessor capable
bootinfo –p To see the machine
bosboot -a -d (/dev/pv) Creates a complete boot image on a physical volume.
mkboot -c -d (/dev/pv) Zero's out the boot records on the physical volume.
savebase -d (/dev/pv) Saves customised ODM info onto the boot device.
SYSTEM DUMP
--------------------------------------------------------------------------------
sysdumpdev -e Estimates dumpsize of the current system in bytes.
(MCA machine can also dump if key is in service position and the reset
button is pressed)
sysdumpdev -p (dump device) -P Sets the default dump device, permanently
Analyse dump file :-
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0
Backup commands
mksysb -i -X /dev/rmt0 Creates image.data and system backup (-X expands /tmp if required)
mksysb -m /dev/rmt0 Creates image.data file with map file and system backup
mksysb -e /dev/rmt0 Creates system data but excludes the files listed in /etc/exclude.rootvg
mkszfile Creates /image.data file
mkcd -d /dev/cd1 Creates system boot backup to the CD-R device /dev/cd1
mkcd -d /dev/cd1 -v vg00 Creates backup of vg vg00 to CD-R device /dev/cd1
mkcd -d /dev/cd1 -G Creates generic boot backup
savevg -i -f /dev/rmt0 vg00 Creates vg00.data image file and backup vg vg00
savevg -ef /dev/rmt0 vg00 Creates vg00 backup but excludes files listed in the
/etc/exclude.vg00
find / -print | backup -ivf /dev/rmt0 Backup entire system to rmt0
backup -0vf /dev/rmt0 /home Backup /home directory to rmt0 with backup level 0
restore -Tvf /dev/rmt0 List the archive in rmt0
restore -xvf /dev/rmt0 /home Restore /home from archive in device rmt0
find ./home -print |cpio -ocvumB > /dev/rmt0
Archives /home directory
cpio -icvdumB < /dev/rmt0 Restores cpio archive from rmt0
cpio -ivt < /dev/rmt0 List the contents of cpio archive from rmt0
cpio -icvd < /dev/rmt0 /home Restores /home directory from rmt0
tar -cvf /dev/rmt0 /home Archives /home to rmt0 device
tar -tvf /dev/rmt0 List the archives in rmt0
tar -xvf /dev/rmt0 /home Extract /home from rmt0
dd if=si of=si1 conv=ebcdic Convert and copy ascii file si to ebcdic si1
dd if=/dev/rmt0 ibs=512 obs=1024 of=/dev/rmt1
To copy blocks from rmt0 with 512 blocks to rmt1 with 1024 blocks
tctl -f /dev/rmt0 rewind To rewind the tape
tctl -f /dev/rmt0 offline To eject the tape
tctl -f /dev/rmt0 status To show the status of tape
chdev -l rmt0 -a block_size=512 To change the block size of the tape to 512
Print commands
qchk -q To display the default q
qchk -P lp0 To display the status of the printer lp0
qchk -# 123 To display the status of job number 123
qchk -A To display the status of all queues
qcan -x 123 To cancel the print job 123
qcan -X -P lp0 To cancel all jobs submitted to lp0
qpri -#570 -a 25 To change the priority of the job to 25
qhld # 569 To hold the job 569
qhld -r -#569 To remove holding from 569
qmov -m lpa -#11 To move the job 11 to queue lpa
enable psq To enable queue psq
disable psq To disable queue psq
cancel -#111 To cancel job 111
lpstat To display the status all queues
lpstat -p lp0 To display the status of print queue lp0
lpstat -u root To display the jobs submitted by user root
lpq -P lp0 To display the status of queue lp0
Licensing commands
oslevel To list the operating system level
lslicense To see the number of license
chlicense -u30 To change the fixed user license to 30
chlicense -f on To enable floating user license
User commands
id To list all system identifications for current user
id -gn To list the default group for current user
id -Gn To list all system groups for current user
lsuser root To list the attribute of user root
lsuser ALL To list the attributes of all users
lsuser -a HOME ALL To list the home directory of all users
lsuser -a ALL To list all usernames
lsuser -a auth1 auth2 ALL To list the authentication method for all users
lsuser -a expires ALL To list expiry date
lsuser -a account_locked ALL To check account lock status of all users
chsec -f /etc/security/user -a account_locked=false -s user
chuser -a login=true san To enable the user san
chuser -a rlogin=true san Enable san to login remotely
chuser maxexpired = -1 <User Name> Passwor never expairs for user}
mkuser si Creates user si with default values in
/usr/lib/security/mkuser.defalault
mkuser su=false si Create user si without su facility
rmuser si To remove user si
rmuser -p si To remove user si and his all attributes
who List users with tty nos and ip numbers
who /var/adm/wtmp Lists history of login logout system startup and shutdowns
who -r To list the run level
who am i /who -m To list the current user
mkgroup dcm To create the group dcm
chgroup users=u1,u2,u3 dcm To add users u1 u2 and u3 to dcm group
rmgroup dcm To delete the group dcm
chauthent To change the authentication methods
Subsystem Commands
lssrc -a To list the status of all subsystems
lssrc -h node1 -a To list the status of all subsystems on foreign host node1
lssrc -s kadmind To list the status of the subsystem kadmind
lssrc -g tcpip To get the status of the subsystem group tcpip
mkssys To add a subsystem
rmssys -s kerberos To remove the subsystem kerberos
chssys -s kerb -s kad To rename the subsystem kerb to kad
startsrc -s kadmin To start the subsystem kadmin
startsrc -g tcpip To start the subsystem group tcpip
stopsrc -s kadmin To stop the subsystem kadmin
stopsrc -g tcpip To stop the subsystem group tcpip
refresh -s nfsd To refresh nfsd subsystem
refresh -g tcpip To refresh tcpip subsystem group
Scheduling commands
crontab -l To list the crontab entries
crontab -e To edit the crontab entries
crontab -l > /si To copies the entries of crontab to /si file
crontab -r To remove all crontab entries
crontab -v To list the submission time
/var/adm/cron/cron.allow File containing users who allowed cron service
/var/adm/cron/cron.deny File containing users denied cron service
at -l To list the jobs scheduled via at command
at -r root.dfjdhjdh.21 To remove the scheduled job root.dfjdhjdh.21
/var/adm/cron/at.allow File containing users who allowed at service
/var/adm/cron/at.deny File containing users denied at service
batch To run the command when the system load permits
atq joe To list all the jobs submitted by user joe
ODM Commands
odmget sm_menu_opt
To get the objects from class sm_menu_opt
odmget -q "id=licenses" sm_menu_opt
To list objects that matches query id=licenses from object sm_menu_opt
odmdelete -o sm_menu_opt -q "id=licenses"
To delete the entries from class sm_menu_opt which agrees the query id=licenses
odmshow sm_menu_opt
To show the object class definition
odmdrop -o sm_menu_opt
To drop sm_menu_opt object class
odmchange -o sm_menu_opt -q "id=licenses" file1
To change the attributes from file1
Daemons of NIS
Server Slave Server Client
Slave Server
Change the nis domain name
chypdom –B mca
Edit hosts file, keep entries for loopback, this machine and of server
Execute mkslave –O –B –C mca
Client machine
Change the nis domain name
chypdom –B mca
Edit hosts file, and keep entries for loopback , this machine and of server
Execute mkclient –B mca
Check for ypbind with lssrc –s ypbind
HACMP Commands
logs
/tmp/hacmp.out Detailed event script output logged in 7 day rolling history
/var/adm/cluster.log High level view of cluster events (No clean up on this file)
/usr/sbin/cluster/history/cluster.mmdd Day by day view of cluster events. (one file / day of month)
/tmp/cm.log Clstrmgr messages
/tmp/cspoc.log Output from C-SPOC commands (similar to smit.log)
/tmp/emuhacmp.out Output from event emulation
rdist -b -f /etc/disfile1 To distribute the files in disfile1 to all nodes in disfile1 in binary mode
clgetactivenodes -n node1 To list the nodes with active cluster manager processes from cluster
manager on node node1
clgetaddr node1 returns a pingable address from node node1
clgetgrp -g sh1 To list the info about resource group sh1
clgetgrp -g sh1 -f nodes To list the participating nodes in the resource group sh1
clgetif To list interface name/interface device name/netmask associated with
a specified ip label / ip address of a specific node
clgetip sh1 To get the ip label associated to the resource group
clgetnet 193.9.200.2 255.255.255.0 To list the network for ip 193.9.200.2, netmask 255.255.255.0
clgetvg -l nodelv To list the VG of LV nodelv
SP Commands
Daemons
ngcreate -s 1:1 si To create node group si with 1st node in 1st frame
ngcreate -n 1 2 3 si To create node group si with 1st 2nd and 3rd nodes
ngcreate -N ng1,ng2 si To create node group si with node groups ng1 and ng2
ngcreate -w n1,n2 si To create node group si with host name n1 and n2
ngcreate -ae n1,n2 si To create node group si with all nodes in the current partition
excluding hosts n1 and n2
delnimclient -l 1 2 3 To delete nim client definition for nodes 1 2 and 3 from NIM master
mknimclient -l 1 2 3 To make node 1 2 and 3 as NIM clients
delnimmast -l 1 17 33 To unconfigure nodes 1 17 and 33 as NIM masters and remove filesets
mknimmast -l 1 17 33 To make nodes 1 17 and 33 as NIM masters
ntpdate 90.1.2.1 Sets date and time by enquiring ntp server 90.1.2.1
rcmdtgt To obtain a maximum life time ticket for rcmd services on local node
chkp -l 6 siju To change the life time of the principal siju to 30 minutes (6 x 5)
chkp -e 2001-5-23 siju To change the expiry date of principal siju to 2001 may 23
ksrvutil list To list the principals and version number in the server key file
ksrvutil -f /etc/srvtab.bak list To list the principals in the file /etc/srvtab.bak
ksrvutil change To change the key version in the default srvtab file
ksrvutil delete To delete the keys in the /etc/krb-srvtab file
ksrvutil -f /etc/srvtab.bak delete To delete the keys in the /etc/srvtab.bak file
spacs_cntrl block user1 To block user1 on the node
spacs_cntrl unblock user1 To unblock user1
spacs_cntrl deny user1 To deny user1
spacs_cntrl allow user1 To allow user1
spacs_cntrl -f /tmp/si deny To deny the list of the users in the file /tmp/si
cw_allowed List of users to be allowed to login to CWS
cw_restrict_login Script which will deny user to login to cws and allow them to change
the passwd (files are /usr/lpp/ssp/config/admin directory and entry for
second file will be in /etc/profile file)
Procedure to Build a file collection with name siju for files in /home/siju
1) go to /var/sysman/sup
2) create dir siju
3) change ownership and group of siju to bin
4) copy contents of /var/sysman/sup/user.admin to siju
5) edit list file for including and omitting files in /home/siju directory
It should contains entry like the following
symlinkall
upgrade ./home/siju
omit ./home/siju/abc
omitany ./home/siju/s*
6) Add a symbolic link to siju file in lists directory to list in siju directory
ie ln -s /var/sysman/sup/siju/list /var/sysman/sup/lists/siju
7) Update /var/sysman/file.collections file with following entry
primary siju - / - / EDO power no
8) Update sup.admin file collection to reflect the changes made to file.collections
dsh -av supper update sup.admin
9) Install file collection siju in the nodes
dsh -av supper install siju
setauth -cmd svcconnect NONE To allow non kerberos users to execute sysctl commands
(Entry in sysctl.conf file)
setauth -cmd pdf {ACL /etc/si.acl} To change the acl file for pdf command to /etc/si.acl
(Entry in sysctl.conf file)
Task :- User siju (kerberos principal siju.adm) should get the permission to start a subsystem by executing
the command substart. Permission should not be given to other users.
1) Create the client application substart in /usr/bin directory of cws with following contents
if [ $# -gt 2 ]
then echo "Arguments exceed the limit"
exit 1
fi
/usr/lpp/ssp/bin/hostlist -n $1 | /usr/bin/sysctl -c - substart_proc $2
In the above script if condition will check for the number of arguments and execute procedure on
corresponding host
3) Create server application substart.tcl with a procedure substart_proc with following contents
if condition in the above example checks for kerberos user in the acl file /etc/substart.acl
If the condition is true it execute the command /etc/substart.srv with arguments passed by
substart command
startsrc -s $2
This script execute the command startsrc with the argument passed by the substart command
6) Create acl file substart.acl with the entry for user siju
#acl#
_PRINCIPAL siju.adm@CWS
7) Add the application to the sysctl by adding following line to sysctl.conf file
include /etc/substart.tcl
9) Restart the sysctld daemon to get the new information on cws and on all nodes
10) Get the kerberos ticket for user siju and execute following command
substart 3 lpd
11) Try the above command with any other kerberos ticket. Result should be negative
NIM Commands
nimconfig -a pif_name=en0 -a netname=net1
To initialise the NIM master with network name net1
nimconfig -r To rebuild /etc/niminfo file which contains the variables for NIM
nimclient
The client version of nim command (User can obtain same results of nim in server )
-OR-
Task SMIT Fast Command or File
Path
List All Defined Tape Drives smit lsdtpe lsdev -C -c tape -H
List All Supported Tape Drives smit lsstpe lsdev -P -c tape -F "type subclass description" -H
Add New Tape Drives smit cfgmgr cfgmgr
Automatically
Add a User-Specified Tape Drive smit addtpe mkdev -c tape -t '8mm' -s 'scsi' -p 'scsi0' -w '4,0' -a
extfm=yes
Show Characteristics of a Tape smit chgtpe lsdev -C -l rmt0
Drive lsattr -D -l rmt0
Change Attributes of a Tape smit chgtpe chdev -l rmt0 -a block_size='512' -a mode=no1
Drive
Remove a Tape Drive smit rmvtpe rmdev -l 'rmt0'1
Clusters
cath_node11:root:/# lssrc -g cluster
Subsystem Group PID Status
clstrmgrES cluster 19770 active
clsmuxpdES cluster 22190 active
clinfoES cluster 21940 active
tail -f /tmp/hacmp.out|more
Cluster state
Check the status of the cluster daemons by issuing lssrc -g cluster and lssrc -g lock.
Run /usr/sbin/cluster/clstat to check the status of the cluster and the status of the network interfaces.
Check the cluster log files with tail -f /tmp/hacmp.out, more
/usr/sbin/cluster/history/cluster.mmdd (mmdd = current date), tail -f
/var/adm/cluster.log, and more /tmp/cm.log.
Verify that all the HACMP Configuration is synchronized. To check the state of the HACMP cluster
nodes, you have to test the topology and configuration of your HACMP cluster. This is done by using the
clverify command.
rmfs (fs) Removes the file system and will also remove the
LV if there are no onther file systems on it.
defrag -q (fs) Reports the fragment status of the file system.
defragfs -r (fs) Runs in report only defrag mode (no action).
defragfs (fs) Defragments a file system.
fsck (fs) Verify a file system, the file system must be unmounted!
fsck (-y or -n) (fs) Pre-answer questions either yes or no !
fsck -p (fs) Will restore primary superblock from backup copy if the
superblock is corrupt.
LPAR
uname –L
Use the uname command to obtain information about the system in relation to the LPAR.
> uname -L
-1 NULL
The "-1" indicates that the system is not running with any logical partitions, but is running in full system
partition mode.
The following example demonstrates how the uname command provides the partition number and the
partition name as managed by the HMC:
> uname -L
3 Web Server
Knowing that the application is running in an LPAR can be helpful when you are assessing slight
performance differences.
CHFS EXAMPLES
1. To change the file system size of the /test Journaled File System, enter:
chfs -a size=24576 /test
This command changes the size of the /test Journaled File System to 24576 512-byte blocks, or
12MB (provided it was previously no larger than this).
3. To convert a JFS2 file system to a version which can support NFS4 ACLs, type:
chfs -a ea=v2 /test
4. To change the mount point of a file system, enter:
chfs -m /test2 /test
This command changes the mount point of a file system from /test to /test2.
6. To split off a copy of a mirrored file system and mount it read-only for use as an online backup,
enter:
chfs -a splitcopy=/backup -a copy=2 /testfs
This mount a read-only copy of /testfs at /backup.
7. To change the file system size of the /test Journaled File System, enter:
chfs -a size=64M /test
This command changes the size of the /test Journaled File System to 64MB (provided it was
previously no larger than this).