Tag Archives: Solaris

File System shows 100% occupied but du tells different and still has Unused Spaces.

We have faced an issue as below mentioned – found /oracle mount-point showing 100% as Used. But getting different size values for folders under /oracle mount-point, when we executed du -gs .

bash-4.4# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 4.00 1.39 66% 20686 6% /
/dev/hd2 4.00 1.02 75% 45679 16% /usr
/dev/hd9var 2.00 1.01 50% 16318 7% /var
/dev/hd3 2.00 1.83 9% 407 1% /tmp
/dev/hd1 1.00 0.16 85% 6124 12% /home
/dev/hd11admin 0.25 0.25 1% 5 1% /admin
/proc – – – – – /proc
/dev/hd10opt 0.50 0.07 87% 12979 44% /opt
/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 198.00 0.01 100% 440205 16% /oracle

bash-4.4# cd /oracle/
bash-4.4# du -gs *
0.00 AutoDeployment
5.45 Oracle
0.03 Patch
7.54 data01
11.67 fmw_12.1.3.0.0_wls
0.01 jboss
0.20 jdk
0.00 lost+found
0.92 wls1221

You may notice 100 % utilization for /oracle mount-point on the “df -g” output , but with “du -gs ” We found the files did not occupy the entire space.

It may be because of open files in the file-system. These open files hold space on the file-system to complete there execution, once the write operation is completed. 

To overcome, from this issue, We need to follow below two steps:-

  1. We need to find all such processes still running but using deleted files, in result – /oracle mount-point is showing 100% as Used.

bash-4.4# fuser -dV /oracle/
/oracle/:
inode=670047 size=5242722 fd=389 5570776
inode=1165305 size=20278 fd=1 8061106
inode=1165313 size=182335565824 fd=1 8716486
inode=1165305 size=20278 fd=1 9044152
inode=1165313 size=182335565824 fd=1 9371672
inode=1165305 size=20278 fd=1 11141354
inode=669981 size=5514335 fd=1 13041898


2. We have to kill all such processes as found in above command.

bash-4.4# kill -9 5570776
bash-4.4# kill -9 8061106
bash-4.4# kill -9 8716486
bash-4.4# kill -9 9044152
bash-4.4# kill -9 9371672
bash-4.4# kill -9 11141354
bash-4.4# kill -9 13041898

bash-4.4# fuser -dV /oracle/
/oracle/:

bash-4.4# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 4.00 1.39 66% 20686 6% /
/dev/hd2 4.00 1.02 75% 45679 16% /usr
/dev/hd9var 2.00 1.01 50% 16318 7% /var
/dev/hd3 2.00 1.83 9% 407 1% /tmp
/dev/hd1 1.00 0.16 85% 6124 12% /home
/dev/hd11admin 0.25 0.25 1% 5 1% /admin
/proc – – – – – /proc
/dev/hd10opt 0.50 0.07 87% 12979 44% /opt
/dev/livedump 0.25 0.25 1% 4 1% /var/adm/ras/livedump
/dev/fslv00 198.00 170.01 15% 440205 1% /oracle
bash-4.4# cd /oracle/
bash-4.4# du -gs *
0.00 AutoDeployment
5.45 Oracle
0.03 Patch
7.54 data01
11.67 fmw_12.1.3.0.0_wls
0.01 jboss
0.20 jdk
0.00 lost+found
0.92 wls1221

What process is listening on a certain port on Solaris? / How to find out which process listens on certain port on Solaris?

Scenario: I’m looking for PID for which PORT 2817 is using here in Solaris 11.

-bash-3.2# netstat -an | grep 2817
*.2817 *.* 0 0 49152 0 LISTEN
10.0.50.81.2817 10.0.50.81.37374 49152 0 49152 0 CLOSE_WAIT
10.0.50.81.2817 10.0.50.81.35510 49152 0 49152 0 CLOSE_WAIT
10.0.50.81.2817 10.0.50.81.34478 49152 0 49152 0 CLOSE_WAIT

Here is a script, I found somewhere which actually works. This script worked to find PID from port number, If lsof command/utility is not available with server.

Save this script as Port_check.sh and grant execute permissions using chmod 777 to this script.

————————————————————————————-

#!/bin/ksh

line=’———————————————‘
pids=$(/usr/bin/ps -ef | sed 1d | awk ‘{print $2}’)

if [ $# -eq 0 ]; then
read ans?”Enter port you would like to know pid for: “
else
ans=$1
fi

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
echo “Port: $ans is being used by PID:\c”
/usr/bin/ps -ef -o pid -o args | egrep -v “grep|pfiles” | grep $f
fi
done
exit 0

————————————————————————————-
Now the syntax of using this script is
./Port_check.sh <port number>

For example, to find which process is using TCP port 2817,

-bash-3.2# ./Port_check.sh 2817
———————————————
Port: 2817 is being used by PID:26222 /data01/IBM/WebSphere/AppServer/java_1.7_64/bin/sparcv9/java -XX:+UnlockDiagnos

So, Here is PID 26222 using port 2817.

Thanks…

Solaris script to scan FiberChannel bus for new LUN

Here is a script that I use to re-scan the FiberChannel bus for new or removed volumes on Solaris 10.

WARNING!: This script works for me, but use it at your own risk! Make sure you look through the script and make sure it doesn’t do anything that would be unusual on your system. I take no responsibility if you use this script and it erases all of your production data. :)

#!/bin/sh

# This will scan the Fiber Channel bus on Solaris servers

# using cfgadm and then run devfsadm -C.

# I *think* I’ve got it set up so that it will autodetect

# the controller # that the HBA is recognized as.

# Usually it’s c2 and c4, but it might be different.

 

CONTROLLER=”UNSET”

for CONTROLLER in `/usr/sbin/cfgadm -al | grep fc-fabric | grep connected | grep

configured | awk ‘{print $1}’`; do

        if [ ${CONTROLLER} = “UNSET” ]; then

                echo “”

                echo “No Fiber HBA Controllers found.”

                exit 1

        fi

        echo “”

        echo “Scanning FC Bus on Controller ${CONTROLLER}…”

        cfgadm -o force_update -c configure ${CONTROLLER}

done

 

echo ” “

echo “Reconfiguring devices…”

/usr/sbin/devfsadm -C

 

echo “”

echo “FC Bus scan complete.”

How to Rescan new LUN’s added in Linux, HP-UX, Aix, Solaris ?

HP-UX

1. Rescan the devices:

ioscan -fnC <disk|tape>

2. Generate device files:

 insf -e

3. Verify the new devices:

 ioscan -funC <disk|tape>

AIX

1. Rescan the devices ):

 cfgmgr -vl fcsx

Where x is FC adapter number

2. Verify the new devices:

 lsdev -Cc <disk|tape>

Linux

The rescan in Linux is HBA-specific.

For QLogic:

echo scsi-qlascan > /proc/scsi/qla<model#>/<adapter instance>

For Emulex:

 sh force_lpfc_scan.sh lpfc<adapter-instance>

For each identified device, run the following:

echo scsi add-single-device <host> <channel> <ID> <lun> >   /proc/scsi/scsi

Solaris

1. Determine the FC channels:

 cfgadm -al

2. Force rescan :

 cfgadm -o force_update -c configure cx

Where x is the FC channel number

3. Force rescan at HBA port level:

 luxadm -e forcelip /dev/fc/fpx

4. Force rescan on all FC devices:

 cfgadm -al -o show_FCP_dev

5. Install device files:

 devfsadm

6. Display all Qlogic HBA ports

 luxadm -e port

7. Display HBA port information

 luxadm -v display <WWPN>

8. Display HBA port information

 luxadm -e dump_map

Notes If one specific SANclient is missing a drive, please verify that your zoning is correct. Please also make sure the host initiator and VTL™s target ports are showing online via the Fibre Channel switch. (Check HBA link light and check the cable.)

 

Configuring X-Server Display For Oracle Solaris 11

What is X Window ?

The X Window System, commonly referred to as X, is a network-based graphical window system.
The X Window System uses a client-server architecture. It enables multiple programs to share and access a common set of hardware.
This hardware includes both input and display devices such as mouse, keyboards, video adapters, and monitors that are connected to the server.

The X Window System consists of X server and X clients.
The X clients are application programs that do not have direct access to the display.
They communicate with the X server which provides the display.

A proper X client-server setup is requires for Oracle’s Universal Installer ,because OUI is a X-window client which
requires a X-Server display to connect to, for its GUI.

What Packages are required ?

 

Packages Description
pkg://solaris/x11/x11-server-utilities X11 server state utilities
pkg://solaris/x11/session/xauth X authority file utility
pkg://solaris/library/motif Used for Motif-based Toolkit
pkg:/system/library/c++-runtime Sun Workshop Compilers Bundled libC
pkg:/system/library/math Math Libraries
pkg:/desktop/window-manager/twm Tab Window Manager for the X Window
pkg:/system/library System Lib files
pkg:/library/zlib The Zip compression library
pkg:/x11/library/libx11 X11 core protocol client library
pkg:/x11/library/libxau X authorization database library
pkg:/x11/library/libxdmcp X Display Manager Control Protocol
pkg:/x11/library/libxext X11 protocol common extensions client
pkg:/x11/library/libxtst libXtst – X Test and Record library
pkg:x11/library/toolkit/libxt X Toolkit Intrinsics library
pkg://solaris/terminal/xterm Terminal emulator for X
pkg://solaris/x11/xclock Displays the time in analog or digital form.

How to configure Xorg included in the Oracle Solaris OS ?

Xorg: Is installed by default .Present in directory /usr/bin/Xorg .
The Xorg server is designed to configure automatically and can run in most situations without the need to edit configuration files.
When configuration is needed, the Xorg server gathers configuration details from xorg.conf the Xorg server configuration file /etc/X11/ directory.

Note :
Xorg packages are included on the Live Media, but not with the text installer.Symbolic links for
X Window System software compatibility with other releases is also present in the directory /usr/X11R6 .

pkg info x11/server/xorg

Name: x11/server/xorg
Summary: Xorg – X11R7 X server
Publisher: solaris
Version: 1.12.2
Build Release: 5.11

How to Configure Xming ?

Download xming, install it on your windows pc system.You can go to http://sourceforge.net/projects/xming/files/ to download.

Do the following changes for Xming configuration on you windows pc:

Add a new entry in C:\Program Files\Xming\X0.hosts

ex. :

localhost
<IP address of server>

Login through putty client to the server :
export DISPLAY=<windows-pc-IP>:0.0
xhost +

To check if the X Window server-client is working You can use either of the applications :

XCLOCK-Displays the time in analog or digital form.

You will then see a clock gui pop up in your windows pc.

Which Toolkit does OUI use ?

Solaris will continue to use the MToolkit (Motif-based Toolkit) as the default in J2SE 5.0, but eventually will be replaced with XToolkit in JDK7.

The new XToolkit implementation provides the following advantages:
-Removes the dependency on Motif and Xt libraries.
-Interoperates better with other GUI Toolkits.
-Provides better performance and quality.

Setting the toolkit for an application:
Using an environment variable. This needs to be set before starting the VM.
csh:
setenv AWT_TOOLKIT XToolkit #selects the XToolkit
setenv AWT_TOOLKIT MToolkit #selects the MToolkit (Motif-based Toolkit)

export AWT_TOOLKIT=XToolkit
export AWT_TOOLKIT=MToolkit

How to configure VNC if the Xorg does not work ?

However for some reason the above method doesnot work the easiest is doing this via VNC as
it removes the requirement of having to have a X-Server installed on your client platform.
Install VNC server on your Oracle server platform as described in next step.
Xvnc:
Runs a VNC session that can be connected by using a VNC client. Virtual Network Computing (VNC) is a
remote software application that enables you to view and interact with one computer desktop,
the Xvnc server, by using the VNC viewer on another computer desktop.
The two computers do not have to be running the same type of operating system. Xvnc provides a guest domain graphical login.

pkg install xvnc

pkg info xvnc – Would list the package installed .
How to Start VNC Manually ?

Run VNC server as the oracle user .
Start the VNC server.
$ /usr/bin/vncserver
Enter the VNC server password.
Password:
Verify:
New ‘myhost:2 ()’ desktop is myhost:2

Creating default startup script /home/oracle/.vnc/xstartup
Creating default startup script /home/oracle/.vnc/xstartup
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/myhost:2.log

From your client (likely Windows), run VNC viewer and connect to oracle’s VNC server display.
# vncviewer hostname:portnumber
For example:

# vncviewer myhost:2
Type the password you provided to the vncserver script.

High Memory Utilized by ZFS File Data in Solaris

Today, In one of the server 42 % of the Physcial Memory has been allocated to ZFS File Data.

root@qctsun02:/tmp# echo ::memstat | mdb -k
Page Summary                Pages                MB  %Tot
------------     ----------------  ----------------  ----
Kernel                     337924              2640   16%
ZFS File Data              884736              6912   42%
Anon                       694708              5427   33%
Exec and libs               27627               215    1%
Page cache                  67434               526    3%
Free (cachelist)              976                 7    0%
Free (freelist)             83747               654    4%
Total                     2097152             16384

However the huge ZFS caches can cause a problem with applications which allocates a lot of memory on start up (for example Java-based applications).

The ideal size of the ZFS cache depends on what type of data you have, and how much data you have.

You can limit the size of the ZFS file cache by setting the zfs_arc_max in /etc/system as per your requirement, for example:

* limit ZFS ARC cache to 2G max: set zfs:zfs_arc_max =  2147483648

Observe with MDB and KStats :

root@qctsun02:/tmp# echo "::arc" | mdb -k
hits                      =    116086563
misses                    =     18255374
demand_data_hits          =     68163338
demand_data_misses        =     10123941
demand_metadata_hits      =     34673799
demand_metadata_misses    =       168035
prefetch_data_hits        =     12734721
prefetch_data_misses      =      7917615
prefetch_metadata_hits    =       514705
prefetch_metadata_misses  =        45783
mru_hits                  =    110075513
mru_ghost_hits            =            0
mfu_hits                  =     64792021
mfu_ghost_hits            =            0
deleted                   =     17522433
mutex_miss                =        19971
hash_elements             = 18446744073704262340
hash_elements_max         = 18446744073709551615
hash_collisions           =     25979272
hash_chains               = 18446744073708099047
hash_chain_max            =            8
p                         =           65 MB
c                         =           72 MB
c_min                     =           64 MB
c_max                     =         2048 MB
size                      =           70 MB
buf_size                  =            1 MB
data_size                 =           47 MB
other_size                =           20 MB
evict_mfu                 =      1491880 MB
evict_mru                 =       621150 MB
evict_l2_cached           =            0 MB
evict_l2_eligible         =      1801428 MB
evict_l2_ineligible       =       311601 MB
l2_hits                   =            0
l2_misses                 =     10291976
l2_feeds                  =            0
l2_rw_clash               =            0
l2_read_bytes             =            0 MB
l2_write_bytes            =            0 MB
l2_writes_sent            =            0
l2_writes_done            =            0
l2_writes_error           =            0
l2_writes_hdr_miss        =            0
l2_evict_lock_retry       =            0
l2_evict_reading          =            0
l2_abort_lowmem           =            0
l2_cksum_bad              =            0
l2_io_error               =            0
l2_hdr_size               =            0 MB
memory_throttle_count     =          321
meta_used                 =           22 MB
meta_max                  =          121 MB
meta_limit                =            0 MB
arc_no_grow               =            0
arc_tempreserve           =            0 MB
root@qctsun02:/tmp#

How to Enable / Disable Multipathing Solaris 11 ?

How to Enable Multipathing

  1. Become an administrator.
  2. Confirm that the multipathing software package is installed.
    # pkg info system/storage/multipath-utilities
              Name: system/storage/multipath-utilities
           Summary: Solaris Multipathing CLI
       Description: Path Administration Utility for a Solaris Multipathing device
          Category: Applications/System Utilities
             State: Installed
         Publisher: solaris
           Version: 0.5.11
     Build Release: 5.11
            Branch: 0.175.0.0.0.0.0
    Packaging Date: Tue Sep 27 01:40:01 2011
              Size: 77.29 kB
              FMRI: pkg://solaris/system/storage/multipath-utilities@
    0.5.11,5.11-0.175.0.0.0.0.0:20110927T014001Z

    If not, install it.

    # pkg install system/storage/multipath-utilities
  3. Enable device multipathing.
    # stmsboot -e
    WARNING: stmsboot operates on each supported multipath-capable controller
                 detected in a host. In your system, these controllers are
    
        /devices/pci@780/pci@0/pci@8/SUNW,qlc@0/fp@0,0
        /devices/pci@780/pci@0/pci@8/SUNW,qlc@0,1/fp@0,0
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2
        /devices/pci@7c0/pci@0/pci@9/LSILogic,sas@0
        /devices/pci@7c0/pci@0/pci@9/LSILogic,sas@0
    
        If you do NOT wish to operate on these controllers, please quit stmsboot
        and re-invoke with -D { fp | mpt } to specify which controllers you wish
        to modify your multipathing configuration for.
    
        Do you wish to continue? [y/n] (default: y) y
        Checking mpxio status for driver fp
        Checking mpxio status for driver mpt
        WARNING: This operation will require a reboot.
        Do you want to continue ? [y/n] (default: y) y
        The changes will come into effect after rebooting the system.
        Reboot the system now ? [y/n] (default: y) y

    Note – During the reboot, /etc/vfstab and the dump configuration are updated to reflect the device name changes.


How to Disable Multipathing

  1. Disable device multipathing.
    # stmsboot -d
    WARNING: stmsboot operates on each supported multipath-capable controller
                 detected in a host. In your system, these controllers are
    
        /devices/pci@780/pci@0/pci@8/SUNW,qlc@0/fp@0,0
        /devices/pci@780/pci@0/pci@8/SUNW,qlc@0,1/fp@0,0
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@1
        /devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2
        /devices/pci@7c0/pci@0/pci@9/LSILogic,sas@0
        /devices/pci@7c0/pci@0/pci@9/LSILogic,sas@0
    
        If you do NOT wish to operate on these controllers, please quit stmsboot
        and re-invoke with -D { fp | mpt } to specify which controllers you wish
        to modify your multipathing configuration for.
    
        Do you wish to continue? [y/n] (default: y) y
        Checking mpxio status for driver fp
        Checking mpxio status for driver mpt
        WARNING: This operation will require a reboot.
        Do you want to continue ? [y/n] (default: y) y
        The changes will come into effect after rebooting the system.
        Reboot the system now ? [y/n] (default: y) y

    Note – During the reboot, /etc/vfstab and the dump configuration are updated to reflect the device name changes.


How to Increase swap size on Solaris (using ZFS) solaris 11

Firstly, check where your swap file is (it will be a ZFS volume created during the Solaris installation):

bash-3.00# swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 256,1      16 4194288 4194288

Then you will need to unmount it:

bash-3.00# swap -d /dev/zvol/dsk/rpool/swap

You should validate it is unmounted:

bash-3.00# swap -l
No swap devices configured

Then you can resize the ZFS volume (just give it the pool name and the volume name):

bash-3.00# zfs set volsize=16G rpool/swap

And then add it back into your swap space:

bash-3.00# swap -a /dev/zvol/dsk/rpool/swap

And now we see the swap space is back online and larger than before:

bash-3.00# swap -l
swapfile             dev  swaplo blocks   free
/dev/zvol/dsk/rpool/swap 256,1      16 33554416 33554416

Enjoy !!

How to enable remote XDMCP in Solaris 10 ?

Solaris 10 is secure by default and starts services on localhost instead of system name or all hosts(*) . Due to that if you try to connect to server over xdmcp using exceed on demand or something you won’t get connection. For that we need to use following method to fix it.

if you issue ps on dtlogin. It might come up like this and listens on udp port 0 instead of 177.

#ps –ef |grep –i dtlogin

/usr/dt/bin/dtlogin -daemon -udpPort 0

You can change the above behaviour by using svccfg and change the properties.

#svccfg -s cde-login setprop ‘dtlogin/args=””‘

#svcadm restart cde-login # or #svcadm enable -r cde-login

After these system should respond to xdmcp broadcast queries.

Solaris 10’s desktop environment is JDS which is based off of GNOME.

Log in as root
Open a terminal
Type gdmsetup (a dialog box will appear)
Click on the XDMCP tab
Check the Enable XDMCP box
Press Close

Check service of gdm2-login and enable it.

bash-3.00# svcs -a | grep gdm
disabled       Oct_10   svc:/application/gdm2-login:default

bash-3.00# svcadm enable svc:/application/gdm2-login:default
bash-3.00# svcs -a | grep gdm
online         10:37:05 svc:/application/gdm2-login:default