Thursday, April 23, 2009

Solaris Command

System Information


Print system information

# prtconf

Check the memory

# prtconf | grep Memory

Swap administration, check swap size

# man swap
# swap -s


Describe instruction set architectures

# isainfo -kv

To find if the system is 32 bit or 64 bit

# isainfo -v


Packages


Extract from URL http://www.softpanorama.org/Solaris/Packages/index.shtml

All the software distributed as part of Solaris by Sun is released in package format. This includes all the standard shells and command sets. Packages clearly emerge as the preferred way of distributing software on Solaris specifically due to the following features:

Uniform package installation and removal interfaces (pkgadd and pkgrm) Ability to see exactly which (versions of) packages are installed on the system (pkgchk -l) Ability to verify the integrity of the contents of the package (pkgchk -p -l) Ability to specify package dependencies and/or incompatibilities (depend, compver) Ability to specify additional space requirements for the package (space) Ability to create custom, dynamic package installation and removal scripts (request, checkinstall, preinstall, postinstall; preremove, postremove, and Class Action scripts) It is possible to convert RPM to Solaris packages.

The most commonly used package management commands are:

pkgadd Adds a package to the target system. Only root can run "pkgadd" pkgrm Removes an installed package from a target system pkgchk Checks a file to determine from which package it was installed. In case you suspect unauthorized modification of the file you can check which package an installed file was extracted from by using the pkgchk command. pkginfo -- list of installed packages pkgadm Here is a list of typical commands used :

To add a package
# pkgadd -d
# pkgadd -d . , for example pkgadd -d . SFWsnort

To remove a package
# pkgrm

To get short description (info) on a package
# pkginfo -x
# pkginfo -l

To list all installed packages
# pkginfo

To list the files that constitute the package
# pkgchk -l
# pkgchk -l | grep Pathname # lists files only.
# pkgchk -d -l

To what package the file /usr/bin/ls belongs:
# pkgchk -lp /usr/bin/ls
or
# grep /var/sadm/install/contents

To find out what files are in a package
# grep /var/sadm/install/contents

To find out what runlevel you're in
# who -r

Services

Observing services, lets say sendmail service

#svcs -d network/smtp:sendmail
#svcs -p network/smtp:sendmail




X Applications


Clock

#/usr/openwin/bin/xclock

Move File System from ZFS to UFS

# zpool create rootpool c0t1d0s1
# zfs create rootpool/rootfs
# zfs set mountpoint=legacy rootpool/rootfs
# mkdir /zfsroot
# mount -F zfs rootpool/rootfs /zfsroot

add this entry in /etc/vfstab:

rootpool/rootfs   -                       /backup zfs     1  yes     -


Moving back from ZFS to UFS:

Identify which disk was used from zfs, in our case it was "c0t1d0s1"

#zpool destroy -R rootpool
#newfs /dev/dsk/c0t0d0s1

Check the file system

# fstyp /dev/dsk/c0t0d0s1
ufs

and mount it to use

#mount /dev/dsk/c0t0d0s1 /dirname

plz note that above mount is temporary, to make it permanent make entry in /etc/vfstab.

Comment the /etc/vfstab entry from zfs and uncomment the entry for the above partition and give

#mount -a



Some additional command for adding/deleting & setting mount point for ZFS filesystem.

# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
newpool 11.0G 123G 94K /newpool
newpool/ROOT 4.43G 123G 18K legacy
newpool/ROOT/solaris10_8 4.43G 123G 4.43G /
newpool/dump 1.50G 123G 1.50G -
newpool/export 142K 123G 20K /export
newpool/export/home 122K 123G 122K /export/home
newpool/opt 18K 123G 18K /opt
newpool/swap 1G 124G 16K -
newpool/u01 4.08G 123G 4.08G /u01
#zfs destroy -rf newpool/export
#zfs create newpool/export_home
#zfs set mountpoint=/export/home newpool/export_home
# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
newpool 14.8G 119G 94K /newpool
newpool/ROOT 3.99G 119G 18K legacy
newpool/ROOT/solaris10_8 3.99G 119G 3.99G /
newpool/dump 1.50G 119G 1.50G -
newpool/export_home 158M 119G 158M /export/home
newpool/opt 4.08G 119G 4.08G /opt
newpool/swap 1G 120G 16K -
newpool/u01 4.08G 119G 4.08G /u01



Reference

http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide

How to create SWAP in Live Linux Server

How to create SWAP in Live Linux Server

[root@manage squid]# free -m

             total       used       free     shared    buffers     cached
Mem: 1005 712 292 0 23 231
-/+ buffers/cache: 457 547
Swap: 250 21 229

[root@manage squid]# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda5 695M 373M 287M 57% /
/dev/sda1 23M 9.0M 13M 42% /boot
/dev/sda9 197M 928k 186M 0% /home
/dev/sda6 486M 156M 305M 34% /usr/local
/dev/sda7 32G 14G 16G 48% /var

[root@manage /]# dd if=/dev/zero of=/var/swapfile count=1024 bs=1024000

1024+0 records in
1024+0 records out

[root@manage /]# mkswap /var/swapfile

Setting up swapspace version 1, size = 1048571904 bytes

[root@manage /]# swapon /var/swapfile

[root@manage /]# free -m

             total       used       free     shared    buffers     cached
Mem: 1005 992 12 0 26 750
-/+ buffers/cache: 215 789
Swap: 1250 24 1226

[root@manage /]# vi /etc/fstab

/dev/sda5               /                       newfs   defaults        1 1
/dev/sda1 /boot newfs defaults 1 2
/dev/sda9 /home newfs defaults 1 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
/dev/sda6 /usr/local newfs defaults 1 2
/dev/sda7 /var newfs defaults 1 2
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/sda8 swap swap defaults 0 0
/var/swapfile swap swap defaults 0 0

Labels: