Wednesday, May 14, 2008

Solaris check if patch is installed

/var/sadm/patch contains the list of installed patched. The date of the creation of a directory for a particular patch is actually the date of patch installation.

or

#showrev -p grep 116268

Solaris vxfs verify large file support

how to verify and enable largefile support on a vxfs filesystem

Description

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

Example

fsadm -F vxfs /dir_name; fsadm -F vxfs -o largefiles /dir_name

Tuesday, May 13, 2008

HP-UX disk and filesystem tasks

Search for attached disk
ioscan -fnC disk
Initialize a disk for use with LVM
pvcreate -f /dev/rdsk/c0t1d0
Create the device structure needed for a new volume group.
cd /dev
mkdir vgdata
cd vgdata
mknod group c 64 0x010000
Create volume group vgdata
vgcreate vgdata /dev/dsk/c0t1d0
{ if your expecting to use more than 16 physical disks use the -p option, range from 1 to 256 disks. }
Display volume group vgdata
vgdisplay -v vg01
Add another disk to volume group
pvcreate -f /dev/rdsk/c0t4d0
vgextend vg01 /dev/dsk/c0t4d0
Remove disk from volume group
vgreduce vg01 /dev/dsk/c0t4d0
Create a 100 MB logical volume lvdata
lvcreate -L 100 -n lvdata vgdata
newfs -F vxfs /dev/vgdata/rlvdata
Extend logical volume to 200 MB
lvextend -L 200 /dev/vgdata/lvdata
Extend file system to 200 MB
{ if you don't have Online JFS installed volumes must be unmounted before you can extend the file system. }
fuser -ku /dev/vgdata/lvdata { kill all process that has open files on this volume. }
umount /dev/vgdata/lvdata
extendfs /data

{ for Online JFS, 200 MB / 4 MB = 50 LE; 50 x 1024 = 51200 blocks }
fsadm -F vxfs -b 51200 /data
Set largefiles to support files greater than 2GB
fsadm -F vxfs -o largefiles /data

Exporting and Importing disks across system.

1. make the volume group unavailable
vgchange -a n /dev/vgdata
2. Export the the disk while creating a logical volume map file.
vgexport -v -m data_map vgdata
3. Disconnect the drives and move to new system.
4. Move the data_map file to the new system.
5. On the new system recreate the volume group directory
mkdir /dev/vgdata
mknod /dev/vgdata/group c 64 0x02000
6. Import the disks to the new system
vgimport -v -m data_map /dev/vgdata /dev/dsk/c2t1d0 /dev/dsk/c2t2d0
7. Enable the new volume group
vgchange -a y /dev/vgdata
Renaming a logical volume
/dev/vgdata/lvol1 -> /dev/vgdata/data_lv
umount /dev/vgdata/lvol1
ll /dev/vgdata/lvol1 take note of the minor ( e.g 0x010001 )
brw-r----- 1 root root 64 0x010001 Dec 31 17:59 lvol1
mknod /dev/vgdata/data_lv b 64 0x010001 create new logical volume name
mknod /dev/vgdata/rdata_lv c 64 0x010001
vi /etc/fstab { reflect the new logical volume }
mount -a
rmsf /dev/vgdata/lvol1
rmsf /dev/vgdata/rlvol1

Solaris which pid uses port

#!/bin/ksh
# find from a port the pid that started the port
#
line='-------------------------------------------------------------------------'
pids=`/usr/bin/ps -ef | sed 1d | awk '{print $2}'`

# Prompt users or use 1st cmdline argument
if [ $# -eq 0 ]; then
read ans?"Enter port you like to know pid for: "
else
ans=$1
fi

# Check all pids for this port, then list that process
for f in $pids
do
/usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
if [ $? -eq 0 ] ; then
echo "$line\nPort: $ans is being used by PID: \c"
/usr/bin/ps -o pid -o args -p $f | sed 1d
fi
done
exit 0

AIX HPUX how to remove password

To remove password in AIX,
Edit /etc/security/passwd, change the password to *
myaot2:
password = *

To remove password requirements for HPUX, edit this file /tcb/files/auth/o/oracle;

oracle:u_name=oracle:u_id#600:\
:u_pwd=*:\
:u_auditid#67:\
:u_auditflag#1:\
:u_exp#3024000:u_life#4838400:u_succhg#1150751962:u_unsucchg#1150691460:\
:u_pw_expire_warning#604800:u_pswduser=oracle:u_nullpw:u_pwchanger=root:\
:u_suclog#1150752396:u_suctty=/dev/pts/1:u_unsuclog#1150692078:u_unsuctty=ssh:\
:u_lock@:chkent:

Change value u_pwd=*:\

You also have to disable password aging for the specific account in SAM. Password access will be revoked & it will not lock the account then

AIX print queue command

To Check AIX Print Queue

#qchk -q -P HOUOSP0P350

Queue Dev Status Job Files User PP % Blks Cp Rnk

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

HOUOSP0 @houh READY

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:

HOUOSP0P350:


PRINTERS / PRINT QUEUES
--------------------------------------------------------------------------------

splp (device) Displays/changes printer driver settings
splp /dev/lp0

export $LPDEST="pqname" Set default printer queue for login session

lsvirprt Lists/changes virtual printer attributes.

lsallq Displays all queues

rmvirprt -q queuename -d queuedevice Removes a virtual printer

qpri -#(job No) -a(new priority) Change a queue job priority.

qhld -#(job No) Put a hold on hold
qhld -r #(job No) Release a held job

qchk -A Status of jobs in queues
lpstat
lpstat -p(queue) Status of jobs in a named queue

qcan -x (job No) Cancel a job from a queue
cancel (job No)

enq -U -P(queue) Enable a queue
enable (queue)

enq -D -P(queue) Disable a queue
disable (queue)

qmov -m(new queue) -#(job No) Move a job to another queue

startsrc -s qdaemon Start qdaemon sub-system
lssrc -s qdaemon List status of qdaemon sub-system
stop -s qdaemon Stop qdaemon sub-system

Solaris find sun fibre channel device

# more luxadm_probe_-p.out

No Network Array enclosures found in /dev/es

Found Fibre Channel device(s):

Node WWN:5005076300c09f4b Device Type:Disk device
Logical Path:/dev/rdsk/c6t6005076300C09F4B000000000000100Dd0s2
Physical Path:
/devices/scsi_vhci/ssd@g6005076300c09f4b000000000000100d:c,raw
Node WWN:5005076300c09f4b Device Type:Disk device
Logical Path:/dev/rdsk/c6t6005076300C09F4B000000000000102Cd0s2
Physical Path:
/devices/scsi_vhci/ssd@g6005076300c09f4b000000000000102c:c,raw
Node WWN:5005076300c09f4b Device Type:Disk device
Logical Path:/dev/rdsk/c6t6005076300C09F4B000000000000102Ed0s2
Physical Path:
/devices/scsi_vhci/ssd@g6005076300c09f4b000000000000102e:c,raw

# format

Searching for disks...done
AVAILABLE DISK SELECTIONS:

0. c0t0d0
/pci@1f,4000/scsi@3/sd@0,0
1. c0t1d0
/pci@1f,4000/scsi@3/sd@1,0
2. c0t2d0
/pci@1f,4000/scsi@3/sd@2,0
3. c0t3d0
/pci@1f,4000/scsi@3/sd@3,0
4. c2t0d0
/pci@6,4000/scsi@4/sd@0,0
5. c2t1d0
/pci@6,4000/scsi@4/sd@1,0
6. c2t2d0
/pci@6,4000/scsi@4/sd@2,0
7. c2t3d0
/pci@6,4000/scsi@4/sd@3,0
8. c6t6005076300C09F4B000000000000100Dd0
/scsi_vhci/ssd@g6005076300c09f4b000000000000100d

9. c6t6005076300C09F4B000000000000102Cd0
/scsi_vhci/ssd@g6005076300c09f4b000000000000102c

10. c6t6005076300C09F4B000000000000102Ed0
/scsi_vhci/ssd@g6005076300c09f4b000000000000102e


Specify disk (enter its number): ^D

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...