Tuesday, May 29, 2012

SMIT Fast Paths (For Reference)

Taken from http://archive.rootvg.net/smit.htm

You can access SMIT tasks and sub-menus directly by using a fast path.
Example: smit mkuser
takes you directly to the menu Add a User.
At any menu in SMIT, you can show the fast path to that menu by pressing the F8 key.


Application/Task Fast Path
Software Installation and Maintenance
Install and Update Software
     Install Software
     Update Installed Software to Latest Level (Update All)
     Install Software Bundle
     Update Software by Fix (APAR)
     Install and Update from ALL Available Software
List Software and Related Information
     List Installed Software and Related Information
           List Installed Software
           List Applied but Not Committed Software Updates
           Show Software Installation History
           Show Fix (APAR) Installation Status
           List Fileset Requisites
           List Fileset Dependents
           List Files Included in a Fileset
           List Fileset Containing File
           Show Installed License Agreements
      List Software on Media and Related Information
           List Filesets in a Bundle
           List Software on Installation Media
           List Software Fixes (APARs) on Installation Media
           List Supplemental Fileset Information on Installation Media
           Show License Agreements on Installation Media
Software Maintenance and Utilities
     Commit Applied Software Updates (Remove Saved Files)
     Reject Applied Software Updates (Use Previous Version)
     Remove Installed Software
     Copy Software to Hard Disk for Future Installation
     Check Software File Sizes After Installation
     Verify Software Installation and Requisites
Network Installation Management
     Configure Network Installation Management Client Fileset
     Install and Update Software
     List Software on Media and Related Information
           List Filesets in a Bundle
           List Software on Installation Media
           List Software Fixes (APARs) on Installation Media
     Manage Network Install Permissions
     Manage Network Install Resource Allocation
System Backup Manager
     Back Up the System
           Back Up This System to Tape/File
           Create a Generic Backup CD
     List Files in a System Image
     Restore Files in a System Image
install
install_update
install_latest
update_all
install_bundle
update_by_fix
install_all
list_software
list_installed
list_installed_sw
list_applied_sw
show_history
show_apar_stat
list_requisites
list_dependents
list_files
what_fileset
installed_license
list_media
list_bundle
list_media_sw
list_media_fixes
list_media_info
license_on_media
maintain_software
commit
reject
remove
bffcreate
check_files
verify_install
nim_client
niminit
nim_client_inst
nim_client_list
nim_c_list_bundle
nim_c_list_sw
nim_c_list_fixes
nim_perms
nim_c_mac_res
backsys
sysbackup
mksysb
mkcdgeneric
lsmksysb
restmksysb
Software License Management
Manage Nodelocked Licenses
     Add Nodelocked License from a File
     Add Nodelocked License from the Keyboard
     Delete a Nodelocked License
Manage License Servers and License Databases
     Show Server Characteristics
     Manage Concurrent Use and Use Once Licenses
     Manage Vendor Information in License Databases
Show License Usage on Servers
     Show License Usage Summary
     Show Licenses Currently Being Used
     Show License Information by Server
     Show Licenses Held by a Specific User
Show License Agreements
     Show Installed License Agreements
     Show License Agreements on Installation Media
licenses
manage_nodelocked
add_nodelocked_from_file
add_nodelocked_from_keyboard
delete_nodelocked
manage_servers
show_server_characteristics
manage_prod_licenses
manage_vendors
show_server_status
show_total_license_usage
show_current_license_usage
show_installed_licenses
show_user_license_held
show_license_agree
installed_license
license_on_media
Devices
Install/Configure Devices Added After IPL
Printer/Plotter
TTY
PTY
Console
Fixed Disk
CD ROM Drive
Read/Write Optical Drive
Diskette Drive
Tape Drive
Communication
Graphic Displays
Graphic Input Devices
Low Function Terminal (LFT)
SCSI Initiator Device
SCSI Adapter
Asynchronous I/O
Multimedia
List Devices
Configure/Unconfigure Devices
     Unconfigure a Device
     Configure a Defined Device
Install Additional Device Software
PCI Hot Plug Manager
     Unconfigure a Device
     Configure a Defined Device
     Install/Configure Devices Added After IPL
ISA Adapters
dev
cfgmgr
printer
tty
pty
console
disk
cdrom
rwopt
diskette
tape
commodev
g_display
input
lft
scsiid
scsia
aio
mm
lsattr
devcfg
devcfg_ucfg
devcfg_cfg
devinst
devdrpci
rmdev
mkdev
cfgmgr
devisa
System Storage Management (Physical & Logical Storage)
Logical Volume Manager
      Volume Groups
           List All Volume Groups
           Add a Volume Groups
           Set Characteristics of a Volume Group
           List Contents of a Volume Group
           Remove a Volume Group
           Activate a Volume Group
           Deactivate a Volume Group
           Import a Volume Group
           Export a Volume Group
           Mirror a Volume Group
           Unmirror a Volume Group
           Synchronize LVM Mirrors
           Back Up a Volume Group
           Remake a Volume Group
           List Files in a Volume Group Backup
           Restore Files in a Volume Group Backup
      Logical Volumes
           List All Logical Volumes by Volume Group
           Add a Logical Volume
           Set Characteristics of a Logical Volume
           Show Characteristics of a Logical Volume
           Remove a Logical Volume
           Copy a Logical Volume
      Physical Volumes
           Add a Disk
           Change Characteristics of a Physical Volume
           List Contents of a Physical Volume
           Move Contents of a Physical Volume
      Paging Space
           Add Another Paging Space
           Change/Show Characteristics of a Paging Space
           Remove a Paging Space
           Activate a Paging Space
           Deactivate a Paging Space
File Systems
     List All File Systems
     List All Mounted File Systems
     Add/Change/Show/Delete File Systems
     Mount a File System
     Mount a Group of File Systems
     Unmount a File System
     Unmount a Group of File Systems
     Verify a File System
     Backup a File System
     Restore a File System
     List Contents of a Backup
Files & Directories
     Backup a File or Directory
     Restore a File or Directory
     List Contents of a Backup
Removable Disk Management
     List All Mounted File Systems on a Disk
     Unmount File Systems on a Disk
     Remove a Disk from the Operating System
     Remove a Disk
     Open Door
System Backup Manager
     Back Up the System
     List Files in a System Image
     Restore Files in a System Image
storage
lvm
vg
lsvg2
mkvg
vgsc
lsvg1
reducevg2
varyonvg
varyoffvg
importvg
exportvg
mirrorvg
unmirrorvg
syncvg
vgbackup
restvg
lsbackvg
restsavevg
lv
lsvg
mklv
lvsc
lslv
rmlv
cplv
pv
makdsk
chpv
lspv
migratepv
pgsp
mkps
chps
rmps
swapon
swapoff
fs
lsfs
mount
manfs
mountfs
mountg
umountfs
umountg
fsck
backfilesys
restfilesys
listtoc
filemgr
backfile
restfile
listtoc
rds
lsmntdsk
umntdsk
removedsk
rmvdsk1
open_door
backsys
sysbackup
lsmksysb
restmksysb
Security and Users
Users
     Add a User
     Change a User's Password
     Change/Show Characteristics of a User
     Lock/Unlock a User's Account
     Reset User's Failed Login Count
     Remove a User
     List All Users
Groups
     List All Groups
     Add a Group
     Change/Show Characteristics of a Group
     Remove a Group
Passwords
     Change a User's Password
     Change/Show Password Attributes for a User
Login Controls
     Change/Show Login Attributes for a User
     Change/Show Login Attributes for a Port
Roles
     Add a Role
     Change/Show Characteristics of a Role
     Remove a Role
     List All Roles
security
users
mkuser
passwd
chuser
lockuser
failed_logins
rmuser
lsuser
groups
lsgroup
mkgroup
chgroup
rmgroup
passwords
passwd
passwdattrs
logins
login_user
login_port
roles
mkrole
chrole
rmrole
lsrole
Communications Applications and Services
TCP/IP
      Minimum Configuration & Startup
      Further Configuration
           Hostname
           Static Routes
           Network Interfaces
           Name Resolution
           Client Network Services
           Server Network Services
           Manage Print Server
           Select BSD style rc Configuration
           Authentication Configuration
      Use DHCP for TCPIP Configuration & Startup
      IPV6 Configuration
           IPV6 Static Routes
           IPV6 Network Interfaces
           IPV6 Daemon/Process Configuration
      Quality of Service Configuration & Startup
           Start Using the QoS Subsystem
           Stop Using the QoS Subsystem
NFS
      Configure TCP/IP (If Not Already Configured)
      Network File System (NFS)
           Configure NFS on This System
           Add a Directory to Exports List
           Change/Show Attributes of an Exported Directory
           Remove a Directory from Exports List
           Add a File System for Mounting
           Change/Show Attributes of an NFS File System
           Remove Remove an NFS File System
commo
tcpip
mktcpip
configtcp
hostname
route
netinterface
namerslv
clientnet
ruser
server
setbootup_option
auth_config
usedhcp
configtcp6
route6
inet6
daemon6
configqos
startqos
stopqos
nfs_menus
tcpip
nfs
nfsconfigure
mknfsexp
chnfsexp
rmnfsexp
mknfsmnt
chnfsmnt
rmnfsmnt
Print Spooling
Start a Print Job
Manage Print Jobs
     Cancel a Print Job
     Show the Status of Print Jobs
     Prioritize a Print Job
     Hold/Release a Print Job
     Move a Job Between Print Queues
Manage Print Queues
     Show Status of Print Queues
     Stop a Print Queue
     Start a Print Queue
     Set the System's Default Print Queue
Add a Print Queue
Add an Additional Printer to an Existing Print Queue
Change/Show Print Queue Characteristics
Remove a Print Queue
Manage Print Server
Programming Tools
spooler
qprt
jobs
qcan
qchk
qpri
qhld
qmove
pqmanage
qstatus
qstop
qstart
qdefault
mkpq
mkqprt
chpq
rmpq
server
pqtools
Problem Determination
Error Log
     Generate Error Report
     Change/Show Characteristics of the Error Log
     Clean the Error Log
System Dump
     Change the Primary Dump Device
     Change the Secondary Dump Device
     Change the Directory to which Dump is Copied on Boot
     Copy a System Dump from a Dump Device to a File
     Copy a System Dump from a Dump Device to Diskette
     Always Allow System Dump
     System Dump Compression
     Check Dump Resources Utility
Alog
     Show an Alog file
     Change/Show Characteristics of an Alog File
Hardware Diagnostics
Verify Software Installation and Requisites
problem
error
errpt
errdemon
errclear
dump
dumpchgp
dumpchgs
dumpchgd
dump_copy_file
dump_copy_dskt
dump_allow
dump_comprs
dump_checkr
alog
alog_show
alog_change
diag
verify_install
Performance and Resource Scheduling
Resource Status & Monitors
Analysis Tools
Resource Controls
     Remove a Process
     Set Initial Priority of a Process
     Change Initial Priority of a Process
     Set System Run Level
Schedule Jobs
Power Management
     Configure/Unconfigure Power Management
     System State Transition from Enable State
     Display Power Management
     Battery
Workload Management
      Work on alternate configurations
           Copy a configuration
           Create a configuration
           Select a configuration
           Enter configuration description
           Remove a configuration
      Work on a set of Subclasses
      Add a class
      Change/Show Characteristics of a class
           General characteristics of a class
           CPU resource management
           Memory resource management
           diskIO resource management
      Remove a class
      Class assignment rules
           Create a new Rule
           Change/Show Characteristics of a Rule
      Start/Stop/Update WLM
           Start Workload Management
           Update Workload Management
           Stop Workload Management
      Assign/Unassign processes to a class/subclass
performance
monitors
analysis
controls
kill
nice
renice
telinit
at
pm
pmConfig
pmState
pmDisplaySelect
pmBattery
wlm
wlmconfig
wlmconfig_copy
wlmconfig_create
wlmconfig_select
wlmconfig_enter
wlmconfig_delete
wlmsubclass
wlmaddclass
wlmchclass
wlmclass_gal
wlmclass_cpu
wlmclass_mem
wlmclass_bio
wlmrmclass
wlmrs
crewlmrs
chgwlmrs
wlmmanage
wlmstart
wlmupdate
wlmoff
wlmassign
System Environments
Stop the System
Assign the Console
Change/Show Date and Time
     Change/Show Date & Time
     Change Time Zone Using System Defined Values
     Change Time Zone Using User Inputted Values
Manage Language Environment
     Change/Show Primary Language Environment
     Add Additional Language Environments
     Remove Language Environments
     Change/Show Language Hierarchy
     Set User Languages
     Change/Show Applications for a Language
     Convert System Messages and Flat Files
Change/Show Characteristics of Operating System
Change/Show Number of Licensed Users
Manage AIX Floating User Licenses for this Server
Broadcast Message to all Users
Manage System Logs
Change/Show Characteristics of System Dump
Internet and Documentation Services
     Change/Show Default Browser
     Change Documentation and Search Server
     Change/Show Default Documentation Language
     Web-based System Manager
Change System User Interface
Change/Show Default Documentation Language
Manage Remote Reboot Facility
Manage System Hang Detection
system
shutdown
chcons
chtz_date
date
chtz
chtz_user
mlang
chlang
mle_add_lang
mle_rm_lang_hdr
mle_hier_cmd_hdr
chlang_user
mle_chapp_menu
nu_iconv
chgsys
chlicense
netls_server
wall
logs
dump
web_configure
change_default_browser
change_doc_search_server
chdoclang
web_based_system_manager
dt_config
chdoclang
rrbtty
shd
Processes and Subsystems
Processes
     Remove a Process
     Bind a Process to a Processor
     Unbind a Process
Subsystems
     Query a Subsystem
     Start a Subsystem
     Stop a Subsystem
           Stop a Single Subsystem
           Stop All Subsystems
     Refresh a Subsystem
     Trace Subsystem
           Start Trace
           Stop Trace
Subservers
     Query a Subserver
     Start a Subserver
     Stop a Subserver
     Trace Subserver
           Start Trace
           Stop Trace
src
process
kill
bindproc
unbindproc
subsys
qssys
startssys
stopssys
stopassys
stopallssys
refresh
tracessys
tracessyson
tracessysoff
subserver
qserver
startserver
stopserver
traceserver
startserver.trace
stopserver.trace

Tuesday, January 17, 2012

Friday, October 14, 2011

tar: file name too long (how to fix)

To avoid skipping files with names longer than 255 chars, use the "E" option on tar:

# tar Ecpf - /zones | gzip >> zones-usrtp1sspap009.tar.gz

Command above is useful when you don't have too much space left to compress/gzip a file

Thursday, August 18, 2011

Issue on SunFire 15K

This is just for the records ... One of my customers scheduled a maintenance on a SunFire 15K and the CE swapped the boards without a proper "power OFF" on SMS (SC). Here's the way to fix the issue:

SEEPROM probe took 0 seconds.
Reading Component Health Status (CHS) information ...
CHS reports Port IO6/P0 status NOT_GOOD. Treating as blacklisted.
NOTE: Crunching Slot IO6 because BBC is not GOOD, can't connect IO Boards.


How to fix:
setchs -c IO7/P0 -r " " -s ok
setchs -c IO6/P0 -r " " -s ok

This command will clear the CHS component status'. Then, you will only need to setkeyswitch the domain (off/on) to rerun POST and voila.

Hope that helps someone out there in trouble.

Saturday, December 4, 2010

Mounting ISO images on Solaris

mount /root/solaris.iso file under /mnt directory

# lofiadm -a /root/solaris.iso /dev/lofi/1

# mount -F hsfs -o ro /dev/lofi/1 /mnt

to unmount

# umount /mnt

# lofiadm -d /dev/lofi/1

lofi = loopback file driver

Friday, May 28, 2010

lucreate bug (copying the whole filesystems to NewBE) - How to fix

So, I'm here again ... Bored as usual, lol ... Decided to write this to unbore me a little bit, rofl ....

I'm not sure if you ever faced this issue, but I can say I've had many frustrating times and had to redo a lot of lucreates because of this.

I don't know why, but some versions of Solaris LiveUpgrade appear to be buggy (when you start a lucreate command, it simply copy the whole filesystem structure under / to your little slice0).

EG:You have /apps, /u001, etc. lucreate copies everything sitting on the / FS to your NewBE partition (and of course that I don't have to say how this will end and which message you will receive during the process - NO SPACE LEFT ON DEVICE).

So, to avoid this thing to happen and have a 100% safe copy of your CurrentBE, run lucreate as follows:

# lucreate -n NewBE -m /:/dev/dsk/<C#T#D#>s0:ufs -m -:/dev/dsk/<C#T#D#>s1:swap -m /var:/dev/dsk/<C#T#D#>s5:ufs -f /tmp/LU_exclude_list

You can see that I've added a file path name on the -f parameter (this is to avoid lucreate to copy the FS specified on the file LU_exclude_list).

The file content is a pretty simple text file with a list of your filesystems mount points:

# cat /tmp/LU_exclude_list
/appPOC
/apps
/u001
/u002
/u003

Hope this helps ... Cya!!!!

Wednesday, December 30, 2009

Fast way to unencapsulate rootdisk on Veritas

1. boot single user mode alternate boot device like cdrom, spare disk or net
ok> boot cdrom -s

2. fsck the root filesystem
# fsck -y /dev/rdsk/c0t0d0s0 (assuming root disk is c0t0d0)

3. mount the root filesystem on /a
# mount /dev/dsk/c0t0d0s0 /a

4. cp /a/etc/system /a/etc/system.vxvm

5. vi /a/etc/system and remove the following 2 entries

rootdev:/pseudo/vxio@0:0
set vxio:vol_rootdev_is_volume=1

6. cp /a/etc/vfstab /a/etc/vfstab.vxvm

7. cp /a/etc/vfstab.prevm /a/etc/vfstab

8. rm /a/etc/vx/reconfig.d/state.d/root-done

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

10. reboot

Monday, December 28, 2009

df: cannot canonicalize .: Permission denied

I often use Solaris Live Upgrade to run quarter patching process in one of my customers. It's a very safe way to patch your system and you also have an untouched disk available (just in case you need to back out).

 

During this year, we've experienced a "not-well-known" issue with Live Upgrade. If you go to a directory (it usually happens with /var) and try the command below, you get a permission denied message (it seems to happen only with older versions of LU):

 

$ sudo pkginfo -l SUNWluu
   PKGINST:  SUNWluu
      NAME:  Live Upgrade 2.0 10/01 (usr)
  CATEGORY:  application
      ARCH:  sparc
   VERSION:  11.8,REV=2001.10.30.17.21

$ cd /var
$ df -k .
df: cannot canonicalize .: Permission denied

 

This happens because Live Upgrade doesn't do a proper copy of the mount-point directory's permission (it usually does a chmod 750 on the mount-point dir, instead of a 755). It also denies a normal user to list/create files on the file system (can impact some apps to work properly).

 

File system directory un-mounted would look like this:

 

$ ls -ld /var
drwx------  41 root     sys         1024 Mar 16  2009 /var
$

 

We have opened a case with Sun to help us troubleshooting (unfortunately they didn't help us finding a permanent solution for this issue).

 

So, based on the history above I decided to develop by myself a permanent fix (feel free to use/suggest any new idea you might have):

 

1 - This issue only happens with Solaris 8 and/or 9 (haven't seen any similar issue on S10).

 

2 - If you want to permanently avoid this (and other issues) when you are starting to create the NewBE, I suggest you to install the Solaris 10 version of Live Upgrade on your Solaris 8/9 (you can find the packages in the following directory tree)

 

Solaris_10/Product/SUNWlur

Solaris_10/Product/SUNWluu

 

Copy the whole directory tree (use tar) to your server and remove the old packages:

 

pkgrm SUNWluu SUNWlur

 

Now, install the new packages:

 

pkgadd –d . SUNWluu SUNWlur

 

 

Common errors that happens using older versions of Live Upgrade:

 

cpio: Error with fstatat() of "opt/ecc/exec/MSR520/diskqueue/SST/GMACBR120.00101806c8be_ENW.que", errno 2, No such file or directory

 

cpio: Cannot open "./usr/emc/API/symapi/ipc/storwatchd", skipped, errno 122, Operation not supported on transport endpoint

cpio: pathname is too long

 

 

3 – If you want to be 100% safe from this issue (also after upgrading your Live Upgrade), you can use the following simple script that my co-worker developed together with myself:

 

#!/sbin/sh

#

# Script to fix the issue regarding the mountpoint permissions.

#

 

 

case "$1" in

'start')

        echo "Fixing mountpoint permissions..."

        for i in `grep -v "^#" /etc/vfstab| awk '{print $3}'| egrep -v '^-$|^/tmp$|^/$|^/proc$|^/dev/fd$' `

        do

        echo $i

        chmod u+rwx,g+rx,o+rx  $i

        done

        ;;

 

*)

        echo "Usage: $0 { start  }"

        exit 1

        ;;

 

esac

exit 0

 

 

Copy this output and save it to a file on /etc/init.d (we named it as mountpoint_fix_permissions).

 

Then, do the following to make this script always run when you reboot the server:

 

# chmod 755 /etc/init.d/mountpoint_fix_permissions

# ln /etc/init.d/mountpoint_fix_permissions /etc/rcS.d/S65mountpoint_fix_permissions

 

# ls -li S65mountpoint_fix_permissions /etc/init.d/mountpoint_fix_permissions

    122723 -rwxr--r--   2 root     other        383 Dec 19 19:44 /etc/init.d/mountpoint_fix_permissions

    122723 -rwxr--r--   2 root     other        383 Dec 19 19:44 S65mountpoint_fix_permissions

 

 

This script will grep /etc/vfstab looking for file system paths and will chmod 755 all of them before they get mounted (to avoid the issue).

 

This is what will happen when the script runs:

 

VxVM starting special volumes ( swapvol rootvol var )...

Fixing mountpoint permissions...

/var

/apps

/u001

/u003

/u010

/u011

/u012

/u013

/u014

/u099

/u100

/u110

/u510

 

Now you should be all set to avoid complaints from your customer :-)

 

PS: This issue can sometimes impact on application’s behavior (so make sure that you have it fixed).

 

Bug Reference:

 

http://forums.sun.com/thread.jspa?threadID=5065412

 

This is bug #4697677

Wednesday, October 7, 2009

Can't open boot_archive

During a disaster recovery exercise in one of my customers, I had to deal with this frustrating error and tried almost everything to solve it (since we didn't had too much time for debugging, I've opened a software case with Sun.

This is a sample of the msg:

 

Boot device: /pci@0/pci@0/pci@2/scsi@0/disk@2,0:a File and args: -s -r

Can't open boot_archive

Evaluating:
The file just loaded does not appear to be executable.
{0} ok  

 

 

After a few hours debugging the issue with Sun, we came in the conclusion that the disk had a new bootblock (kernel 139555-08) which was seeking for the boot archive area (but it wasn't there, therefore that's the reason for the msg error). Actually, we did some OS patch changes prior to the DR exercise, but unfortunately we had to back out.

 

The mystery of the entire history is that the image that was applied to the disk a few days ago was using an old kernel version (127111-11) and the bootblock that is compatible with this kernel version should be there (but it wasn't :\)

 

Anyway, after the whole damn troubleshooting this is what we've done to fix the issue:

 

1) Boot from an old disk (that has an older kernel version - in our case we booted using 127111-11)

2) Install a new boot block:

 

************************************************
# To install boot block in the root disk:
# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk/dev/rdsk/cXtXdXs0
************************************************

 

3) Reboot the server and be happy

 

If you still face issues, you might need to reboot in failsafe mode and sync your bootarchive. To do that, go to {OK} prompt and type:

 

boot -F failsafe

 

A message like this will appear:

 

An out of sync boot archive was detected on /dev/dsk/c1t2d0s0.
The boot archive is a cache of files used during boot and
should be kept in sync to ensure proper system operation.

 

Do you wish to automatically update this boot archive? [y,n,?] y


Updating boot archive on /dev/dsk/c1t2d0s0.
The boot archive on /dev/dsk/c1t2d0s0 was updated successfully.

 

Reboot and you should be all set :)

 

 

 

Finding the port number of a process (useful when lsof doesn't help).

Hi Folks,

 

I've been away for many months due to work/vacation but now I'm back (I'll try to post new things on a regular basis :)

 

Sometime ago I had a request from a WEBLOGIC guy to kill a process that was using a specific port, but the real issue was: *he didn't know the PID # and LSOF was not working*

 

So, I started g00gling around and found a small script that does the job. The script uses one of the proc tools "PFILES" to grep for the port # given in the command line:

 

# ./portfind.sh 161

Greping for your port, please be patient (CTRL+C breaks)

        sockname: AF_INET 10.13.204.20  port: 8161

Is owned by pid 1438

..

        sockname: AF_INET 0.0.0.0  port: 161

Is owned by pid 2474

..

 

 

# ps -ef | egrep '1438|2474'

    root  1438     1  0   Sep 28 ?        0:03 ./snmpmagt /opt/patrol/PATROL/Solaris28-sun4/lib/snmpmagt.cfg NOV

    root  2474     1  0   Sep 28 ?        0:00 /usr/lib/snmp/snmpdx -f 0 -y -c /etc/snmp/conf

    root  2490  2474  0   Sep 28 ?       11:36 mibiisa -r -p 32855

 

 

Here is the script code:

 

 

#!/bin/bash

# is the port we are looking for

 

if [ $# -lt 1 ]

then

echo "Please provide a port number parameter for this script"

echo "e.g. %content 1521"

exit

fi

 

echo "Greping for your port, please be patient (CTRL+C breaks)"

 

for i in `ls /proc`

do

pfiles $i | grep AF_INET | grep $1

if [ $? -eq 0 ]

then

echo Is owned by pid $i

echo ——

fi

done

 

Enjoy

Tuesday, March 10, 2009

Installing and configuring Sun Cluster 3.2 x86 on VMware Server

 

This tutorial will explain step-by-step how to setup Sun Cluster 3.2 (two-node cluster) using VMware Server (free).

 

This environment is very useful for lab purposes and also as a tool to study for SC 3.2 certification.

 

First of all, you need to download and install VMware Server (I'm currently using version 1.0.8). After installing VMware, we'll need to setup two Solaris 10 VM servers (use the custom option on the virtual machine configuration).

 

 

Now, this is a very important part to pay attention (#1):

 

1 - You will need to check if your CPU has the Intel Virtualization Technology (Intel® VT) or Pacifica (AMD) :    
 
 

2 - If your CPU doesn't have support for 64-bit virtual machines (in my case), VMware will show a message stating that 64-bit OSs won't be supported:

 
 
 

3 - If this message doesn't appear, then you probably have a CPU that supports 64-bit virtualization (so you can proceed with Solaris 10 - 64-bits).

 

4 - If you don't have support for 64 bits VM, you will have to use "Solaris 10" version (I will give further instructions regarding how to download/install 32-bit modules for Sun Cluster - without this module you won't be able to use SC 3.2 under 32-bit VMs).

 

5 - Memory for VM - I strongly recommend setting at least 1GB for each VM, if you plan to use Oracle DBs under the cluster management (otherwise 512-768 MB should suffice).

 

6 - Network connection - Leave the default option (Use bridged networking - later on we'll setup two additional network adapters that will be used as the transports for the cluster).

 

7 - SCSI Adapter - Choose "LSI Logic"

 

8 - Disk - Choose "Create a new virtual disk", SCSI as virtual disk type and 15 GB of disk space

 

9 - Now, we need to setup two additional network adapters for the cluster transporter (for that, click on Edit virtual machine settings and then click on Add button.

 

10 - Choose Ethernet Adapter as the hardware type.

 

11 - Choose Custom and VMnet1 (Repeat the steps 9-10-11, but now you will have to choose VMnet2)

 

12 - Go to Host >> Virtual network settings in the menu.

 

13 - Click on Host virtual adapters tab and add a new VMnet -> (VMnet2)
 

 

 
 

14 - Now we need to add another disk that will be the quorum disk (click on Edit Virtual Machines and then click on the ADD button)

 

15 - Add the disk as a SCSI disk, name it as quorum.vmdk and use around 100MB of disk space.

 

16 - Create a similar VM (another hostname) with the same HW settings (after that, add the quorum.vmdk using the same SCSI ID using the option "Use an existing virtual disk")


17 - Now, another important part - you will need to edit your VM config file to allow SCSI reservations (for that you need to disable disk locking and add the following lines into your VM config file - Hint: VM config file ends with a .VMX extension):

 

disk.locking = "false"
scsi0.sharedBus = "virtual"

 

-- These lines must be added on both VMs config file --

 

 

Now we are all set to start installing Solaris 10 and configure Sun Cluster. Boot your VM from the CD-ROM using a recent Solaris 10 ISO image (I'm assuming you have enough knowledge to make a fresh Solaris 10 install, so I will only specify the filesystem sizes to be set during the install):

 

 

  

Wait for the installation/reboot to finish and we should have 2 VMs running Solaris 10 (32 or 64 bits). Now we need to install VMware tools to convert the PCN devices to VMXNET devices (I had some problems while trying to install SC 3.2 using PCN, so I strongly recommend to install it).

 

To install VMware tools, click with the right button on your VM name and choose "Install VMware tools" (have in mind that you need to unmount any cd-rom currently mounted - after clicking it, VMware will mount a virtual cdrom on the server(s) containing the drivers you will have to install):


/vol/dev/dsk/c0t0d0/vmwaretools 1568 1568 0 100% /cdrom/vmwaretools


Go to /cdrom/vmwaretools (or whatever the mount point is), copy the file to /var/tmp/vmtools, uncompress it and run the installation perl script:

 

# cd /cdrom/vmwaretools

# ls -la
 

total 2973

dr-xr-xr-x 2 root sys       2048 out 30 22:39 .

drwxr-xr-x 3 root nobody     512 mar 12 23:38 ..
-r--r--r-- 1 root root   1519013 out 30 22:39 vmware-solaris-tools.tar.gz
 

# mkdir /var/tmp/vmtools

# cp vmware-solaris-tools.tar.gz /var/tmp/vmtools

# cd /var/tmp/vmtools

# gzcat vmware-solaris-tools.tar.gz | tar xvf -
# cd vmware-tools-distrib

# ./vmware-install.pl

 

Hit ENTER for all options (default) and when you finish don't forget to do the following:

 

* Rename your hostname.* files on /etc:

 

# ls -l /etc/hostname*
-rw-r--r-- 1 root root 6 mar 12 16:48 /etc/hostname.pcn0
# mv /etc/hostname.pcn0 /etc/hostname.vmxnet0

 

 

* Replace entries on /etc/path_to_inst (from PCN to VMXNET):

 

# cp /etc/path_to_inst /etc/path_to_inst.backup ; sed -e 's/pcn/vmxnet/g' /etc/path_to_inst >> /etc/path_to_inst.2 ; mv /etc/path_to_inst.2 /etc/path_to_inst

 

 * Reboot the server (init 6)

 

After reboot process you should have the vmxnet module properly loaded and your vmxnet0 interface up (check with ifconfig -a).    

 
*Optional* - I strongly recommend to follow this step, but you can configure SC without remote access control if you want:
 

To make things easier during the install, create a new ssh key as root (hit ENTER for everything) and copy the public file for the secondary node (/.ssh).

 

# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (//.ssh/id_dsa):
Created directory '//.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in //.ssh/id_dsa.
Your public key has been saved in //.ssh/id_dsa.pub.
The key fingerprint is:34:8e:32:54:b4:bb:d2:5e:71:ec:55:
01:09:cd:34:a3
root@earth

 

Connect on the secondary node and rename the public file to authorized_keys

 

Try to connect by SSH/SFTP and see if you will be asked for a password (if you did everything right, you won't be asked for a password).

 

 

We are ready to start installing/configuring Sun Cluster. Download Sun Cluster 3.2 x86, upload it on both VMs, unzip and run installer (on Solaris_x86 subdir).

 

 

* Choose option 4,5,6 to install (everything else is default - hit ENTER)

 

 Enter a comma separated list of products to install, or press R to refresh the list [] {"<" goes back, "!" exits}: 4,5,6

 

 Choose Software Components - Confirm Choices

 --------------------------------------------
Based on product dependencies for your selections, the installer will install:
[X] 4. Sun Cluster 3.2

* * Java DB 10.2
[X] 6. Sun Cluster Agents 3.2

 

 

Important Step:
 

 

If your CPU doesn't have support for IVT or Pacifica (as I explained before), you will have to install the 32-bit modules for Sun Cluster 3.2 (unfortunately I'm not authorized by the author to distribute the package, but your can obtain it by sending an email for Matthias Pfuetzner from Sun Microsystems - as I did to obtain it).

* State in the email that you wan to use it only for *LAB* purposes (he told me that Sun doesn't give support for 32-bit clusters, thus you will only be able to obtain this module by sending him an email)
 
When you download the 32-bit module, install it after unpacking by running pkgadd -d SUNWscka (if you do not install it and your VMs are 32-bit, the cluster WILL NOT work and the modules WILL NOT be loaded during the boot - so, remember to install it if your VMs are 32-bit).
 
Add the /usr/cluster/bin directory to your PATH variable on /etc/profile (so that you don't have to type the absolute path everytime you need to run a command).
 

 

At last! We will configure a cluster now... Before running scinstall, make sure you have both nodes added on each /etc/hosts file!
 
Run the command scinstall and follow the steps to install a two-node cluster:

 

 

# scinstall

 

  *** Main Menu ***

 

    Please select from one of the following (*) options:

 

      * 1) Create a new cluster or add a cluster node

        2) Configure a cluster to be JumpStarted from this install server

        3) Manage a dual-partition upgrade

        4) Upgrade this cluster node

        5) Print release information for this cluster node

 

      * ?) Help with menu options

      * q) Quit

 

    Option:  1

 

 

  *** New Cluster and Cluster Node Menu ***

 

    Please select from any one of the following options:

 

        1) Create a new cluster

        2) Create just the first node of a new cluster on this machine

        3) Add this machine as a node in an existing cluster

 

        ?) Help with menu options

        q) Return to the Main Menu

 

    Option:  1

 

 

  *** Create a New Cluster ***

 

 

    This option creates and configures a new cluster.

 

    You must use the Java Enterprise System (JES) installer to install

    the Sun Cluster framework software on each machine in the new cluster

    before you select this option.

 

    If the "remote configuration" option is unselected from the JES

    installer when you install the Sun Cluster framework on any of the

    new nodes, then you must configure either the remote shell (see

    rsh(1)) or the secure shell (see ssh(1)) before you select this

    option. If rsh or ssh is used, you must enable root access to all of

    the new member nodes from this node.

 

    Press Control-d at any time to return to the Main Menu.

 

 

    Do you want to continue (yes/no) [yes]? 

 

 

  >>> Typical or Custom Mode <<<

 

    This tool supports two modes of operation, Typical mode and Custom.

    For most clusters, you can use Typical mode. However, you might need

    to select the Custom mode option if not all of the Typical defaults

    can be applied to your cluster.

 

    For more information about the differences between Typical and Custom

    modes, select the Help option from the menu.

 

    Please select from one of the following options:

 

        1) Typical

        2) Custom

 

        ?) Help

        q) Return to the Main Menu

 

    Option [1]: 

 

 

  >>> Cluster Name <<<

 

    Each cluster has a name assigned to it. The name can be made up of

    any characters other than whitespace. Each cluster name should be

    unique within the namespace of your enterprise.

 

    What is the name of the cluster you want to establish?  cluster-lab

 

 

  >>> Cluster Nodes <<<

 

    This Sun Cluster release supports a total of up to 16 nodes.

 

    Please list the names of the other nodes planned for the initial

    cluster configuration. List one node name per line. When finished,

    type Control-D:

 

    Node name (Control-D to finish):  earth

    Node name (Control-D to finish):  mars

    Node name (Control-D to finish):  ^D

 

 

    This is the complete list of nodes:

 

        earth

        mars

 

    Is it correct (yes/no) [yes]? 

 

 

    Attempting to contact "mars" ... done

 

    Searching for a remote configuration method ... done

 

    The Sun Cluster framework is able to complete the configuration

    process with secure shell access (sshd).

 

   

Press Enter to continue: 

 

 

  >>> Cluster Transport Adapters and Cables <<<

 

    You must identify the two cluster transport adapters which attach

    this node to the private cluster interconnect.

 

 For node "earth",

    What is the name of the first cluster transport adapter?  vmxnet1

 

    Will this be a dedicated cluster transport adapter (yes/no) [yes]? 

 

    All transport adapters support the "dlpi" transport type. Ethernet

    and Infiniband adapters are supported only with the "dlpi" transport;

    however, other adapter types may support other types of transport.

 

 For node "earth",

    Is "vmxnet1" an Ethernet adapter (yes/no) [no]?  yes

 

    Is "vmxnet1" an Infiniband adapter (yes/no) [no]? 

 

 For node "earth",

    What is the name of the second cluster transport adapter?  vmxnet2

 

    Will this be a dedicated cluster transport adapter (yes/no) [yes]? 

 

 For node "earth",

    Name of the switch to which "vmxnet2" is connected [switch2]? 

 

 For node "earth",

    Use the default port name for the "vmxnet2" connection (yes/no) [yes]? 

 

 For node "mars",

    What is the name of the first cluster transport adapter?  vmxnet1

 

    Will this be a dedicated cluster transport adapter (yes/no) [yes]? 

 

 For node "mars",

    Name of the switch to which "vmxnet1" is connected [switch1]? 

 

 For node "mars",

    Use the default port name for the "vmxnet1" connection (yes/no) [yes]? 

 

 For node "mars",

    What is the name of the second cluster transport adapter?  vmxnet2

 

    Will this be a dedicated cluster transport adapter (yes/no) [yes]? 

 

 For node "mars",

    Name of the switch to which "vmxnet2" is connected [switch2]? 

 

 For node "mars",

    Use the default port name for the "vmxnet2" connection (yes/no) [yes]? 

 

 

  >>> Quorum Configuration <<<

 

    Every two-node cluster requires at least one quorum device. By

    default, scinstall will select and configure a shared SCSI quorum

    disk device for you.

 

    This screen allows you to disable the automatic selection and

    configuration of a quorum device.

 

    The only time that you must disable this feature is when ANY of the

    shared storage in your cluster is not qualified for use as a Sun

    Cluster quorum device. If your storage was purchased with your

    cluster, it is qualified. Otherwise, check with your storage vendor

    to determine whether your storage device is supported as Sun Cluster

    quorum device.

 

    If you disable automatic quorum device selection now, or if you

    intend to use a quorum device that is not a shared SCSI disk, you

    must instead use scsetup(1M) to manually configure quorum once both

    nodes have joined the cluster for the first time.

 

    Do you want to disable automatic quorum device selection (yes/no) [no]? 

 

 

 

    Is it okay to create the new cluster (yes/no) [yes]? 

 

    During the cluster creation process, sccheck is run on each of the

    new cluster nodes. If sccheck detects problems, you can either

    interrupt the process or check the log files after the cluster has

    been established.

 

    Interrupt cluster creation for sccheck errors (yes/no) [no]? 

 

 

  Cluster Creation

 

    Log file - /var/cluster/logs/install/scinstall.log.1312

 

    Testing for "/globaldevices" on "earth" ... done

    Testing for "/globaldevices" on "mars" ... done

 

    Started sccheck on "earth".

    Started sccheck on "mars".

 

    sccheck completed with no errors or warnings for "earth".

    sccheck completed with no errors or warnings for "mars".

 

 

    Configuring "mars" ... done

    Rebooting "mars" ... done

 

    Configuring "earth" ... done

    Rebooting "earth" ... done

 
 
Ok, now you should have both machines working as a cluster (let's check with scstat command):
 
 
 # scstat

------------------------------------------------------------------
 
-- Cluster Nodes --
                    Node name           Status
                    ---------           ------
  Cluster node:     mars                Online
  Cluster node:     earth               Online
 
------------------------------------------------------------------
 
-- Cluster Transport Paths --
 
                    Endpoint               Endpoint               Status
                    --------               --------               ------
  Transport path:   mars:vmxnet2           earth:vmxnet2          Path online
  Transport path:   mars:vmxnet1           earth:vmxnet1          Path online
 
------------------------------------------------------------------
 
-- Quorum Summary --
 
  Quorum votes possible:      3
  Quorum votes needed:        2
  Quorum votes present:       3

-- Quorum Votes by Node --
 
                    Node Name           Present Possible Status
                    ---------           ------- -------- ------

  Node votes:       mars                1        1       Online
  Node votes:       earth               1        1       Online
 

-- Quorum Votes by Device --
 
                    Device Name         Present Possible Status
                    -----------         ------- -------- ------

  Device votes:     /dev/did/rdsk/d3s2  1        1       Online
 
------------------------------------------------------------------
 
-- Device Group Servers --
 
                         Device Group        Primary             Secondary
                         ------------        -------             ---------
 

-- Device Group Status --
 
                              Device Group        Status
                              ------------        ------
 

-- Multi-owner Device Groups --
 
                              Device Group        Online Status
                              ------------        -------------
 
 
------------------------------------------------------------------
------------------------------------------------------------------
 
-- IPMP Groups --
 
              Node Name           Group   Status         Adapter   Status
              ---------           -----   ------         -------   ------

  IPMP Group: mars                sc_ipmp0 Online         vmxnet0   Online
  IPMP Group: earth               sc_ipmp0 Online         vmxnet0   Online
 
 
------------------------------------------------------------------
 
 
Your cluster is ready! =)
 
Below you can find some "must use" tips taken from Geoff Ongley's homepage and also an example taken from ES-345 course material (a simple daemon managed by the cluster - useful to make failover/failback simulations):
 
 
 
 
Discovered Problems
 
Interconnect (”Cluster Transport”) is marked faulted
 

For example, if you do an scstat, or an scstat -W you see:

  Transport path:   mail-store1:e1000g2    mail-store0:e1000g2    faulted

  Transport path:   mail-store1:e1000g1    mail-store0:e1000g1    Path online

 

(at boot it might be “waiting” for quite some time)

In some cases you can disconnect and reconnect the adapter in VMware. However, in others you may have to be more drastic.

Check you can ping the other node via this path - if you can, then you should be all good to run the following commands:

 scconf -c -m endpoint=mail-store0:e1000g2,state=disabled

 

where mail-store0 is your current node, and e1000g2 is the failed adapter. After you’ve done this, you can re-enable it:

scconf -c -m endpoint=mail-store0:e1000g2,state=enabled

 

And you should now have an online path shortly afterwards:

bash-3.00# scstat -W

 

-- Cluster Transport Paths --
 

                    Endpoint               Endpoint               Status

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

  Transport path:   mail-store1:e1000g2    mail-store0:e1000g2    Path online

  Transport path:   mail-store1:e1000g1    mail-store0:e1000g1    Path online

 

All good
 

Cluster Panics with pm_tick delay [number] exceeds [another number]

Try the following:

  1. Stop VMs being paged to disk in VMWare (only use physical memory for your VMs). This is a VMWare server, host setting from memory
  2. Ensure Memory Trimming is disabled for your VMware Server Sun Cluster Guests
  3. On each Cluster node, in order, configure the heartbeats to be father apart, and have a longer timeout:

scconf -w heartbeat_timeout=60000

 

scconf -w heartbeat_quantum=10000

 

Hopefully this will leave you with a much more stable cluster on VMware.

 

Making a Customized Application Fail Over With a Generic Data Service Resource

 

In this task, you can see how easy it is to get any daemon to fail over in the cluster, by using the Generic Data Service (so that you do not have to invent your own resource type).

 

Perform the following steps on the nodes indicated:

 

1. On all nodes (or do it on one node and copy the file to other nodes in the same location), create a daemon that represents your customized application:

 

# vi /var/tmp/myappdaemon

#!/bin/ksh

while :

do

sleep 10

done

 

2. Make sure the file is executable on all nodes.

 

3. From any one node, create a new failover resource group for your application:

 

# clrg create -n node1,node2,[node3] myapp-rg

 

4. From one node, register the Generic Data Service resource type:

 

# clrt register SUNW.gds

 

5. From one node, create the new resource and enable the group:

 

# clrs create -g myapp-rg -t SUNW.gds \

-p Start_Command=/var/tmp/myappdaemon \

-p Probe_Command=/bin/true -p Network_aware=false \

myapp-res

 

# clrg online -M myapp-rg

 

6. Verify the behavior of your customized application.

 

a. Verify that you can manually switch the group from node to node.

 

b. Kill the daemon. Wait a little while and note that it restarts on the same node. Wait until clrs status shows that the resource is fully online again.

 

c. Repeat step b a few times. Eventually, the group switches over to the other node.

 

Web site design service
Web site design service