赞
踩
############################################
SECTION 1. COMMANDS TO RETREIVE SYSTEMINFO:
############################################
==========================
1. HOW TO GET SYSTEM INFO:
==========================
1.1 Short version:
==================
See section 1.2 for more detailed commandsand options.
Memory:
-------
AIX: bootinfo -r
lsattr -E -lmem0
/usr/sbin/lsattr -E -l sys0 -a realmem
or use a tool as "topas" or"nmon" (these are utilities)
Linux: cat /proc/meminfo
/usr/sbin/dmesg | grep "Physical"
free (the free command)
HP: /usr/sam/lbin/getmem
grep MemTotal /proc/meminfo
/etc/dmesg | grep -i phys
wc -c /dev/mem
or us a tool as "glance", likeentering "glance -m" from prompt (is a utility)
Solaris: /usr/sbin/prtconf | grep"Memory size"
Tru64: /bin/vmstat -P | grep "TotalPhysical Memory"
Swap:
-----
AIX: /usr/sbin/lsps -a
HP: /usr/sbin/swapinfo -a
Solaris: /usr/sbin/swap -l
Linux: /sbin/swapon -s
cat /proc/swaps
cat /proc/meminfo
OS version:
-----------
HP: uname -a
Linux: cat /proc/version
Solaris: uname -a
cat /etc/release (or other way to view thatfile, like "more /etc/release")
Tru64: /usr/sbin/sizer -v
AIX: oslevel -r
lslpp -h bos.rte
AIX firmware:
lsmcode -c display the system firmwarelevel and service processor
lsmcode -r -d scraid0 display the adaptermicrocode levels for a RAID adapter scraid0
lsmcode -A display the microcode level forall supported devices
prtconf shows many setting includingmemory, firmware, serial# etc..
cpu:
----
HP: ioscan -kfnC processor
getconf CPU_VERSION
getconf CPU_CHIP_TYPE
model
AIX: prtconf | grep proc
pmcycles -m
lsattr -El procx (x is 0,2, etc..)
lscfg | grep proc
Linux: cat /proc/cpuinfo
Solaris: psrinfo -v
prtconf
Notes about lpars:
-----------------For
AIX: The uname -L command identifies apartition on a system with multiple
LPARS. The LPAR id
can be useful for writing shell scriptsthat customize system settings such as IP
address or hostname.
The output of the command looks like:
# uname -L
1 lpar01
The output of uname -L varies bymaintenance level. For consistent output across
maintenance levels,
add a -s flag. For illustrate, thefollowing command assigns the partition number
to the variable
"lpar_number" and partiton nameto "lpar_name".
For HP-UX:
Use commands like "parstatus" or"getconf PARTITION_IDENT" to get npar information.
patches:
AIX: Is a certain fix (APAR) installed?
instfix -ik APAR_number
instfix -a -ivk APAR_number
To determine your platform firmware level,at the command prompt, type:
lscfg -vp | grep -p Platform
The last six digits of the ROM levelrepresent the platform firmware date in
the format, YYMMDD.
HP: /usr/sbin/swlist -l patch
swlist | grep patch
Linux: rpm -qa
Solaris: showrev -p
pkginfo -i package_name
Tru64: /usr/sbin/dupatch -track -type kit
Netcards:
AIX: lsdev -Cc adapter
lsdev -Cc adapter | grep ent
lsdev -Cc if
lsattr -E -l ent1
ifconfig -a
Solaris: prtconf -D / prtconf -pv / prtconf| grep "card"
prtdiag | grep "card"
svcs -x
ifconfig -a (up plumb)
.2 More Detail: 1=============== =
.2.1 Show memory in Solaris:
============================
prtconf:
1=
-
Use this command to obtain detailed systeminformation about your Sun Solaris
installation
#/usr/sbin/prtconf
prtconf -v#
U#
Displays the size of the system memory andreports information about peripheral devices
se this command to see the amount ofmemory:
/usr/sbin/prtconf | grep "Mem"
sysdef -i reports on several systemresource limits. Other parameters can be checked
n a running system
sing adb -k :
ou
adb -k /dev/ksyms /dev/mem
parameter-name/D
#
D (to exit)^
.2.2 Show memory inAIX:1======================== =
> Show Total memory: >
-------=====--------
bootinfo -r #
#
#
lsattr -El sys0 -a realmem
(you can grep it on memory)prtconf
> Show Details of memory: >
-
You can have a more detailed andcomprehensive look at AIX memory by using "vmstat
v" and "vmo -L" or "vmo-a":
or example:
-
F
vmstat -v#
524288 memory pages
493252 lruable pages
67384 free pages
7 memory pools
131820 pinned pag
80.0 maxpin percentagees
20.0 minperm percentage
80.0 maxperm percentage
25.4 numperm percentage
125727 file pages
0.0 compressed percentage
0 compressed pages
25.4 numclient percentage
80.0 maxclient percentage
125575 client pages
0 remote pageouts scheduled
14557 pending disk I/Os blocked with nopbuf
6526890 paging space I/Os blocked with nopsbuf
18631 filesystem I/Os blocked with no fsbuf
0 client filesystem I/Os blocked with nofsbuf
49038 external pager filesystem I/Osblocked with no fsbuf
0 Virtualized Partition Memory Page Faults
0.00 Time resolving virtualized partitionmemory page faults
The vmo command really gives lots ofoutput. In the following example only a small
fraction of the output is shown:
# vmo -L
..
lrubucket 128K 128K 128K 64K 4KB pages D
--------------------------------------------------------------------------------
maxclient% 80 80 80 1 100 % memory D
maxperm%
minperm%
--------------------------------------------------------------------------------
maxfree 1088 1088 1088 8 200K 4KB pages D
minfree
memory_frames
--------------------------------------------------------------------------------
maxperm 394596 394596 S
--------------------------------------------------------------------------------
maxperm% 80 80 80 1 100 % memory D
minperm%
maxclient%
--------------------------------------------------------------------------------
maxpin 424179 424179 S
..
..
>> To further look at your virtualmemory and its causes, you can use a combination of:
---------------------------------------------------------------------------------------
# ipcs -bm (shared memory)
# lsps -a (paging)
# vmo -a or vmo -L (virtual memory options)
# svmon -G (basic memory allocations)
# svmon -U (virtual memory usage by user)
To print out the memory usage statisticsfor the users root and steve
taking into account only working segments,type:
svmon -U root steve -w
To print out the top 10 users of the pagingspace, type:
svmon -U -g -t 10
To print out the memory usage statisticsfor the user steve, including the
list of the process identifiers, type:
svmon -U steve -l
svmon -U emcdm -l
Note: sysdumpdev -e
Although the sysdumpdev command is used toshow or alter the dumpdevice for a system
dump,
you can also use it to show how much realmemory is used.
The command
# sysdumpdev -e
provides an estimated dump size taking intoaccount the current memory (not
pagingspace) currently
in use by the system.
Note: the rmss command:
The rmss (Reduced-Memory System Simulator)command is used to ascertain the effects
of reducing the amount
of available memory on a system without theneed to physically remove memory from the
system. It is useful
for system sizing, as you can install morememory than is required and then use rmss
to reduce it.
Using other performance tools, the effectsof the reduced memory can be monitored.
The rmss command has
the ability to run a command multiple timesusing different simulated memory sizes
and produce statistics
for all of those memory sizes.
The rmss command resides in /usr/bin and ispart of the bos.perf.tools fileset, which
is installable
from the AIX base installation media.
Syntax rmss -p -c <MB> -r
Options
-p Print the current value
-c MB Change to M size (in Mbytes)
-r Restore all memory to use
-p Print the current value
Example: find out how much memory you haveonline
rmss -p
Example: Change available memory to 256Mbytes
rmss -c 256
Example: Undo the above
rmss -r
Warning:
rmss can damage performance very seriously
Don't go below 25% of the machines memory
Never forget to finish with rmss -r
1.2.3 Show memory in Linux:
===========================
# /usr/sbin/dmesg | grep"Physical:"
# cat /proc/meminfo
# free -m
The ipcs, vmstat, iostat and that type ofcommands, are ofcourse more or less the same
in Linux as they are in Solaris or AIX.
1.2.4 Show aioservers in AIX:
=============================
# lsattr -El aio0
autoconfig available STATE to be configuredat system restart True
fastpath enable State of fast path True
kprocprio 39 Server PRIORITY True
maxreqs 4096 Maximum number of REQUESTSTrue
maxservers 10 MAXIMUM number of servers percpu True
minservers 1 MINIMUM number of servers True
# pstat -a | grep -c aios
20
# ps -k | grep aioserver
331962 -0:15 aioserver
352478 -0:14 aioserver
450644 -0:12 aioserver
454908 -0:10 aioserver
565292 -0:11 aioserver
569378 -0:10 aioserver
581660 -0:11 aioserver
585758 -0:17 aioserver
589856 -0:12 aioserver
593954 -0:15 aioserver
598052 -0:17 aioserver
602150 -0:12 aioserver
606248 -0:13 aioserver
827642 -0:14 aioserver
991288 -0:14 aioserver
995388 -0:11 aioserver
1007616 -0:12 aioserver
1011766 -0:13 aioserver
1028096 -0:13 aioserver
1032212 -0:13 aioserver
What are aioservers in AIX5?:
With IO on filesystems, for example if adatabase is involved, you may try to tune
the number
of aioservers (asynchronous IO)
AIX 5L supports asynchronous I/O (AIO) fordatabase files created both on file system
partitions and on raw devices.
AIO on raw devices is implemented fullyinto the AIX kernel, and does not require
database processes
to service the AIO requests. When using AIOon file systems, the kernel database
processes (aioserver)
control each request from the time arequest is taken off the queue until it
completes. The kernel database
processes are also used with I/O withvirtual shared disks (VSDs) and HSDs with
FastPath disabled. By default,
FastPath is enabled. The number ofaioserver servers determines the number of AIO
requests that can be executed
in the system concurrently, so it isimportant to tune the number of aioserver
processes when using file systems
to store Oracle Database data files.
- Use one of the following commands to setthe number of servers. This applies only
when using asynchronous I/O
on file systems rather than raw devices:
# smit aio
# chdev -P -l aio0 -a maxservers='128' -aminservers='20'
- To set asynchronous IO to `Available':
# chdev -l aio0 -P -a autoconfig=available
You need to restart the Server:
# shutdown -Fr
1.2.5 aio on Linux distro's:
============================
On some Linux distro's, Oracle 9i/10gsupports asynchronous I/O but it is disabled by
default because
some Linux distributions do not have libaioby default. For Solaris, the following
configuration is not required
- skip down to the section on enablingasynchronous I/O.
On Linux, the Oracle binary needs to berelinked to enable asynchronous I/O. The
first thing to do is shutdown
the Oracle server. After Oracle hasshutdown, do the following steps to relink the
binary:
su - oracle
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk async_on
make -f ins_rdbms.mk ioracle
1.2.6 The ipcs and ipcrm commands:
==================================
The "ipcs" command is really a"listing" command. But if you need to intervene
in memory structures, like for example ifyou need to "clear" or remove a shared
memory segment,
because a faulty or crashed
application left semaphores, memoryidentifiers, or queues in place,
you can use to "ipcrm" command toremove those structures.
Example ipcrm command usage:
Suppose an application crashed, but itcannot be started again. The following might
help,
if you happened to know which IPCidentifier it used.
Suppose the app used 47500 as the IPC key.Calcultate this decimal number to hex
which is, in this example, B98C.
No do the following:
# ipcs -bm | grep B89C
This might give you, for example, theshared memory identifier "50855977".
Now clear the segment:
# ipcrm -m 50855977
It might also be, that still a semaphoreand/or queue is still "left over".
In that case you might also try commandslike the following example:
ipcs -q
ipcs -s
# ipcrm -s 2228248 (remove semaphore)
# ipcrm -q 5111883 (remove queue)
Note: in some cases the"slibclean" command can be used to clear unused modules in
kernel and library memory.
Just give as root the command:
# slibclean
Other Example:
If you run the following command to removea shared memory segment and you get this
error:
# ipcrm -m 65537
ipcrm: 0515-020 shmid(65537) was not found.
However, if you run the ipcs command, youstill see the segment there:
# ipcs | grep 65537
m 65537 0x00000000 DCrw------- root system
If you look carefully, you will notice the"D" in the forth column. The "D" means:
D If the associated shared memory segmenthas been removed. It disappears when the
last process attached
to the segment detaches it.
So, to clear the shared memory segment,find the process which is still associated
with the segment:
# ps -ef | grep process_owner
where process_owner is the name of theowner using the shared segment
Now kill the process found from the pscommand above
# kill -9 pid
Running another ipcs command will show theshared memory segment no longer exists:
# ipcs | grep 65537
Example
ipcrm -m 65537
1.2.7 Show patches, version, systeminfo:
========================================
Solaris:
========
showrev:
--------
#showrev
Displays system summary information.
#showrev -p
Reports which patches are installed
sysdef and dmesg:
-----------------
The follwing commands also displaysconfiguration information
# sysdef
# dmesg
versions:
---------
==> To check your Solaris version:
# uname -a or uname -m
# cat /etc/release
# isainfo -v
==> To check your AIX version:
# oslevel
# oslevel -r tells you which maintenancelevel you have.
>> To find the known recommendedmaintenance levels:
# oslevel -rq
>> To find all filesets lower than acertain maintenance level:
# oslevel -rl 5200-06
>> To find all filesets higher than acertain maintenance level:
# oslevel -rg 5200-05
>> To list all known recommendedmaintenance and technology levels on the system, type:
# oslevel -q -s
Known Service Packs
-------------------
5300-05-04
5300-05-03
5300-05-02
5300-05-01
5300-05-00
5300-04-CSP
5300-04-03
5300-04-02
5300-04-01
5300-03-CSP
>> How can I determine which filesetupdates are missing from a particular AIX level?
To determine which fileset updates aremissing from 5300-04, for example, run the
following command:
# oslevel -rl 5300-04
>> What SP (Service Pack) isinstalled on my system?
To see which SP is currently installed onthe system, run the oslevel -s command.
Sample output for an
AIX 5L Version 5.3 system, with TL4, andSP2 installed would be:
# oslevel -s
5300-04-02
>> Is a CSP (Concluding Service Pack)installed on my system?
To see if a CSP is currently installed onthe system, run the oslevel -s command.
Sample output for an AIX 5L Version 5.3system, with TL3, and CSP installed would be:
# oslevel -s
5300-03-CSP
==> To check your HP machine:
# model
9000/800/rp7410
: machine info on AIX
How do I find out the Chip type, Systemname, Node name, Model Number etc.?
Displays the chipThe uname command providesdetails about your system. uname -p
type of the system.
For example, powerpc.
uname -r Displays the release number of theoperating system.
uname -s Displays the system name. Forexample, AIX.
uname -n Displays the name of the node.
uname -a Displays the system name,nodename,Version, Machine id.
uname -M Displays the system model name.For example, IBM, 7046-B50.
uname -v Displays the operating systemversion
uname -m Displays the machine ID number ofthe hardware running the system.
uname -u Displays the system ID number.
Architecture:
To see if you have a CHRP machine, log intothe machine as the root user, and run the
following command:
# lscfg | grep Architecture or use:
# lscfg -pl sysplanar0 | more
The bootinfo -p command also shows thearchitecture of the pSeries, RS/6000
# bootinfo -p
chrp
1.2.8 Check whether you have a 32 bit or 64 bit version:
========================================================
-Solaris:
# iasinfo -vk
If /usr/bin/isainfo cannot be found, thenthe OS only
supports 32-bit process address spaces.(Solaris 7
was the first version that could run 64-bitbinaries
on certain SPARC-based systems.)
So a ksh-based test might look somethinglike
if [ -x /usr/bin/isainfo ]; then
bits=`/usr/bin/isainfo-b`
else
bits=32
fi
-AIX:
Command: ...to see if bos.64bit isinstalled &/bin/lslpp -l bos.64bit
committed.
-or-/bin/locale64 ...error message if on32bit machine such
as:
Could not load program /bin/locale64:
Cannot run a 64-bit program on a
32-bit machine.
Or use:
# bootinfo -K displays the current kernelwordsize of "32" or "64"
# bootinfo -y tells if hardware is 64-bitcapable
# bootinfo -p If it returns the string 32it is only capable of running the
32-bit kernel. If it returns the stringchrp the machine is
capable of running the 64-bit kernel or the32-bit kernel.
Or use:
# /usr/bin/getconf HARDWARE_BITMODE
This command should return the followingoutput:
64
Note:
HOW TO CHANGE KERNEL MODE OF IBM AIX 5L(5.1)
--------------------------------------------The
AIX 5L has pre-configured kernels. Theseare listed below for Power
processors:
/usr/lib/boot/unix_up 32 bit uni-processor
/usr/lib/boot/unix_mp 32 bit multi-processorkernel
/usr/lib/boot/unix_64 64 bitmulti-processor kernel
Switching between kernel modes means usingdifferent kernels. This is simply
done by pointing the location that isreferenced by the system to these kernels.
Use symbolic links for this purpose. Duringboot AIX system runs the kernel
in the following locations:
/unix
/usr/lib/boot/unix
The base operating system 64-bit runtimefileset is bos.64bit. Installing bos.64bit
also installs
the /etc/methods/cfg64 file. The /etc/methods/cfg64file provides the option of
enabling or disabling
the 64-bit environment via SMIT, whichupdates the /etc/inittab file with the
load64bit line.
(Simply adding the load64bit line does notenable the 64-bit environment).
The command lslpp -l bos.64bit reveals ifthis fileset is installed. The bos.64bit
fileset
is on the AIX media; however, installingthe bos.64bit fileset does not ensure that
you will be able
to run 64-bit software. If the bos.64bitfileset is installed on 32-bit hardware,
you should be able
to compile 64-bit software, but you cannotrun 64-bit programs on 32-bit hardware.
The syscalls64 extension must be loaded inorder to run a 64-bit executable. This
is done from
the load64bit entry in the inittab file.You must load the syscalls64 extension
even when running
a 64-bit kernel on 64-bit hardware.
To determine if the 64-bit kernel extensionis loaded, at the command line, enter
genkex |grep 64.
Information similar to the followingdisplays:
149bf58 a3ec /usr/lib/drivers/syscalls64.ext
To change the kernel mode follow stepsbelow:
1. Create symbolic link from /unix and/usr/lib/boot/unix to the location
of the desired kernel.
2. Create boot image.
3. Reboot AIX.
Below lists the detailed actions to changekernel mode:
To change to 32 bit uni-processor mode:
# ln -sf /usr/lib/boot/unix_up /unix
# ln -sf /usr/lib/boot/unix_up/usr/lib/boot/unix
# bosboot -ad /dev/ipldevice
# shutdown -r
To change to 32 bit multi-processor mode:
# ln -sf /usr/lib/boot/unix_mp /unix
# ln -sf /usr/lib/boot/unix_mp/usr/lib/boot/unix
# bosboot -ad /dev/ipldevice
# shutdown -r
To change to 64 bit multi-processor mode:
# ln -sf /usr/lib/boot/unix_64 /unix
# ln -sf /usr/lib/boot/unix_64/usr/lib/boot/unix
# bosboot -ad /dev/ipldevice
# shutdown -r
IMPORTANT NOTE: If you are changing thekernel mode to 32-bit and you will run
9.2 on this server, the following lineshould be included in /etc/inittab:
load64bit:2:wait:/etc/methods/cfg64>/dev/console 2>&1 # Enable 64-bit execs
This allows 64-bit applications to run onthe 32-bit kernel. Note that this
line is also mandatory if you are using the64-bit kernel.
In AIX 5.2, the 32-bit kernel is installedby default. The 64-bit kernel, along with
JFS2
(enhanced journaled file system), can beenabled at installation time.
Checking if other unixes are in 32 or 64mode:
-Digital UNIX/Tru64: This OS is onlyavailable in 64bit form.
- HP-UX(Available in 64bit starting withHP-UX 11.0):
Command: /bin/getconf KERNEL_BITS ...returnseither 32 or 64
-SGI: This OS is only available in 64bitform.
-The remaining supported UNIX platforms areonly available in 32bit form.
scinstall:
# scinstall -pv
Displays Sun Cluster software release andpackage version information
1.2.9 Info about CPUs:
======================
Solaris:
# psrinfo -v
Shows the number of processors and theirstatus.
# psrinfo -v|grep "Status ofprocessor"|wc -l
Shows number of cpu's
Linux:
# cat /proc/cpuinfo
# cat /proc/cpuinfo | grep processor|wc -l
Especially with Linux, the /proc directorycontains special "files" that either
extract information from
or send information to the kernel
HP-UX:
# ioscan -kfnCprocessor
#/usr/sbin/ioscan -kf | grep processor
# grep processor/var/adm/syslog/syslog.log
# /usr/contrib/bin/machinfo (Itanium)
Several ways as,
1. sam -> performance monitor ->processor
2. print_manifest (if ignite-ux installed)
3. machinfo (11.23 HP versions)
4. ioscan -fnC processor
5. echo "processor_count/D" | adb/stand/vmunix /dev/kmem
6. top command to get cpu count
The "getconf" command can giveyou a lot of interesting info. The parameters are:
ARG_MAX _BC_BASE_MAX BC_DIM_MAX
BS_SCALE_MAX BC_STRING_MAXCHARCLASS_NAME_MAX
CHAR_BIT CHAR_MAXCHAR_MIN
CHILD_MAX CLK_TCK COLL_WEIGHTS_MAX
CPU_CHIP_TYPE CS_MACHINE_IDENTCS_PARTITION_IDENT
CS_PATH CS_MACHINE_SERIAL EXPR_NEST_MAX
HW_CPU_SUPP_BITS HW_32_64_CAPABLE INT_MAX
INT_MINKERNEL_BITS LINE_MAX
LONG_BIT LONG_MAX LONG_MIN
MACHINE_IDENT MACHINE_MODEL MACHINE_SERIAL
MB_LEN_MAX NGROUPS_MAX NL_ARGMAX
NL_LANGMAX NL_MSGMAX NL_NMAX
NL_SETMAX NL_TEXTMAX NZERO
OPEN_MAX PARTITION_IDENT PATH
_POSIX_ARG_MAX _POSIX_JOB_CONTROL_POSIX_NGROUPS_MAX
_POSIX_OPEN_MAX _POSIX_SAVED_IDS_POSIX_SSIZE_MAX
_POSIX_STREAM_MAX _POSIX_TZNAME_MAX_POSIX_VERSION
POSIX_ARG_MAX POSIX_CHILD_MAXPOSIX_JOB_CONTROL
POSIX_LINK_MAX POSIX_MAX_CANONPOSIX_MAX_INPUT
POSIX_NAME_MAX POSIX_NGROUPS_MAXPOSIX_OPEN_MAX
POSIX_PATH_MAX POSIX_PIPE_BUFPOSIX_SAVED_IDS
POSIX_SSIZE_MAX POSIX_STREAM_MAX POSIX_TZNAME_MAX
POSIX_VERSION POSIX2_BC_BASE_MAXPOSIX2_BC_DIM_MAX
POSIX2_BC_SCALE_MAX POSIX2_BC_STRING_MAXPOSIX2_C_BIND
POSIX2_C_DEV POSIX2_C_VERSIONPOSIX2_CHAR_TERM
POSIX_CHILD_MAX POSIX2_COLL_WEIGHTS_MAXPOSIX2_EXPR_NEST_MAX
POSIX2_FORT_DEV POSIX2_FORT_RUNPOSIX2_LINE_MAX
POSIX2_LOCALEDEF POSIX2_RE_DUP_MAXPOSIX2_SW_DEV
POSIX2_UPE POSIX2_VERSION SC_PASS_MAX
SC_XOPEN_VERSION SCHAR_MAX SCHAR_MIN
SHRT_MAX SHRT_MIN SSIZE_MAX
Example:
# getconf CPU_VERSION
sample function in shell script:
get_cpu_version()
{
case `getconf CPU_VERSION` in
# ???) echo "Itanium[TM] 2" ;;
768) echo "Itanium[TM] 1" ;;
532) echo "PA-RISC 2.0" ;;
529) echo "PA-RISC 1.2" ;;
528) echo "PA-RISC 1.1" ;;
523) echo "PA-RISC 1.0" ;;
*) return 1 ;;
esac
return 0
AIX:
# pmcycles -m
Cpu 0 runs at 1656 MHz
Cpu 1 runs at 1656 MHz
Cpu 2 runs at 1656 MHz
Cpu 3 runs at 1656 MHz
# lscfg | grep proc
More cpu information on AIX:
# lsattr -El procx (where x is the numberof the cpu)
type powerPC_POWER5 Processor type False
frequency 165600000 Processor speed False
..
..
where False means that the value cannot bechanged through an AIX command.
To view CPU scheduler tunable parameters,use the schedo command:
# schedo -a
In AIX 5L on Power5, you can switch fromSimultaneous Multithreading SMT, or Single
Threading ST, as follows
(smtcl)
# smtctl -m off will set SMT mode todisabled
# smtctl -m on will set SMT mode to enabled
# smtctl -W boot makes SMT effective onnext boot
# smtctl -W now effects SMT now, but will notpersist across reboots
When you want to keep the setting acrossreboots, you must use the bosboot command
in order to create a new boot image.
1.2.10 Other stuff:
===================
runlevel:
To show the init runlevel:
# who -r
Top users:
To get a quick impression about the top 10users in the system at this time:
ps auxw | sort -r +3 |head -10 -Shows top10 memory usage by process
ps auxw | sort -r +2 |head -10 -Shows top10 CPU usage by process
shared memory:
To check shared memory segment, semaphorearray, and message queue limits, issue the
ipcs -l command.
# ipcs
The following tools are available formonitoring the performance of your UNIX-based
system.
pfiles:
/usr/proc/bin/pfiles
This shows the open files for this process,which helps you diagnose whether you are
having problems
caused by files not getting closed.
lsof:
This utility lists open files for runningUNIX processes, like pfiles. However, lsof
gives more
useful information than pfiles. You canfind lsof at
ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/.
Example of lsof usage:
You can see CIO (concurrent IO) in theFILE-FLAG column if you run lsof +fg, e.g.:
tarunx01:/home/abielewi:#/p570build/LSOF/lsof-4.76/usr/local/bin/lsof +fg
/baanprd/oradat
COMMAND PID USER FD TYPE FILE-FLAG DEVICE
SIZE/OFF NODE NAME
oracle 434222 oracle 16u VREGR,W,CIO,DSYN,LG;CX 39,1
6701056 866 /baanprd/oradat(/dev/bprdoradat)
oracle 434222 oracle 17u VREGR,W,CIO,DSYN,LG;CX 39,1
6701056 867 /baanprd/oradat(/dev/bprdoradat)
oracle 442384 oracle 15u VREGR,W,CIO,DSYN,LG;CX 39,1
1174413312 875 /baanprd/oradat(/dev/bprdoradat)
oracle 442384 oracle 16u VREGR,W,CIO,DSYN,LG;CX 39,1
734011392 877 /baanprd/oradat(/dev/bprdoradat)
oracle 450814 oracle 15u VREGR,W,CIO,DSYN,LG;CX 39,1
1174413312 875 /baanprd/oradat(/dev/bprdoradat)
oracle 450814 oracle 16u VREGR,W,CIO,DSYN,LG;CX 39,1
1814044672 876 /baanprd/oradat(/dev/bprdoradat)
oracle 487666 oracle 15u VREGR,W,CIO,DSYN,LG;CX 39,1
1174413312 875 /baanprd/oradat (/dev/bprdoradat
You should also see O_CIO in your file opencalls if you run truss,
e.g.:
open("/opt/oracle/rcat/oradat/redo01.log",
O_RDWR|O_CIO|O_DSYNC|O_LARGEFILE) = 18
VMSTAT SOLARIS:
# vmstat
This command is ideal for monitoring pagingrate, which can be found under the page
in (pi) and page out (po) columns.
Other important columns are the amount ofallocated virtual storage (avm) and free
virtual storage (fre).
This command is useful for determining ifsomething is suspended or just taking a
long time.
Example:
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m0 m1m3 m4 in sy cs us sy id
0 0 0 2163152 1716720 157 141 1179 1 1 0 00 0 0 0 680 1737 855 10 3 87
0 0 0 2119080 1729352 0 1 0 0 0 0 0 0 0 1 0345 658 346 1 1 98
0 0 0 2118960 1729232 0 167 0 0 0 0 0 0 0 00 402 1710 812 4 2 94
0 0 0 2112992 1723264 0 1261 0 0 0 0 0 0 00 0 1026 5253 1848 10 5 85
0 0 0 2112088 1722352 0 248 0 0 0 0 0 0 0 00 505 2822 1177 5 2 92
0 0 0 2116288 1726544 4 80 0 0 0 0 0 0 0 00 817 4015 1530 6 4 90
0 0 0 2117744 1727960 4 2 30 0 0 0 0 0 0 00 473 1421 640 2 2 97
procs/r: Run queue length.
procs/b: Processes blocked while waitingfor I/O.
procs/w: Idle processes which have beenswapped.
memory/swap: Free, unreserved swap space(Kb).
memory/free: Free memory (Kb). (Note thatthis will grow until it reaches lotsfree,
at which point
the page scanner is started. See"Paging" for more details.)
page/re: Pages reclaimed from the freelist. (If a page on the free list still
contains data needed
for a new request, it can be remapped.)
page/mf: Minor faults (page in memory, butnot mapped). (If the page is still in
memory, a minor fault
remaps the page. It is comparable to thevflts value reported by sar -p.)
page/pi: Paged in from swap (Kb/s). (When apage is brought back from the swap
device, the process
will stop execution and wait. This mayaffect performance.)
page/po: Paged out to swap (Kb/s). (Thepage has been written and freed. This can be
the result of
activity by the pageout scanner, a fileclose, or fsflush.)
page/fr: Freed or destroyed (Kb/s). (Thiscolumn reports the activity of the page
scanner.)
page/de: Freed after writes (Kb/s). (Thesepages have been freed due to a pageout.)
page/sr: Scan rate (pages). Note that thisnumber is not reported as a "rate," but as
a total number of pages scanned.
disk/s#: Disk activity for disk # (I/O'sper second).
faults/in: Interrupts (per second).
faults/sy: System calls (per second).
faults/cs: Context switches (per second).
cpu/us: User CPU time (%).
cpu/sy: Kernel CPU time (%).
cpu/id: Idle + I/O wait CPU time (%).
When analyzing vmstat output, there areseveral metrics to which you should pay
attention. For example,
keep an eye on the CPU run queue column.The run queue should never exceed the number
of CPUs on the server.
If you do notice the run queue exceedingthe amount of CPUs, it's a good indication
that your server
has a CPU bottleneck.
To get an idea of the RAM usage on yourserver, watch the page in (pi) and page out
(po) columns
of vmstat's output. By tracking commonvirtual memory operations such as page outs,
you can infer
the times that the Oracle database isperforming a lot of work. Even though UNIX page
ins must correlate
with the vmstat's refresh rate toaccurately predict RAM swapping, plotting page ins
can tell you
when the server is having spikes of RAMusage.
Once captured, it's very easy to take theinformation about server performance
directly from the
Oracle tables and plot them in a trendgraph. Rather than using an expensive
statistical package
such as SAS, you can use Microsoft Excel.Copy and paste the data from the tables
into Excel.
After that, you can use the Chart Wizard tocreate a line chart that will help you
view server
usage information and discover trends.
# VMSTAT AIX:
-------------
This is virtually equal to the usage ofvmstat under solaris.
vmstat can be used to give multiplestatistics on the system. For CPU-specific work,
try the following command:
# vmstat -t 1 3
This will take 3 samples, 1 second apart,with timestamps (-t). You can, of course,
change the parameters
as you like. The output is shown below.
kthr memory page faults cpu time
----- ----------- ------------------------------------ ----------- -------r
b avm fre re pi po fr sr cy in sy cs us syid wa hr mi se
0 0 45483 221 0 0 0 0 1 0 224 326 362 24 769 0 15:10:22
0 0 45483 220 0 0 0 0 0 0 159 83 53 1 1 980 15:10:23
2 0 45483 220 0 0 0 0 0 0 145 115 46 0 9 901 15:10:24
In this output some of the things to watchfor are:
"avm", which is Active VirtualMemory.
Ideally, under normal conditions, thelargest avm value should in general be smaller
than the amount of RAM.
If avm is smaller than RAM, and still exessivepaging occurs, that could be due to
RAM being filled
with file pages.
avm x 4K = number of bytes
Columns r (run queue) and b (blocked) startgoing up, especially above 10. This
usually is an indication
that you have too many processes competingfor CPU.
If cs (contact switches) go very highcompared to the number of processes, then you
may need to tune
the system with vmtune.
In the cpu section, us (user time)indicates the time is being spent in programs.
Assuming Java is
at the top of the list in tprof, then youneed to tune the Java application).
In the cpu section, if sys (system time) ishigher than expected, and you still have
id (idle) time left,
this may indicate lock contention. Checkthe tprof for lock related calls in the
kernel time. You may want
to try multiple instances of the JVM. Itmay also be possible to find deadlocks in a
javacore file.
In the cpu section, if wa (I/O wait) ishigh, this may indicate a disk bottleneck,
and you should use
iostat and other tools to look at the diskusage.
Values in the pi, po (page in/out) columnsare non-zero may indicate that you are
paging and need more memory.
It may be possible that you have the stacksize set too high for some of your JVM
instances.
It could also mean that you have allocateda heap larger than the amount of memory on
the system. Of course,
you may also have other applications usingmemory, or that file pages may be taking
up too much of the memory
Other example:
# vmstat 1
System configuration: lcpu=2 mem=3920MB
kthr memory page faults cpu
r b avm fre re pi po fr sr cy in sy cs ussy id wa
0 0 229367 332745 0 0 0 0 0 0 3 198 69 0 099 0
0 0 229367 332745 0 0 0 0 0 0 3 33 66 0 099 0
0 0 229367 332745 0 0 0 0 0 0 2 33 68 0 099 0
0 0 229367 332745 0 0 0 0 0 0 80 306 100 01 97 1
0 0 229367 332745 0 0 0 0 0 0 1 20 68 0 099 0
0 0 229367 332745 0 0 0 0 0 0 2 36 64 0 099 0
0 0 229367 332745 0 0 0 0 0 0 2 33 66 0 099 0
0 0 229367 332745 0 0 0 0 0 0 2 21 66 0 099 0
0 0 229367 332745 0 0 0 0 0 0 1 237 64 0 099 0
0 0 229367 332745 0 0 0 0 0 0 2 19 66 0 099 0
0 0 229367 332745 0 0 0 0 0 0 6 37 76 0 099 0
The most important fields to look at hereare:
r -- The average number of runnable kernelthreads over whatever sampling interval
you have chosen.
b -- The average number of kernel threadsthat are in the virtual memory waiting
queue over your sampling interval. r shouldalways be higher than b; if it is not, it
usually means you have a CPU bottleneck.
fre -- The size of your memory free list.Do not worry so much if the amount is
really small. More importantly, determineif there is any paging going on if this
amount is small.
pi -- Pages paged in from paging space.
po -- Pages paged out to paging space.
CPU section:
us
sy
id
wa
Let's look at the last section, which alsocomes up in most other CPU monitoring
tools, albeit with different headings:
us -- user time
sy -- system time
id -- idle time
wa -- waiting on I/O
# IOSTAT:
This command is useful for monitoring I/Oactivities. You can use the read and write
rate to estimate the
amount of time required for certain SQLoperations (if they are the only activity on
the system).
This command is also useful for determiningif something is suspended or just taking
a long time.
B<options> interval countasic synctaxis iostat
x options gives the extended
option - let you specify the device forwhich information is needed like disk ,
cpu or terminal. (-d , -c , -t
statistics .
or -tdc ) .
interval -4is time period in secondsbetween two samples . iostat will give data
at each 4 seconds interval.
count - is the number of times the data isneeded . iostat 4 5 will give data at 4
seconds interval 5 times.
Example:
$ iostat -xtc 5 2
extended disk statistics tty cpu
disk r/s w/s Kr/s Kw/s wait actv svc_t %w%b tin tout us sy wt id
sd0 2.6 3.0 20.7 22.7 0.1 0.2 59.2 6 19 084 3 85 11 0
sd1 4.2 1.0 33.5 8.0 0.0 0.2 47.2 2 23
sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31
disk name of the disk
r/s reads per second
w/s writes per second
Kr/s kilobytes read per second
Kw/s kilobytes written per second
wait average number of transactions waitingfor service (Q length)
actv average number of transactionsactively
being serviced (removed from the queue butnot yet completed)
%w percent of time there are transactionswaiting for service (queue non-empty)
%b percent of time the disk is busy(transactions in progress)
Tare:he values to look from the iostatoutput
Reads/writes per second (r/s , w/s)
Percentage busy (%b)
Service time (svc_t)
If a disk shows consistently highreads/writes along with , the percentage busy (%b)
of the disks
is greater than 5 percent, and the averageservice time (svc_t) is greater than 30
milliseconds,
then action needs to be taken.
# netstat
This command lets you know the networktraffic on each node, and the number of error
packets encountered.
It is useful for isolating networkproblems.
Example:
To find out all listening services, you canuse the command
# netstat -a -f inet
1.2.11 Some other utilities for Solaris:
========================================
# top
For example:
load averages: 0.66, 0.54, 0.56 11:14:48
187 processes: 185 sleeping, 2 on cpu
CPU states: % idle, % user, % kernel, %iowait, % swap
Memory: 4096M real, 1984M free, 1902M swapin use, 2038M swap free
PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
2795 oraclown 1 59 0 265M 226M sleep 0:134.38% oracle
2294 root 11 59 0 8616K 7672K sleep 10:543.94% bpbkar
13907 oraclown 11 59 0 271M 218M cpu2 4:022.23% oracle
14138 oraclown 12 59 0 270M 230M sleep 9:031.76% oracle
2797 oraclown 1 59 0 189M 151M sleep 0:010.96% oracle
2787 oraclown 11 59 0 191M 153M sleep 0:060.69% oracle
2799 oraclown 1 59 0 190M 151M sleep 0:020.45% oracle
2743 oraclown 11 59 0 191M 155M sleep 0:250.35% oracle
2011 oraclown 11 59 0 191M 149M sleep 2:500.27% oracle
2007 oraclown 11 59 0 191M 149M sleep 2:220.26% oracle
2009 oraclown 11 59 0 191M 149M sleep 1:540.20% oracle
2804 oraclown 1 51 0 1760K 1296K cpu2 0:000.19% top
2013 oraclown 11 59 0 191M 148M sleep 0:360.14% oracle
2035 oraclown 11 59 0 191M 149M sleep 2:440.13% oracle
114 root 10 59 0 5016K 4176K sleep 23:340.05% picld
Process ID
This column shows the process ID (pid) ofeach process. The process ID is a positive
number,
usually less than 65536. It is used foridentification during the life of the process.
Once a process has exited or been killed,the process ID can be reused.
Username
This column shows the name of the user whoowns the process. The kernel stores this
information
as a uid, and top uses an appropriate table(/etc/passwd, NIS, or NIS+) to translate
this uid in to a name.
Threads
This column displays the number of threadsfor the current process. This column is
present only
in the Solaris 2 port of top.
For Solaris, this number is actually thenumber of lightweight processes (lwps)
created by the
threads package to handle the threads.Depending on current resource utilization,
there may not
be one lwp for every thread. Thus thisnumber is actually less than or equal to the
total number
of threads created by the process.
Nice
This column reflects the "nice"setting of each process. A process's nice is
inhereted from its parent.
Most user processes run at a nice of 0,indicating normal priority. Users have the
option of starting
a process with a positive nice value toallow the system to reduce the priority given
to that process.
This is normally done for long-runningcpu-bound jobs to keep them from interfering
with
interactive processes. The Unix command"nice" controls setting this value. Only root
can set
a nice value lower than the current value.Nice values can be negative. On most
systems they range from -20 to 20.
The nice value influences the priorityvalue calculated by the Unix scheduler.
Size
This column shows the total amount ofmemory allocated by each process. This is
virtual memory
and is the sum total of the process's textarea (program space), data area, and
dynamically
allocated area (or "break"). Whena process allocates additional memory with the
system call "brk",
this value will increase. This is doneindirectly by the C library function "malloc".
The number in this column does not reflectthe amount of physical memory currently in
use by the process.
Resident Memory
This column reflects the amount of physicalmemory currently allocated to each process.
This is also known as the "residentset size" or RSS. A process can have a large amount
of virtual memory allocated (as indicatedby the SIZE column) but still be using very
little physical memory.
Process State
This column reflects the last observedstate of each process. State names vary from
system to system.
These states are analagous to those thatappear in the process states line: the
second line of the display.
The more common state names are listedbelow.
cpu - Assigned to a CPU and currentlyrunning
run - Currently able to run
sleep - Awaiting an external event, such asinput from a device
stop - Stopped by a signal, as with controlZ
swap - Virtual address space swapped out todisk
zomb - Exited, but parent has not called"wait" to receive the exit status
CPU Time
This column displayes the accumulated CPUtime for each process. This is the amount
of time
that any cpu in the system has spentactually running this process. The standard
format shows
two digits indicating minutes, a colon,then two digits indicating seconds.
For example, the display "15:32"indicates fifteen minutes and thirty-two seconds.
When a time value is greater than or equalto 1000 minutes, it is displayed as hours
with the suffix H.
For example, the display "127.4H"indicates 127 hours plus four tenths of an hour (24
minutes).
When the number of hours exceeds 999.9, the"H" suffix is dropped so that the display
continues to fit in the column.
CPU Percentage
This column shows the percentage of the cputhat each process is currently consuming.
By default, top will sort this column ofthe output.
Some versions of Unix will track cpupercentages in the kernel, as the figure is used
in the calculation
of a process's priority. On those versions,top will use the figure as calculated by
the kernel.
Other versions of Unix do not perform thiscalculation, and top must determine the
percentage explicity
by monitoring the changes in cpu time.
On most multiprocessor machines, the numberdisplayed in this column is a percentage
of the total
available cpu capacity. Therefore, a singlethreaded process running on a four
processor system will never
use more than 25% of the available cpucycles.
Command
This column displays the name of theexecutable image that each process is running.
In most cases this is the base name of thefile that was invoked with the most recent
kernel "exec" call.
On most systems, this name is maintainedseparately from the zeroth argument. A
program that changes
its zeroth argument will not affect theoutput of this column.
# modinfo
The modinfo command provides informationabout the modules currently loaded by the
kernel.
The /etc/system file:
Available for Solaris OperatingEnvironment, the /etc/system file contains
definitions for kernel configuration limits
such as the maximum number of users allowedon the system at a time, the maximum
number of processes per user,
and the inter-process communication (IPC)limits on size and number of resources.
These limits are important because
they affect DB2 performance on a SolarisOperating Environment machine. See the Quick
Beginnings information
for further details.
# more /etc/path_to_inst
To see the mapping between the kernelabbreviated instance name for physical device
names,
view the /etc/path_to_inst file.
# uptime
uptime - show how long the system has beenup
/export/home/oraclown>uptime
11:32am up 4:19, 1 user, load average:0.40, 1.17, 0.90
1.2.12 proc toos for Solaris:
=============================
The proc tools are called that way, becausethe retreive information fromn the /proc
virtual filesystem
They are:
/usr/proc/bin/pflags [-r] pid...
/usr/proc/bin/pcred pid...
/usr/proc/bin/pmap [-rxlF] pid...
/usr/proc/bin/pldd[-F] pid...
/usr/proc/bin/psigpid...
/usr/proc/bin/pstack[-F] pid...
/usr/proc/bin/pfiles[-F] pid...
/usr/proc/bin/pwdx[-F] pid...
/usr/proc/bin/pstoppid...
/usr/proc/bin/prunpid...
/usr/proc/bin/pwait[-v] pid...
/usr/proc/bin/ptree [-a] [[pid| user]...]
/usr/proc/bin/ptime command [arg...]
/usr/proc/bin/pattr [-x ] [pid...]
/usr/proc/bin/pclear [pid...]
/usr/proc/bin/plabel [pid...]
/usr/proc/bin/ppriv [-a] [pid...]
-- pfiles:
reports all the files which are opened by agiven pid
-- pldd
lists all the dynamic libraries linked tothe process
-- pwdx
gives the directory from which the processis running
-- ptree
The ptree utility prints the process treescontaining the specified pids or users,
with child processes
indented from their respective parentprocesses. An argument of all digits is taken
to be a process-ID,
otherwise it is assumed to be a user loginname. The default is all processes.
Use it like
# ptree <PID>
Or use it with params, which enables you toproduce different listings
The following example prints the processtree (including children of process 0) for
processes which match the command name ssh:
$ ptree -a 憄grep ssh?
1 /sbin/init
100909 /usr/lib/ssh/sshd
569150 /usr/lib/ssh/sshd
569157/usr/lib/ssh/sshd
569159 -ksh
569171 bash
569173 /bin/ksh
569193 bash
---------------------------------------------------------------------Remark:
many Linux distros adopted the ptreecommand, as the "pstree" command.
As in
ubuntu$ pstree -pl
init(1)---NetworkManager(5427)
+-NetworkManagerD(5441)
+-acpid(5210)
+-apache2(6966)---apache2(2890)
? +-apache2(2893)
? +-apache2(7163)
? +-apache2(7165)
? +-apache2(7166)
? +-apache2(7167)
? +-apache2(7168)
+-atd(6369)
+-avahi-daemon(5658)---avahi-daemon(5659)
+-bonobo-activati(7816)---{bonobo-activati}(7817)
etc..
..
-----------------------------------------------------------------------Back
to Solaris again:
Suppose you did a pfiles on an Apacheprocess:
# pfiles 13789
13789:/apps11i/erpdev/10GAS/Apache/Apache/bin/httpd -d /apps11i/erpdev/10G
Current rlimit: 1024 file descriptors
0: S_IFIFO mode:0000 dev:350,0 ino:114723uid:65060 gid:54032 size:301
O_RDWR
1: S_IFREG mode:0640 dev:307,28001ino:612208 uid:65060 gid:54032 size:386
O_WRONLY|O_APPEND|O_CREAT
/apps11i/erpdev/10GAS/opmn/logs/HTTP_Server~1
2: S_IFIFO mode:0000 dev:350,0 ino:143956uid:65060 gid:54032 size:0
O_RDWR
3: S_IFREG mode:0600 dev:307,28001ino:606387 uid:65060 gid:54032 size:1056768
O_RDWR|O_CREAT
/apps11i/erpdev/10GAS/Apache/Apache/logs/mm.19389.mem
4: S_IFREG mode:0600 dev:307,28001ino:606383 uid:65060 gid:54032 size:0
O_RDWR|O_CREAT
5: S_IFREG mode:0600 dev:307,28001ino:621827 uid:65060 gid:54032 size:1056768
O_RDWR|O_CREAT
6: S_IFDOOR mode:0444 dev:351,0 ino:58uid:0 gid:0 size:0
O_RDONLY|O_LARGEFILE FD_CLOEXEC door tonscd[421]
/var/run/name_service_door
7: S_IFIFO mode:0000 dev:350,0 ino:143956uid:65060 gid:54032 size:0
O_RDWR
8: S_IFCHR mode:0666 dev:342,0 ino:47185924uid:0 gid:3 rdev:90,0
O_RDONLY
/devices/pseudo/kstat@0:kstat
etc..
..
..
O_RDWR|O_CREAT
/apps11i/erpdev/10GAS/Apache/Apache/logs/dms_metrics.19389.shm.sem
21: S_IFREG mode:0600 dev:307,28001ino:603445 uid:65060 gid:54032 size:17408
O_RDONLY FD_CLOEXEC
/apps11i/erpdev/10GAS/rdbms/mesg/ocius.msb
23: S_IFSOCK mode:0666 dev:348,0 ino:60339uid:0 gid:0 size:0
O_RDWR
SOCK_STREAM
SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.0.192.0)
sockname: AF_INET 3.56.189.4 port: 45395
peername: AF_INET 3.56.189.4 port: 12501
256: S_IFREG mode:0444 dev:85,0 ino:234504uid:0 gid:3 size:1616
O_RDONLY|O_LARGEFILE
/etc/inet/hosts
Suppose you tried pldd on the same processgave this result:
# pldd 13789
13789: /apps11i/erp
dev/10GAS/Apache/Apache/bin/httpd -d/apps11i/erpdev/10G
/apps11i/erpdev/10GAS/lib32/libdms2.so
/lib/libpthread.so.1
/lib/libsocket.so.1
/lib/libnsl.so.1
/lib/libdl.so.1
/lib/libc.so.1
/platform/sun4u-us3/lib/libc_psr.so.1
/lib/libmd5.so.1
/platform/sun4u/lib/libmd5_psr.so.1
/lib/libscf.so.1
/lib/libdoor.so.1
/lib/libuutil.so.1
/lib/libgen.so.1
/lib/libmp.so.2
/lib/libm.so.2
/lib/libresolv.so.2
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_onsint.so
/lib/librt.so.1
/apps11i/erpdev/10GAS/lib32/libons.so
/lib/libkstat.so.1
/lib/libaio.so.1
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_mmap_static.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_vhost_alias.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_env.so
..
..
etc
/usr/lib/libsched.so.1
/apps11i/erpdev/10GAS/lib32/libclntsh.so.10.1
/apps11i/erpdev/10GAS/lib32/libnnz10.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_wchandshake.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_oc4j.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_dms.so
/apps11i/erpdev/10GAS/Apache/Apache/libexec/mod_rewrite.so
/apps11i/erpdev/10GAS/Apache/oradav/lib/mod_oradav.so
/apps11i/erpdev/10GAS/Apache/modplsql/bin/modplsql.so
# pmap -x $$
492328: -ksh
Address Kbytes RSS Anon Locked Mode MappedFile
00010000 192 192 -- r-x--ksh
00040000 8 8 8 - rwx--ksh
00042000 40 40 8 - rwx--[ heap ]
FF180000 680 680 -- r-x--libc.so.1
FF23A000 24 24 -- rwx--libc.so.1
FF240000 8 8 8 - rwx--libc.so.1
FF280000 576 576 -- r-x--libnsl.so.1
FF310000 40 40 -- rwx--libnsl.so.1
FF31A000 24 16 -- rwx--libnsl.so.1
FF350000 16 16 -- r-x--libmp.so.2
FF364000 8 8 -- rwx--libmp.so.2
FF380000 40 40 -- r-x--libsocket.so.1
FF39A000 8 8 -- rwx--libsocket.so.1
FF3A0000 8 8 -- r-x--libdl.so.1
FF3B0000 8 8 8 - rwx--[ anon ]
FF3C0000 152 152 -- r-x--ld.so.1
FF3F6000 8 8 8 - rwx--ld.so.1
FFBFC000 16 16 8 - rw---[ stack ]
-------- ------- ------- ------- -------
total Kb 1856 1848 48 -
1.2.13 Wellknown tools for AIX:
===============================
1. commands:
------------
CPU Memory Subsystem I/O Subsystem NetworkSubsystem
---------------------------------------------------------------------------------
vmstat vmstatiostat netstat
iostat lspsvmstat ifconfig
ps svmon lsps tcpdump
sar filemon filemon
tprof ipcs lvmstat
nmon and topas can be used to monitor thosesubsystems in general.
2. topas:
---------
topas is a useful graphical interface thatwill give you immediate results of what is
going on in the system.
When you run it without any command-linearguments, the screen looks like this:
Topas Monitor for host: aix4prtEVENTS/QUEUES FILE/TTY
Mon Apr 16 16:16:50 2001 Interval: 2Cswitch 5984 Readch 4864
Syscall 15776 Writech 34280
Kernel 63.1 |################## | Reads 8Rawin 0
User 36.8 |########## | Writes 2469 Ttyout0
Wait 0.0 | | Forks 0 Igets 0
Idle 0.0 | | Execs 0 Namei 4
Runqueue 11.5 Dirblk 0
Network KBPS I-Pack O-Pack KB-In KB-OutWaitqueue 0.0
lo0 213.9 2154.2 2153.7 107.0 106.9
tr0 34.7 16.9 34.4 0.9 33.8 PAGING MEMORY
Faults 3862 Real,MB 1023
Disk Busy% KBPS TPS KB-Read KB-Writ Steals1580 % Comp 27.0
hdisk0 0.0 0.0 0.0 0.0 0.0 PgspIn 0 %Noncomp 73.9
PgspOut 0 % Client 0.5
Name PID CPU% PgSp Owner PageIn 0
java 16684 83.6 35.1 root PageOut 0 PAGINGSPACE
java 12192 12.7 86.2 root Sios 0 Size,MB512
lrud 1032 2.7 0.0 root % Used 1.2
aixterm 19502 0.5 0.7 root NFS (calls/sec)% Free 98.7
topas 6908 0.5 0.8 root ServerV2 0
ksh 18148 0.0 0.7 root ClientV2 0 Press:
gil 1806 0.0 0.0 root ServerV3 0"h" for help
The information on the bottom left sideshows the most active processes; here, java
is consuming 83.6% of CPU.
The middle right area shows the totalphysical memory (1 GB in this case) and Paging
space (512 MB),
as well as the amount being used. So youget an excellent overview of what the system
is doing
in a single screen, and then you can selectthe areas to concentrate based on the
information being shown here.
Note: about waits:
Don't get caught up in this whole wait i/othing. a single cpu system
with 1 i/o outstanding and no other runablethreads (i.e. idle) will
have 100% wait i/o. There was a bigdiscussion a couple of years ago on
removing the kernel tick as it has confusedmany many many techs.
So, if you have only 1 or few cpu, then youare going to have high wait i.o
figures, it does not neccessarily mean yourdisk subsystem is slow.
3. trace:
trace captures a sequential flow oftime-stamped system events. The trace is a
valuable tool for observing
system and application execution. Whilemany of the other tools provide high level
statistics such as
CPU and I/O utilization, the trace facilityhelps expand the information as to where
the events happened,
which process is responsible, when theevents took place, and how they are affecting
the system.
Two post processing tools that can extractinformation from the trace are utld (in
AIX 4) and curt
(in AIX 5). These provide statistics on CPUutilization and process/thread activity.
The third post
processing tool is splat which stands forSimple Performance Lock Analysis Tool. This
tool is used to analyze
lock activity in the AIX kernel and kernelextension for simple locks.
4. nmon:
nmon is a free software tool that givesmuch of the same information as topas, but
saves the information
to a file in Lotus 123 and Excel format.The download site is
http://www.ibm.com/developerworks/eserver/articles/analyze_aix/.
The information that is collected includedCPU, disk, network, adapter statistics,
kernel counters,
memory and the "top" processinformation.
5. tprof:
tprof is one of the AIX legacy tools thatprovides a detailed profile of CPU usage
for every
AIX process ID and name. It has beencompletely rewritten for AIX 5.2, and the
example below uses
the AIX 5.1 syntax. You should refer to AIX5.2 Performance Tools update: Part 3 for
the new syntax.
The simplest way to invoke this command isto use:
# tprof -kse -x "sleep 10"
# tprof -ske -x "sleep 30"
At the end of ten seconds, or 30 seconds, anew file __prof.all, or sleep.prof, is
generated that contains
information about what commands are usingCPU on the system. Searching for FREQ, the
information looks something
like the example below:
Process FREQ Total Kernel User Shared Other
======= === ===== ====== ==== ====== =====
oracle 244 10635 3515 6897 223 0
java 247 3970 617 0 2062 1291
wait 16 1515 1515 0 0 0
...
======= === ===== ====== ==== ====== =====
Total 1060 19577 7947 7252 3087 1291
This example shows that over half the CPUtime is associated with the oracle
application and that Java
is using about 3970/19577 or 1/5 of theCPU. The wait usually means idle time, but
can also include
the I/O wait portion of the CPU usage.
svmon:
The svmon command captures a snapshot ofthe current state om memory.
use it with the -G switch to get globalstatistics for the whole system.
svmon is the most useful tool at yourdisposal when monitoring a Java process,
especially native heap.
The article "When segmentscollide" gives examples of how to use svmon -P <pid> -m to
monitor the
native heap of a Java process on AIX. Butthere is another variation, svmon -P <pid>
-m -r, that is very
effective in identifying native heapfragmentation. The -r switch prints the address
range in use, so it gives
a more accurate view of how much of eachsegment is in use.
As an example, look at the partially editedoutput below:
Pid Command Inuse Pin Pgsp Virtual 64-bitMthrd LPage
10556 java 681613 2316 2461 501080 N Y N
Vsid Esid Type Description LPage Inuse PinPgsp Virtual
22ac4 9 mmap mapped to sid b1475 -0 0 --
21047 8 mmap mapped to sid 30fe5 -0 0 --
126a2 a mmap mapped to sid 91072 -0 0 --
7908c 7 mmap mapped to sid 6bced -0 0 --
b2ad6 b mmap mapped to sid b1035 -0 0 --
b1475 - work -65536 0 282 65536
30fe5 - work -65536 0 285 65536
91072 - work -65536 0 54 65536
6bced - work -65536 0 261 65536
b1035 - work -45054 0 0 45054
Addr Range: 0..45055
e0f9f 5 work shmat/mmap -48284 0 3 48284
19100 3 work shmat/mmap -46997 0 463 47210
c965a 4 work shmat/mmap -46835 0 281 46953
7910c 6 work shmat/mmap -37070 0 0 37070
Addr Range: 0..50453
e801d d work shared library text -9172 0 09220
Addr Range: 0..30861
a0fb7 f work shared library data -105 0 1106
Addr Range: 0..2521
21127 2 work process private -50 2 1 51
Addr Range: 65300..65535
a8535 1 pers code,/dev/q109waslv:81938 -110 --
Addr Range: 0..11
Other example:
# svmon -G -i 2 5 # sample five times attwo second intervals
memory in use pin pg space
size inuse free pin work pers clnt workpers clnt size inuse
16384 16250 134 2006 10675 2939 2636 2006 00 40960 12674
16384 16250 134 2006 10675 2939 2636 2006 00 40960 12674
16384 16250 134 2006 10675 2939 2636 2006 00 40960 12674
16384 16250 134 2006 10675 2939 2636 2006 00 40960 12674
16384 16250 134 2006 10675 2939 2636 2006 00 40960 12674
In this example, there are 16384 pages oftotal size of memory. Multuply this number
by 4096
to see the total real memory size. In thiscase the total memory is 64 MB.
filemon:
--------
filemon can be used to identify the filesthat are being used most actively. This
tool gives a very
comprehensive view of file access, and canbe useful for drilling down once
vmstat/iostat confirm disk
to be a bottleneck.
Example:
# filemon -o /tmp/filemon.log; sleep 60;trcstop
The generated log file is quite large. Somesections that may be useful are:
Most Active Files
-----------------------------------------------------------------------#
MBs #opns #rds #wrs file volume:inode
-----------------------------------------------------------------------25.7
83 6589 0 unix /dev/hd2:147514
16.3 1 4175 0 vxe102 /dev/mailv1:581
16.3 1 0 4173 .vxe102.pop /dev/poboxv:62
15.8 1 1 4044 tst1 /dev/mailt1:904
8.3 2117 2327 0 passwd /dev/hd4:8205
3.2 182 810 1 services /dev/hd4:8652
...
-----------------------------------------------------------------------Detailed
File Stats
-----------------------------------------------------------------------FILE:
/var/spool/mail/v/vxe102 volume:/dev/mailv1 (/var/spool2/mail/v) inode: 581
opens: 1
total bytes xfrd: 17100800
reads: 4175 (0 errs)
read sizes (bytes): avg 4096.0 min 4096 max4096 sdev 0.0
read times (msec): avg 0.543 min 0.011 max78.060 sdev 2.753
...
curt:
-----
curt Command
Purpose
The CPU Utilization Reporting Tool (curt)command converts an AIX trace file into a
number of statistics related
to CPU utilization and either process,thread or pthread activity. These statistics
ease the tracking of
specific application activity. curt workswith both uniprocessor and multiprocessor
AIX Version 4 and AIX Version 5
traces.
Syntax
curt -i inputfile [-o outputfile] [-ngennamesfile] [-m trcnmfile] [-a pidnamefile]
[-f timestamp]
[-l timestamp] [-ehpstP]
Description
The curt command takes an AIX trace file asinput and produces a number of statistics
related to
processor (CPU) utilization andprocess/thread/pthread activity. It will work with
both uniprocessor and
multiprocessor AIX traces if the processorclocks are properly synchronized.
1.2.14 Not so well known tools for AIX: the proc tools:
=======================================================
--proctree
Displays the process tree containing thespecified process IDs or users. To display
the ancestors
and all the children of process 12312,enter:
# proctree 21166
11238 /usr/sbin/srcmstr
21166 /usr/sbin/rsct/bin/IBM.AuditRMd
To display the ancestors and children ofprocess 21166, including children of process
0, enter:
#proctree -a 21166
1 /etc/init
11238 /usr/sbin/srcmstr
21166/usr/sbin/rsct/bin/IBM.AuditRMd
-- procstack
Displays the hexadecimal addresses andsymbolic names for each of the stack frames of
the current thread
in processes. To display the current stackof process 15052, enter:
# procstack 15052
15052 :/usr/sbin/snmpd
d025ab80 select(?, ?, ?, ?, ?) + 90
100015f4 main (?, ?, ?) + 1814
10000128 __start () + 8c
Currently, procstack displays garbage orwrong information for the top stack frame,
and possibly for the
second top stack frame. Sometimes it willerroneously display "No frames found on the
stack," and sometimes
it will display: deadbeef ???????? (?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ...) The fix
for this problem had not
been released at the writing of thisarticle. When the fix becomes available, you
need to download the
APAR IY48543 for 5.2. For AIX 5.3 it all shouldwork OK.
-- procmap
Displays a process address map. To displaythe address space of process 13204, enter:
# procmap 13204
13204 : /usr/sbin/biod 6
10000000 3K read/exec biod
20000910 0K read/write biod
d0083100 79K read/exec /usr/lib/libiconv.a
20013bf0 41K read/write /usr/lib/libiconv.a
d007a100 34K read/exec /usr/lib/libi18n.a
20011378 4K read/write /usr/lib/libi18n.a
d0074000 11K read/exec/usr/lib/nls/loc/en_US
d0077130 8K read/write/usr/lib/nls/loc/en_US
d00730f8 2K read/exec /usr/lib/libcrypt.a
f03c7508 0K read/write /usr/lib/libcrypt.a
d01d4e20 1997K read/exec /usr/lib/libc.a
f0337e90 570K read/write /usr/lib/libc.a
-- procldd
Displays a list of libraries loaded by aprocess. To display the list of dynamic
libraries loaded by
process 11928, enter
# procldd 11928. T
11928 : -sh
/usr/lib/nls/loc/en_US
/usr/lib/libcrypt.a
/usr/lib/libc.a
-- procflags
Displays a process tracing flags, and thepending and holding signals. To display the
tracing flags of
process 28138, enter:
# procflags 28138
28138 : /usr/sbin/rsct/bin/IBM.HostRMd
data model = _ILP32 flags = PR_FORK
/64763: flags = PR_ASLEEP | PR_NOREGS
/66315: flags = PR_ASLEEP | PR_NOREGS
/60641: flags = PR_ASLEEP | PR_NOREGS
/66827: flags = PR_ASLEEP | PR_NOREGS
/7515: flags = PR_ASLEEP | PR_NOREGS
/70439: flags = PR_ASLEEP | PR_NOREGS
/66061: flags = PR_ASLEEP | PR_NOREGS
/69149: flags = PR_ASLEEP | PR_NOREGS
-- procsig
Lists the signal actions for a process. Tolist all the signal actions defined for
process 30552, enter:
# procsig 30552
30552 : -ksh
HUP caught
INT caught
QUIT caught
ILL caught
TRAP caught
ABRT caught
EMT caught
FPE caught
KILL default RESTART BUS caught
-- proccred
Prints a process' credentials. To displaythe credentials of process 25632, enter:
# proccred 25632
25632: e/r/suid=0 e/r/sgid=0
-- procfiles
Prints a list of open file descriptors. Todisplay status and control information on
the file descriptors
opened by process 20138, enter:
# procfiles -n20138
20138 :/usr/sbin/rsct/bin/IBM.CSMAgentRMd
Current rlimit: 2147483647 file descriptors
0: S_IFCHR mode:00 dev:10,4 ino:4178 uid:0gid:0 rdev:2,2
O_RDWR name:/dev/null
2: S_IFREG mode:0311 dev:10,6 ino:250 uid:0gid:0 rdev:0,0
O_RDWR size:0 name:/var/ct/IBM.CSMAgentRM.stderr
4: S_IFREGmode:0200 dev:10,6 ino:255 uid:0 gid:0 rdev:0,0
-- procwdx
Prints the current working directory for aprocess. To display the current working
directory
of process 11928, enter:
# procwdx 11928
11928 : /home/guest
-- procstop
Stops a process. To stop process 7500 onthe PR_REQUESTED event, enter:
# procstop 7500 .
-- procrun
Restart a process. To restart process 30192that was stopped on the PR_REQUESTED
event, enter:
# procrun 30192 .
-- procwait
Waits for all of the specified processes toterminate. To wait for process 12942 to
exit and display
the status, enter
# procwait -v 12942 .
12942 : terminated, exit status 0
1.2.15 Other monitoring:
========================
Nagios: open source Monitoring for mostunix systems:
Nagios is an open source host, service andnetwork monitoring program.
Latest versions: 2.5 (stable)
Overview
Nagios is a host and service monitordesigned to inform you of network problems
before your clients,
end-users or managers do. It has beendesigned to run under the Linux operating
system, but works fine
under most *NIX variants as well. Themonitoring daemon runs intermittent checks on
hosts and services you specify
using external "plugins" whichreturn status information to Nagios. When problems are
encountered,
the daemon can send notifications out toadministrative contacts in a variety of
different ways
(email, instant message, SMS, etc.).Current status information, historical logs, and
reports can all
be accessed via a web browser.
System Requirements
The only requirement of running Nagios is amachine running Linux (or UNIX variant)
and a C compiler.
You will probably also want to have TCP/IPconfigured, as most service checks will be
performed over the network.
You are not required to use the CGIsincluded with Nagios. However, if you do decide
to use them,
you will need to have the followingsoftware installed...
- A web server (preferrably Apache)
- Thomas Boutell's gd library version 1.6.3or higher (required by the statusmap and
trends CGIs)
rstat: Monitoring Machine Utilization withrstat:
rstat stands for Remote System Statisticsservice
Ports exist for most unixes, like Linux,Solaris, AIX etc..
-- rstat on Linux, Solaris:
rstat is an RPC client program to get andprint statistics from any machine running
the rpc.rstatd daemon,
its server-side counterpart. The rpc.rstaddaemon has been used for many years by
tools such as Sun's perfmeter
and the rup command. The rstat program issimply a new client for an old daemon. The
fact that the rpc.rstatd daemon
is already installed and running on mostSolaris and Linux machines is a huge
advantage over other tools
that require the installation of customagents.
The rstat client compiles and runs onSolaris and Linux as well and can get
statistics from any machine running
a current rpc.rstatd daemon, such asSolaris, Linux, AIX, and OpenBSD. The rpc.rstatd
daemon is started
from /etc/inetd.conf on Solaris. It issimilar to vmstat, but has some advantages
over vmstat:
You can get statistics without logging into the remote machine, including over the
Internet.
It includes a timestamp.
The output can be plotted directly bygnuplot.
The fact that it runs remotely means thatyou can use a single central machine to
monitor the performance
of many remote machines. It also has adisadvantage in that it does not give the
useful scan rate measurement
of memory shortage, the sr column invmstat. rstat will not work across most
firewalls because it relies on
port 111, the RPC port, which is usuallyblocked by firewalls.
To use rstat, simply give it the name or IPaddress of the machine you wish to
monitor. Remember that rpc.rstatd
must be running on that machine. The rup commandis extremely useful here because
with no arguments,
it simply prints out a list of all machineson the local network that are running the
rstatd demon.
If a machine is not listed, you may have tostart rstatd manually.
To start rpc.rstatd under Red Hat Linux,run
# /etc/rc.d/init.d/rstatd start as root.
On Solaris, first try running the rstatclient because inetd is often already
configured to automatically
start rpc.rstatd on request. If it theclient fails with the error "RPC: Program not
registered,"
make sure you have this line in your/etc/inet/inetd.conf and kill -HUP your inetd
process to get it to
re-read inetd.conf, as follows:
rstatd/2-4 tli rpc/datagram_v wait root/usr/lib/netsvc/rstat/rpc.rstatd rpc.rstatd
Then you can monitor that machine likethis:
% rstat enkidu
2001 07 10 10 36 08 0 0 0 100 0 27 54 1 0 012 0.1
This command will give you a one-secondaverage and then it will exit. If you want to
continuously monitor,
give an interval in seconds on the command line.Here's an example of one line of
output every two seconds:
% rstat enkidu 2
2001 07 10 10 36 28 0 0 1 98 0 0 7 2 0 0 610.0
2001 07 10 10 36 30 0 0 0 100 0 0 0 2 0 015 0.0
2001 07 10 10 36 32 0 0 0 100 0 0 0 2 0 015 0.0
2001 07 10 10 36 34 0 0 0 100 0 5 10 2 0 019 0.0
2001 07 10 10 36 36 0 0 0 100 0 0 46 2 0 0108 0.0
^C
To get a usage message, the output format,the version number, and where to go for
updates, just type rstat
with no parameters:
% rstat
usage: rstat machine [interval]
output:
yyyy mm dd hh mm ss usr wio sys idl pginpgout intr ipkts opkts coll cs load
docs and src athttp://patrick.net/software/rstat/rstat.html
Notice that the column headings line upwith the output data.
-- AIX:
In order to get rstat working on AIX, youmay need to configure rstatd.
As root
1. Edit /etc/inetd.conf
Uncomment or add entry for rstatd
Eg
rstatd sunrpc_udp udp wait root/usr/sbin/rpc.rstatd rstatd 100001 1-3
2. Edit /etc/services
Uncomment or add entry for rstatd
Eg
rstatd 100001/udp
3. Refresh services
refresh -s inetd
4. Start rstatd
/usr/sbin/rpc.rstatd
=================================
. NFS and Mount command examples:
=================================
.1 NFS:
=
2=
2======= =
WS2-
e will discuss the most important feauresof NFS, by showing how its implemented on
olaris, Redhat and SuSE Linux. Most of thisapplies to HP-UX and AIX as well.
.1.1 NFS and Redhat Linux:
Linux uses a combination of kernel-levelsupport and continuously running daemon
rocesses to providepNFS file sharing,however, NFS support must be enabled in the Linux kernel to function.
NFS uses Remote Procedure Calls (RPC) toroute requests between clients and servers,
eaning that themcportmap service must beenabled and active at the proper runlevels for NFS
ommunication to occur.
Working with portmap, various otherprocesses ensure that a particular NFS connection
s allowed and mayiroceed without error:
rpc.mountd
pnd checks to see
- The running process that receives themount request from an NFS client
- The process that implements theuser-level part of the NFS service. It
if it matches with a currently exportedfile system.
rpc.nfsd
aworks with the Linux kernel
to meet the dynamic demands of NFS clients,such as providing
dditional server threads for
NFS clients to uses.
rpc.lockd
anow done by the kernel.
- A daemon that is not necessary withmodern kernels. NFS file locking is
It is included with the nfs-utils packagefor users of older kernels
hat do not include this
functionality by default.
ght down.
rpc.statd
trreboot notification
- Implements the Network Status Monitor(NSM) RPC protocol. This provides
when an NFS server is restarted withoutbeing gracefully broupc.rquotad - An RPC server that provides user quotainformation for remote users.
Not all of these programs are required forNFS service. The only services that must
e enabled are rpc.mountd,brpc.nfsd, andportmap. The other daemons provide additional functionality and should
nly be used if your serveronvironmentrequires them.eNFS version 2 uses the User Datagram Protocol (UDP) to provide astateless network
onnection betweencthe client and server.NFS version 3 can use UDP or TCP running over an IP. The
tateless UDP connectionsinimizes network traffic,as the NFS server sends the client a cookie after the
lient is authorized
mco access the shared volume. This cookieis a random value stored on the server's
ide and is passed
tswith along with RPC requests from theclient. The NFS server can be restarted without
ffecting the clientsa
and the cookie will remain intact.
NFS only performs authentication when aclient system attempts to mount a remote file
system. To limit access,
the NFS server first employs TCP wrappers.TCP wrappers reads the /etc/hosts.allow
and /etc/hosts.deny files
to determine if a particular client shouldbe permitted or prevented access to the
NFS server.
After the client is allowed past TCPwrappers, the NFS server refers to its
configuration file,
"/etc/exports", to determinewhether the client has enough privileges to mount any of
the exported file systems.
After granting access, any file anddirectory operations are sent to the server using
remote procedure calls.
Warning
NFS mount privileges are grantedspecifically to a client, not a user. If you grant
a client machine access
to an exported file system, any users ofthat machine will have access to the data.
When configuring the /etc/exports file, beextremely careful about granting
read-write permissions
(rw) to a remote host.
-- NFS and portmap
NFS relies upon remote procedure calls(RPC) to function. portmap is required to map
RPC requests to the
correct services. RPC processes notifyportmap when they start, revealing the port
number they are monitoring
and the RPC program numbers they expect toserve. The client system then contacts
portmap on the server with
a particular RPC program number. portmapthen redirects the client to the proper port
number to communicate
with its intended service.
Because RPC-based services rely on portmapto make all connections with incoming
client requests,
portmap must be available before any ofthese services start. If, for some reason,
the portmap service
unexpectedly quits, restart portmap and anyservices running when it was started.
The portmap service can be used with thehost access files (/etc/hosts.allow and
/etc/hosts.deny) to control
which remote systems are permitted to useRPC-based services on your machine. Access
control rules for portmap
will affect all RPC-based services.Alternatively, you can specify each of the NFS
RPC daemons to be affected
by a particular access control rule. Theman pages for rpc.mountd and rpc.statd
contain information regarding
the precise syntax of these rules.
-- portmap Status
As portmap provides the coordinationbetween RPC services and the port numbers used
to communicate with them,
it is useful to be able to get a picture ofthe current RPC services using portmap
when troubleshooting.
The rpcinfo command shows each RPC-basedservice with its port number, RPC program
number, version,
and IP protocol type (TCP or UDP).
To make sure the proper NFS RPC-basedservices are enabled for portmap, rpcinfo -p
can be useful:
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 1024 status
100024 1 tcp 1024 status
100011 1 udp 819 rquotad
100011 2 udp 819 rquotad
100005 1 udp 1027 mountd
100005 1 tcp 1106 mountd
100005 2 udp 1027 mountd
100005 2 tcp 1106 mountd
100005 3 udp 1027 mountd
100005 3 tcp 1106 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100021 1 udp 1028 nlockmgr
100021 3 udp 1028 nlockmgr
100021 4 udp 1028 nlockmgr
The -p option probes the portmapper on thespecified host or defaults to localhost if
no specific host is listed.
Other options are available from therpcinfo man page.
From the output above, various NFS servicescan be seen running. If one of the NFS
services does not start up
correctly, portmap will be unable to mapRPC requests from clients for that service
to the correct port.
In many cases, restarting NFS as root(/sbin/service nfs restart) will cause those
service to correctly
register with portmap and begin working.
# /sbin/service nfs restart
-- NFS Server Configuration Files
Configuring a system to share files anddirectories using NFS is straightforward.
Every file system being
exported to remote users via NFS, as wellas the access rights relating to those file
systems,
is located in the /etc/exports file. Thisfile is read by the exportfs command to
give rpc.mountd and rpc.nfsd
the information necessary to allow theremote mounting of a file system by an
authorized host.
The exportfs command allows you toselectively export or unexport directories without
restarting the various
NFS services. When exportfs is passed theproper options, the file systems to be
exported are written to
/var/lib/nfs/xtab. Since rpc.mountd refersto the xtab file when deciding access
privileges to a file system,
changes to the list of exported filesystems take effect immediately.
Various options are available when usingexportfs:
-r - Causes all directories listed in/etc/exports to be exported by constructing a
new export list in
/etc/lib/nfs/xtab. This option effectivelyrefreshes the export list with any
changes that have been
made to /etc/exports.
-a - Causes all directories to be exportedor unexported, depending on the other
options passed to exportfs.
-o options - Allows the user to specifydirectories to be exported that are not
listed in /etc/exports.
These additional file system shares must bewritten in the same way they are
specified in /etc/exports.
This option is used to test an exportedfile system before adding it permanently
to the list of file systems
to be exported.
-i - Tells exportfs to ignore /etc/exports;only options given from the command line
are used to define
exported file systems.
-u - Unexports directories from beingmounted by remote users. The command exportfs
-ua effectively suspends
NFS file sharing while keeping the variousNFS daemons up. To allow NFS sharing
to continue, type exportfs -r.
-v - Verbose operation, where the filesystems being exported or unexported are
displayed in greater detail
when the exportfs command is executed.
If no options are passed to the exportfscommand, it displays a list of currently
exported file systems.
Changes to /etc/exports can also be read byreloading the NFS service with the
service nfs reload command.
This keeps the NFS daemons running whilere-exporting the /etc/exports file.
-- /etc/exports
The /etc/exports file is the standard forcontrolling which file systems are exported
to which hosts,
as well as specifying particular optionsthat control everything. Blank lines are
ignored, comments can be made
using #, and long lines can be wrapped witha backslash (\). Each exported file
system should be on its own line.
Lists of authorized hosts placed after anexported file system must be separated by
space characters.
Options for each of the hosts must beplaced in parentheses directly after the host
identifier, without any spaces
separating the host and the firstparenthesis.
In its simplest form, /etc/exports onlyneeds to know the directory to be exported
and the hosts
permitted to use it:
/some/directory bob.domain.com
/another/exported/directory 192.168.0.3
n5111sviob
After re-exporting /etc/exports with the"/sbin/service nfs reload" command, the
bob.domain.com host will be
able to mount /some/directory and192.168.0.3 can mount /another/exported/directory.
Because no options
are specified in this example, severaldefault NFS preferences take effect.
In order to override these defaults, youmust specify an option that takes its place.
For example, if you do
not specify rw, then that export will onlybe shared read-only. Each default for
every exported file system
must be explicitly overridden.Additionally, other options are available where no
default value is in place.
These include the ability to disablesub-tree checking, allow access from insecure
ports, and allow insecure
file locks (necessary for certain early NFSclient implementations). See the exports
man page for details
on these lesser used options.
When specifying hostnames, you can use thefollowing methods:
single host - Where one particular host isspecified with a fully qualified domain
name, hostname, or IP address.
wildcards - Where a * or ? character isused to take into account a grouping of
fully qualified domain names
that match a particular string of letters.Wildcards are not to be used
with IP addresses; however,
they may accidently work if reverse DNSlookups fail.
However, be careful when using wildcardswith fully qualified domain names, as they
tend to be more exact
than you would expect. For example, the useof *.domain.com as wildcard will allow
sales.domain.com to access
the exported file system, but notbob.sales.domain.com. To match both possibilities,
as well as
sam.corp.domain.com, you would have toprovide *.domain.com *.*.domain.com.
IP networks - Allows the matching of hostsbased on their IP addresses within a
larger network. For example,
192.168.0.0/28 will allow the first 16 IPaddresses, from 192.168.0.0
to 192.168.0.15,
to access the exported file system but not192.168.0.16 and higher.
netgroups - Permits an NIS netgroup name,written as @<group-name>, to be used.
This effectively puts the
NIS server in charge of access control for thisexported file system,
where users can be added
and removed from an NIS group withoutaffecting /etc/exports.
Warning
The way in which the /etc/exports file isformatted is very important, particularly
concerning the use of
space characters. Remember to alwaysseparate exported file systems from hosts and
hosts from one another
with a space character. However, thereshould be no other space characters in the
file unless they are used
in comment lines.
For example, the following two lines do notmean the same thing:
/home bob.domain.com(rw)
/home bob.domain.com (rw)
The first line allows only users frombob.domain.com read-write access to the /home
directory.
The second line allows users frombob.domain.com to mount the directory read-only
(the default), but the rest
of the world can mount it read-write. Becareful where space characters are used in
/etc/exports.
-- NFS Client Configuration Files - What todo on a client?
Any NFS share made available by a servercan be mounted using various methods. Of
course, the share can be
manually mounted, using the mount command,to acquire the exported file system at a
particular mount point.
However, this requires that the root usertype the mount command every time the
system restarts.
In addition, the root user must remember tounmount the file system when shutting
down the machine.
Two methods of configuring NFS mountsinclude modifying the /etc/fstab or using the
autofs service.
> /etc/fstab
Placing a properly formatted line in the/etc/fstab file has the same effect as
manually mounting the
exported file system. The /etc/fstab fileis read by the /etc/rc.d/init.d/netfs
script at system startup.
The proper file system mounts, includingNFS, are put into place.
A sample /etc/fstab line to mount an NFSexport looks like the following:
<server>:</path/of/dir></local/mnt/point> nfs <options> 0 0
The <server-host> relates to thehostname, IP address, or fully qualified domain name
of the server exporting
the file system. The</path/to/shared/directory> tells the server what export to mount.
The </local/mount/point> specifieswhere on the local file system to mount the
exported directory.
This mount point must exist before/etc/fstab is read or the mount will fail. The nfs
option specifies
the type of file system being mounted.
The <options> area specifies how thefile system is to be mounted. For example, if
the options
area states rw,suid on a particular mount,the exported file system will be mounted
read-write and the
user and group ID set by the server will beused. Note, parentheses are not to be
used here.
2.1.2 NFS and SuSE Linux:
-------------------------
-- Importing File Systems with YaST
Any user authorized to do so can mount NFSdirectories from an NFS server into his
own file tree.
This can be achieved most easily using theYaST module `NFS Client'. Just enter the
host name of the NFS server,
the directory to import, and the mountpoint at which to mount this directory locally.
All this is done after clicking `Add' inthe first dialog.
-- Importing File Systems Manually
File systems can easily be importedmanually from an NFS server. The only
prerequisite is a running
RPC port mapper, which can be started byentering the command
# rcportmap start
as root. Once this prerequisite is met,remote file systems exported on the
respective machines
can be mounted in the file system just likelocal hard disks using the command mount
with the following syntax:
# mount host:remote-path local-path
If user directories from the machine sun,for example, should be imported, the
following command can be used:
# mount sun:/home /home
-- Exporting File Systems with YaST
With YaST, turn a host in your network intoan NFS server - a server that exports
directories and files
to all hosts granted access to it. Thiscould be done to provide applications to all
coworkers of a group
without installing them locally on each andevery host. To install such a server,
start YaST and select
`Network Services' -> `NFS Server'
Next, activate `Start NFS Server' and click`Next'. In the upper text field, enter
the directories to export.
Below, enter the hosts that should haveaccess to them.
There are four options that can be set foreach host: single host, netgroups,
wildcards, and IP networks.
A more thorough explanation of theseoptions is provided by man exports. `Exit'
completes the configuration.
-- Exporting File Systems Manually
If you do not want to use YaST, make surethe following systems run on the NFS server:
RPC portmapper (portmap)
RPC mount daemon (rpc.mountd)
RPC NFS daemon (rpc.nfsd)
For these services to be started by thescripts "/etc/init.d/portmap" and
"/etc/init.d/nfsserver"
when the system is booted, enter thecommands
# insserv /etc/init.d/nfsserver and
# insserv /etc/init.d/portmap.
Also define which file systems should beexported to which host in the configuration
file "/etc/exports".
For each directory to export, one line isneeded to set which machines may access
that directory
with what permissions. All subdirectoriesof this directory are automatically
exported as well.
Authorized machines are usually specifiedwith their full names (including domain
name), but it is possible
to use wild cards like * or ? (which expandthe same way as in the Bash shell). If no
machine is specified here,
any machine is allowed to import this filesystem with the given permissions.
Set permissions for the file system toexport in brackets after the machine name. The
most important options are:
ro File system is exported with read-onlypermission (default).
rw File system is exported with read-writepermission.
root_squash This makes sure the user rootof the given machine does not have root
permissions
on this file system. This is achieved byassigning user ID 65534 to
users with user ID 0 (root).
This user ID should be set to nobody (whichis the default).
no_root_squash Does not assign user ID 0 touser ID 65534, keeping the root
permissions valid.
link_relative Converts absolute links(those beginning with /) to a sequence of ../.
This is only useful if the entire filesystem of a machine is mounted
(default).
link_absolute Symbolic links remainuntouched.
map_identity User IDs are exactly the sameon both client and server (default).
map_daemon Client and server do not havematching user IDs. This tells nfsd to
create a conversion table
for user IDs. The ugidd daemon is requiredfor this to work.
/etc/exports is read by mountd and nfsd. Ifyou change anything in this file, restart
mountd and nfsd
for your changes to take effect. This caneasily be done with "rcnfsserver restart".
Example SuSE /etc/exports
#
# /etc/exports
#
/home sun(rw) venus(rw)
/usr/X11 sun(ro) venus(ro)
/usr/lib/texmf sun(ro) venus(rw)
/ earth(ro,root_squash)
/home/ftp (ro)
# End of exports
2.2 Mount command:
==================
The standard form of the mount command, is
mount -F typefs device mountdir (solaris,HP-UX)
mount -t typefs device mountdir (many otherunix's)
This tells the kernel to attach the filesystem found on "device" (which is of type
type)
at the directory "dir".
The previous contents (if any) and ownerand mode of dir become invisible,
and as long as this file system remainsmounted,
the pathname dir refers to the root of thefile system on device.
The syntax is:
mount [options] [type] [device][mountpoint]
-- mounting a remote filesystem:
syntax: mount -F nfs <options> <-ospecific options> -O <server>:<filesystem>
<local_mount_point>
# mount -F nfs hpsrv:/data /data
# mount -F nfs -o hard,intr thor:/data/data
- standard mounts are determined by fileslike /etc/fstab (HP-UX) or
/etc/filesystems (AIX) or /etc/vfstab etc..
2.2.1 Where are the standard mounts defined?
============================================
In Solaris:
===========
- standard mounts are determined by/etc/vfstab etc..
- NFS mounts are determined by the file/etc/dfs/dfstab. Here you will find share
commands.
- currently mounted filesystems are listedin /etc/mnttab
In Linux:
=========
- standard mounts are determined by mostLinux distros by "/etc/fstab".
In AIX:
=======
- standard mounts and properties aredetermined by the file "/etc/filesystems".
In HP-UX:
=========
There is a /etc/fstab which contains all ofthe filesystems are mounted at boot time.
The filesystems that are OS related are / ,/var, /opt , /tmp, /usr , /stand
The filesystem that is special is /stand,this is where your kernel is built and
resides.
Notice that the filesystem type is"hfs". HPUX kernels MUST reside on an hfs filesystem
An example of /etc/vfstab:
--------------------------
starboss:/etc $ more vfstab
#device device mount FS fsck mount mount
#to mount to fsck point type pass at bootoptions
#
fd -/dev/fd fd -no -
/proc -/proc proc -no -
/dev/md/dsk/d1 --swap -no -
/dev/md/dsk/d0 /dev/md/rdsk/d0 / ufs 1 nologging
/dev/md/dsk/d4 /dev/md/rdsk/d4 /usr ufs 1no logging
/dev/md/dsk/d3 /dev/md/rdsk/d3 /var ufs 1no logging
/dev/md/dsk/d7 /dev/md/rdsk/d7 /export ufs2 yes logging
/dev/md/dsk/d5 /dev/md/rdsk/d5 /usr/localufs 2 yes logging
/dev/dsk/c2t0d0s0 /dev/rdsk/c2t0d0s0/export2 ufs 2 yes logging
swap - /tmp tmpfs - yes size=512m
mount adds an entry, umount deletes anentry.
mounting applies to local filesystemes, orremote filesystems via NFS
Local mount example:
mount -F ufs -o logging /dev/dsk/c0t0d0s3/mnt
At Remote server:
share, shareall, or add entry in/etc/dfs/dfstab
# share -F nfs /var/mail
Unmount a mounted FS
First check who is using it
# fuser -c mountpoint
# umount mointpoint
2.2.2 Mounting a NFS filesystem in HP-UX:
=========================================
Mounting Remote File Systems
You can use either SAM or the mount commandto mount file systems located on a remote
system.
Before you can mount file systems locatedon a remote system, NFS software must be
installed and
configured on both local and remotesystems. Refer to Installing and Administering
NFS for information.
For information on mounting NFS filesystems using SAM, see SAM's online help.
To mount a remote file system using HP-UXcommands,
You must know the name of the host machineand the file system's directory on the
remote machine.
Establish communication over a networkbetween the local system (that is, the
"client") and the
remote system. (The local system must beable to reach the remote system via whatever
hosts database is in use.)
(See named(1M) and hosts(4).) If necessary,test the connection with /usr/sbin/ping;
see ping(1M).
Make sure the file /etc/exports on theremote system lists the file systems that you
wish to make available
to clients (that is, to "export")and the local systems that you wish to mount the
file systems.
For example, to allow machines called rolfand egbert to remotely mount the /usr file
system, edit the file
/etc/exports on the remote machine andinclude the line:
/usr rolf egbert
Execute /usr/sbin/exportfs -a on the remotesystem to export all directories in
/etc/exports to clients.
For more information, see exportfs(1M).
NOTE: If you wish to invoke exportfs -a atboot time, make sure the NFS
configuration file /etc/rc.config.d/nfsconf
on the remote system contains the followingsettings: NFS_SERVER=1 and START_MOUNTD=1.
The client's /etc/rc.config.d/nfsconf filemust contain NFS_CLIENT=1. Then issue the
following command
to run the script:
/sbin/init.d/nfs.server start
Mount the file system on the local system,as in:
# mount -F nfs remotehost:/remote_dir/local_dir
Just a bunch of mount command examples:
---------------------------------------
# mount
# mount -a
# mountall -l
# mount -t type device dir
# mount -F pcfs /dev/dsk/c0t0d0p0:c /pcfs/c
# mount /dev/md/dsk/d7 /u01
# mount sun:/home /home
# mount -t nfs 137.82.51.1:/share/sunos/local/usr/local
# mount /dev/fd0 /mnt/floppy
# mount -o ro /dev/dsk/c0t6d0s1 /mnt/cdrom
# mount -V cdrfs -o ro /dev/cd0 /cdrom
2.2.3 Solaris mount command:
============================
The unix mount command is used to mount afilesystem, and it attaches disks, and
directories logically
rather than physically. It takes a minimumof two arguments:
1) the name of the special device whichcontains the filesystem
2) the name of an existing directory onwhich to mount the file system
Once the file system is mounted, thedirectory becomes the mount point. All the file
systems will now be usable
as if they were subdirectories of the filesystem they were mounted on. The table of
currently mounted file systems
can be found by examining the mounted filesystem information file. This is provided
by a file system that is usually
mounted on /etc/mnttab.
Mounting a file system causes three actionsto occur:
1. The superblock for the mounted filesystem is read into memory
2. An entry is made in the /etc/mnttab file
3. An entry is made in the inode for thedirectory on which the file system is
mounted which marks the directory
as a mount point
The /etc/mountall command mounts allfilesystems as described in the /etc/vfstab file.
Note that /etc/mount and /etc/mountallcommands can only be executed by the superuser.
OPTIONS
-F FSType
Used to specify the FSType on which tooperate. The FSType must be specified or
must be determinable from
/etc/vfstab, or by consulting /etc/default/fsor /etc/dfs/fstypes.
-a [ mount_points. . . ]
Perform mount or umount operations inparallel, when possible.
If mount points are not specified, mountwill mount all file systems whose
/etc/vfstab "mount at boot"
field is "yes". If mount pointsare specified, then /etc/vfstab "mount at boot" field
will be ignored.
If mount points are specified, umount willonly umount those mount points. If none is
specified, then umount
will attempt to unmount all file systems in/etc/mnttab, with the exception of
certain system
required file systems: /, /usr, /var,/var/adm, /var/run, /proc, /dev/fd and /tmp.
-f Forcibly unmount a file system.
Without this option, umount does not allowa file system to be unmounted if a file
on the file system is
busy. Using this option can cause data lossfor open files; programs which access
files after the file system
has been unmounted will get an error (EIO).
-p Print the list of mounted file systemsin the /etc/vfstab format. Must be the only
option specified.
-v Print the list of mounted file systemsin verbose format. Must be the only option
specified.
-V Echo the complete command line, but donot execute the command. umount generates a
command line by using the
options and arguments provided by the userand adding to them information derived
from /etc/mnttab. This
option should be used to verify andvalidate the command line.
generic_options
Options that are commonly supported by mostFSType-specific command modules. The
following options are
available:
-m Mount the file system without making anentry in /etc/mnttab.
-g Globally mount the file system. On aclustered system, this globally mounts the
file system on
all nodes of the cluster. On anon-clustered system this has no effect.
-o Specify FSType-specific options in acomma separated (without spaces) list of
suboptions
and keyword-attribute pairs forinterpretation by the FSType-specific module of
the command.
(See mount_ufs(1M))
-O Overlay mount. Allow the file system tobe mounted over an existing mount point,
making
the underlying file system inaccessible. Ifa mount is attempted on a pre-existing
mount point
without setting this flag, the mount willfail, producing the error "device busy".
-r Mount the file system read-only.
Example mount:
mount -F ufs -o logging /dev/dsk/c0t0d0s3/mnt
Example mountpoints and disks:
Mountpunt Device Omvang Doel
/ /dev/md/dsk/d1 100 Unix Root-filesysteem
/usr/dev/md/dsk/d3 1200 Unix usr-filesysteem
/var/dev/md/dsk/d4 200
200
Unix var-filesysteem
/home /dev/md/dsk/d5 Unix opt-filesysteem
/opt /dev/md/dsk/d6 4700 Oracle_Home
/u01 /dev/md/dsk/d7 8700 Oracle datafiles
/u02 /dev/md/dsk/d8 8700 Oracle datafiles
/u03 /dev/md/dsk/d9 8700 Oracle datafiles
/u04 /dev/md/dsk/d10 8700 Oracle datafiles
/u05 /dev/md/dsk/d110 8700
/dev/md/dsk/d120 8700
Oracle datafiles
/u06Oracle datafiles
/u07 /dev/md/dsk/d123 8650 Oracle datafiles
Suppose you have only 1 disk of about 72GB,2GB RAM:
Entire disk= Slice 2
/ Slice 0, partition about 2G
swap Slice 1, partition about 4G
/export Slice 3, partition about 50G, maybeyou link it to /u01
/var Slice 4, partition about 2G
/opt Slice 5, partition about 10G if youplan to install apps here
/usr Slice 6, partition about 2G
/u01 Slice 7, partition optional, standardit's /home
Depending on how you configure /export,size could be around 20G
find . -name dfctowdk\*.zip | while readfile; do pkzip25 -extract -translate=unix ->
2.2.4 mount command on AIX:
===========================
Typical examples:
# mount -o soft 10.32.66.75:/data/nim /mnt
# mount -o soft abcsrv:/data/nim /mnt
# mount -o soft n580l03:/data/nim /mnt
Note 1:
mount [ -f ] [ -n Node ] [ -o Options ] [-p ] [ -r ] [ -v VfsName ] [ -t Type | [
Device | Node:Directory ]
Directory | all | -a ] [-V[generic_options] special_mount_points
If you specify only the Directoryparameter, the mount command takes it to be the
name of the directory or file on which
a file system, directory, or file isusually mounted (as defined in the
/etc/filesystems file). The mount commandlooks up
the associated device, directory, or fileand mounts it. This is the most convenient
way of using the mount command,
because it does not require you to rememberwhat is normally mounted on a directory
or file. You can also specify only
the device. In this case, the commandobtains the mount point from the
/etc/filesystems file.
The /etc/filesystems file should include astanza for each mountable file system,
directory, or file. This stanza should
specify at least the name of the filesystem and either the device on which it
resides or the directory name.
If the stanza includes a mount attribute,the mount command uses the associated
values. It recognizes five values
for the mount attributes: automatic, true,false, removable, and readonly.
The mount all command causes all filesystems with the mount=true attribute to be
mounted in their normal places.
This command is typically used duringsystem initialization, and the corresponding
mounts are referred to as
automatic mounts.
Example mount command on AIX:
-----------------------------
$ mount
node mounted mounted over vfs date options
-------------------------------------------- ------------ ---------------
/dev/hd4 / jfs2 Jun06 17:15 rw,log=/dev/hd8
/dev/hd2 /usrjfs2 Jun 06 17:15 rw,log=/dev/hd8
/dev/hd9var /varjfs2 Jun 06 17:15 rw,log=/dev/hd8
/dev/hd3 /tmpjfs2 Jun 06 17:15 rw,log=/dev/hd8
/dev/hd1 /home jfs2 Jun 06 17:16rw,log=/dev/hd8
/proc /proc procfs Jun 06 17:16 rw
/dev/hd10opt /opt jfs2 Jun 06 17:16rw,log=/dev/hd8
/dev/fslv00 /XmRec jfs2 Jun 06 17:16rw,log=/dev/hd8
/dev/fslv01 /tmp/m2 jfs2 Jun 06 17:16rw,log=/dev/hd8
/dev/fslv02 /software jfs2 Jun 06 17:16rw,log=/dev/hd8
/dev/oralv /opt/app/oracle jfs2 Jun 0617:25 rw,log=/dev/hd8
/dev/db2lv /db2_database jfs2 Jun 06 19:54rw,log=/dev/loglv00
/dev/fslv03 /bmc_home jfs2 Jun 07 12:11rw,log=/dev/hd8
/dev/homepeter /home/peter jfs2 Jun 1318:42 rw,log=/dev/hd8
/dev/bmclv /bcict/stage jfs2 Jun 15 15:21rw,log=/dev/hd8
/dev/u01 /u01jfs2 Jun 22 00:22 rw,log=/dev/loglv01
/dev/u02 /u02jfs2 Jun 22 00:22 rw,log=/dev/loglv01
/dev/u05 /u05jfs2 Jun 22 00:22 rw,log=/dev/loglv01
/dev/u03 /u03jfs2 Jun 22 00:22 rw,log=/dev/loglv01
/dev/backuo/backup_ora jfs2 Jun 22 00:22 rw,log=/dev/loglv02
/dev/u02back/u02back jfs2 Jun 22 00:22 rw,log=/dev/loglv03
/dev/u01back/u01back jfs2 Jun 22 00:22 rw,log=/dev/loglv03
/dev/u05back/u05back jfs2 Jun 22 00:22 rw,log=/dev/loglv03
/dev/u04back/u04back jfs2 Jun 22 00:22 rw,log=/dev/loglv03
/dev/u03back/u03back jfs2 Jun 22 00:22 rw,log=/dev/loglv03
/dev/u04 /u04jfs2 Jun 22 10:25 rw,log=/dev/loglv01
Example /etc/filesystems file:
/var:
dev = /dev/hd9var
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
type = bootfs
vol = /var
free = false
/tmp:
dev = /dev/hd3
vfs = jfs2
log = /dev/hd8
mount = automatic
check = false
vol = /tmp
free = false
/opt:
dev = /dev/hd10opt
vfs = jfs2
log = /dev/hd8
mount = true
check = true
vol = /opt
free = false
Example of the relation of Logigal Volumesand mountpoints:
/dev/lv01 = /u01
/dev/lv02 = /u02
/dev/lv03 = /u03
/dev/lv04 = /data
/dev/lv00 = /spl
2.2.5 mounting a CDROM:
=======================
AIX:
# mount -r -v cdrfs /dev/cd0 /cdrom
SuSE Linux:
# mount -t iso9660 /dev/cdrom /cdrom
# mount -t iso9660 /dev/cdrom /media/cdrom
Redhat Linux:
# mount -t iso9660 /dev/cdrom /media/cdrom
Solaris:
# mount -r -F hsfs /dev/dsk/c0t6d0s2 /cdrom
HPUX:
mount -F cdfs -o rr /dev/dsk/c1t2d0 /cdrom
Other commands on Linux:
Sometimes on some Linux, and some scsiCDROM devices, you might try
# mount /dev/sr0 /mount_point
# mount -t iso9660 /dev/sr0 /mount_point
2.2.6 Some other commands related to mounts:
===========================================
fsstat command:
On some unixes, the fsstat command isavailable. It provides filesystem statitstics.
It can take a lot of switches, thus be sureto check the man pages.
On Solaris, the following example shows thestatistics for each file operation for
"/" (using the -f option):
$ fsstat -f /
Mountpoint: /
operation #ops bytes
open 8.54K
close 9.8K
read 43.6K 65.9M
write 1.57K 2.99M
ioctl 2.06K
setfl 4
getattr 40.3K
setattr 38
access 9.19K
lookup 203K
create 595
remove 56
link 0
rename 9
mkdir 19
rmdir 0
readdir 2.02K 2.27M
symlink 4
readlink 8.31K
fsync 199
inactive 2.96K
fid 0
rwlock 47.2K
rwunlock 47.2K
seek 29.1K
cmp 42.9K
frlock 4.45K
space 8
realvp 3.25K
getpage 104K
putpage 2.69K
map 13.2K
addmap 34.4K
delmap 33.4K
poll 287
dump 0
pathconf 54
pageio 0
dumpctl 0
dispose 23.8K
getsecattr 697
setsecattr 0
shrlock 0
vnevent 0
user command: fAIX:
-
Purpose
Identifies processes using a file or filestructure.
Syntax
fuser [ -c | -d | -f ] [ -k ] [ -u ] [ -x ][ -V ]File ...
Description
The fuser command lists the process numbersof local processes that use the local or
emote filesrspecified by the Fileparameter. For block special devices, the command lists the
rocesses that usepny file on that device.
Flags
aua-
-c Reports on any open files in the filesystem containing File.
-d Implies the use of the -c and -x flags.Reports on any open files which haved been
nlinked from the file system
(deleted from the parent directory). Whenused in conjunction with the -V flag, it
lso reports the inode number
and size of the deleted file.
f Reports on open instances of File only.
-k Sends the SIGKILL signal to each localprocess. Only the root user can kill a
rocess of another user.p-u Provides thelogin name for local processes in parentheses after the process number.
V Provides verbose output.-
a-x Used in conjunction with -c or -f,reports on executable and loadable objects in
ddition to the standard fuser output.
To list the process numbers of localprocesses using the /etc/passwd file, enter:
fuser /etc/passwd #
To list the process numbers and user loginnames of processes using the
etc/filesystems file, enter:/
fuser -u /etc/filesystems #
To terminate all of the processes using agiven file system, enter:
#fuser -k -x -u /dev/hd1 -OR#
fuser -kxuc /home
Either command lists the process number anduser name, and then terminates each
process that is using
the /dev/hd1 (/home) file system. Only theroot user can terminate processes that
belong to another user.
You might want to use this command if youare trying to unmount the /dev/hd1 file
system and a process
that is accessing the /dev/hd1 file systemprevents this.
To list all processes that are using a filewhich has been deleted from a given file
system, enter:
# fuser -d /usr
Examples on linux distro's:
- To kill all processes accessing the filesystem /home in any way.
# fuser -km /home
- invokes something if no other process isusing /dev/ttyS1.
if fuser -s /dev/ttyS1; then :; elsesomething; fi
- shows all processes at the (local) TELNETport.
# fuser telnet/tcp
A similar command is the lsof command.
2.2.7 Starting and stopping NFS:
================================
Short note on stopping and starting NFS.See other sections for more detail.
On all unixes, a number of daemons shouldbe running in order for NFS to be
functional, like for example
the rpc.* processes, biod, nfsd and others.
Once nfs is running, and in order toactually "share" or "export" your filesystem on
your server, so remote clients
are able to mount the nfs mount, in mostcases you should edit the "/etc/exports" file.
See other sections in this document (searchon exportfs) on how to accomplish this.
-- AIX:
The following subsystems are part of thenfs group: nfsd, biod, rpc.lockd, rpc.statd,
and rpc.mountd.
The nfs subsystem (group) is under controlof the "resource controller", so starting
and stopping nfs
is actually easy
# startsrc -g nfs
# stopsrc -g nfs
Or use smitty.
-- Redhat Linux:
# /sbin/service nfs restart
# /sbin/service nfs start
# /sbin/service nfs stop
-- On some other Linux distros
# /etc/init.d/nfs start
# /etc/init.d/nfs stop
# /etc/init.d/nfs restart
-- Solaris:
If the nfs daemons aren't running, then youwill need to run:
# /etc/init.d/nfs.server start
-- HP-UX:
Issue the following command on the NFSserver to start all the necessary NFS
processes (HP):
# /sbin/init.d/nfs.server start
Or if your machine is only a client:
# cd /sbin/init.d
# ./nfs.client start
===========================================
3. Change ownership file/dir, adding users:
===========================================
3.1 Changing ownership:
chown -R user[:group] file/dir (SVR4)
chown -R user[.group] file/dir (bsd)
(-R recursive dirs)
Examples:
chown -R oracle:oinstall /opt/u01
chown -R oracle:oinstall /opt/u02
chown -R oracle:oinstall /opt/u03
chown -R oracle:oinstall /opt/u04
-R means all subdirs also.
c- Give permissions as owner to userrjanssen.hown rjanssen file.txt
# groupadd dba
# useradd oracle
# mkdir /usr/oracle
# mkdir /usr/oracle/9.0
# chown -R oracle:dba /usr/oracle
# touch /etc/oratab
# chown oracle:dba /etc/oratab
Note: Not owner message:
>>> Solaris:
di/eit is possible to turn the chowncommand on or off (i.e., allow it to be used or
sallow its use) on a system by
altering the /etc/system file. The/etc/system file, along with the files in
tc/default should be thought of a
"system policy files" -- filesthat allow the systems administrator to determine such
ings as whetherthreroot can login over thenetwork, whether su commands are logged, and whether a
gular user can change ownership of his ownfiles.
On a system disallowing a user to change ownershipof his files (this is now the
fault), the value of rstchown is set to 1.
Think of this as saying "restrictchown is set to TRUE". You might see a line like
is in /etc/system (or no rstchown value atall):
set rstchown=1
deth
a system allowing chown by regular users,this value will be set to 0 as shown here:
set rstchown=0
OnWhenever the /etc/system file is changed,the system will have to be rebooted for the
anges to take effect.chSince there is nodaemon process associated with commands such a chown, there is no
ocess that one could sendpra hangup (HUP)to effect the change in policy "on the fly".
Why might system administrators restrictaccess to the chown command? For a system on
ich disk quotas are enforced,wh
they might not want to allow files to be"assigned" by one user to another user's
ota. More importantly,
for a system on which accountability isdeemed important, system administrators will
nt to know who
quwacreated each file on a system - whetherto track down a potential system abuse or
mply to ask if a file that is
cupying space in a shared directory or in/tmp can be removed.
When a system disallows use of the chowncommand, you can expect to see dialog like
this:
sioc%
chchown wallace myfile
own: xyz: Not owner
Though it would be possible to disallow"chowning" of files by changing permissions
/usr/bin/chown,on/uMaexsusuch a changewould not slow down most Unix users. They would simple copy the
sr/bin/chown file to their own directory
and make their copy executable. Designed tobe extensible, Unix will happily comply.
king the change in the /etc/system
file blocks any chown operation from takingeffect, regardless of where the
ecutable is stored, who owns it,
and what it is called. If usage of chown isrestricted in /etc/system, only the
peruser can change ownership of files.
2 Add a user in Solaris: 3.
Examples:
# useradd -u 3000 -g other -d/export/home/tempusr -m -s /bin/ksh -c "temporary user"
tempusr
# useradd -u 1002 -g dba -d /export/home/avdsel-m -s /bin/ksh -c "Albert van der
Sel" avdsel
# useradd -u 1001 -g oinstall -G dba -d/export/home/oraclown -m -s /bin/ksh -c
"Oracle owner" oraclown
# useradd -u 1005 -g oinstall -G dba -d/export/home/brighta -m -s /bin/ksh -c
"Bright Alley" brighta
useradd -u 300 -g staff -G staff -d/home/emc -m -s /usr/bin/ksh -c "EMC user" emc
a password cannot be specified using theuseradd command.
Use passwd to give the user a password:
# passwd tempusr
UID must be unique and is typically a numberbetween 100 and 60002
GID is a number between 0 and 60002
Or use the graphical "admintool"or smc, the solaris management console.
-- Profiles a user can use to set theenvironment:
1. Korn Shell ksh:
When the POSIX or Korn Shell is your loginshell, it looks for these following files
and executes them, if they exist:
/etc/profile
This default system file is executed by theshell program and sets up default
environment variables.
.profile
If this file exists in your home directory,it is executed next at login.
At any time-this includes login time-thePOSIX or Korn Shell is invoked, it looks for
the file referenced by the following shellvariable,
and executes it, if it exists:
ENV
When you invoke the shell, it looks for ashell variable called ENV which is usually
set in your .profile. ENV is evaluated andif it is set
to an existing file, that file is executed.By convention, ENV is usually set to
.kshrc but may be set to any file name.
These files provide the means forcustomizing the shell environment to fit your needs.
2. Bourne Shell sh:
it looks for these following files andexecutes them, if they exist:
/etc/profile
.profle in the home directory, for example"/home/user1/.profile"
3.3 Add a user in AIX:
You can also use the useradd command, justas in Solaris.
Or use the native "mkuser"command.
# mkuser albert
The mkuser command does not create passwordinformation for a user. It initializes
the password field
with an * (asterisk). Later, this field isset with the passwd or pwdadm command.
New accounts are disabled until the passwdor pwdadm commands are used to add
authentication
information to the /etc/security/passwdfile.
You can use the Users application inWeb-based System Manager to change user
characteristics. You could also
use the System Management Interface Tool(SMIT) "smit mkuser" fast path to run this
command.
The /usr/lib/security/mkuser.default filecontains the default attributes for new
users.
This file is an ASCII file that contains userstanzas. These stanzas have attribute
default values
for users created by the mkuser command.Each attribute has the Attribute=Value form.
If an attribute
has a value of $USER, the mkuser commandsubstitutes the name of the user. The end of
each attribute pair
and stanza is marked by a new-linecharacter.
There are two stanzas, user and admin, thatcan contain all defined attributes except
the id and admin attributes.
The mkuser command generates a unique idattribute. The admin attribute depends on
whether the -a flag is used with
the mkuser command.
A typical user stanza looks like thefollowing:
user:
pgroup = staff
groups = staff
shell = /usr/bin/ksh
home = /home/$USER
auth1 = SYSTEM
# mkuser [ -de | -sr ] [-attrAttributes=Value [ Attribute=Value... ] ] Name
# mkuser [ -R load_module ] [ -a ] [Attribute=Value ... ] Name
To create the davis user account with thedefault values in the
/usr/lib/security/mkuser.default file,type:
# mkuser davis
To create the davis account with davis asan administrator, type:
# mkuser -a davis
Only the root user or users with theUserAdmin authorization can create davis as an
administrative user.
To create the davis user account and setthe su attribute to a value of false, type:
# mkuser su=false davis
To create the davis user account that is identified andauthenticated through the
LDAP load module, type:
# mkuser -R LDAP davis
To add davis to the groups finance and accounting,enter:
chuser groups=finance,accounting davis
-- Add a user with the smit utility:
Start SMIT by entering
smit <Enter>
From the Main Menu, make the followingselections:
-Security and Users
-Users
-Add a User to the System
The utility displays a form for adding newuser information. Use the <Up-arrow> and
<Down-arrow> keys to move through
the form. Do not use <Enter> untilyou are finished and ready to exit the screen.
Fill in the appropriate fields of theCreate User form (as listed in Create User
Form) and press <Enter>.
The utility exits the form and creates thenew user.
-- Using SMIT to Create a Group:
Use the following procedure to create agroup.
Start SMIT by entering the followingcommand:
smit <Enter>
The utility displays the Main Menu.
From the Main Menu, make the followingselections:
-Security and Users
-Users
-Add a Group to the System
The utility displays a form for adding newgroup information.
Type the group name in the Group Name fieldand press <Enter>.
The group name must be eight characters orless.
The utility creates the new group,automatically assigns the next available GID, and
exits the form
Primary Authentication method of system:
To check whether root has a primaryauthentication method of SYSTEM, use the
following command:
# lsuser -a auth1 root
If needed, change the value by using
# chuser auth1=SYSTEM root
3.4 Add a user in HP-UX:
-- Example 1:
Add user john to the system with all of thedefault attributes.
# useradd john
Add the user john to the system with a UIDof 222 and a primary group
of staff.
# useradd -u 222 -g staff john
-- Example 2:
=> Add a user called guestuser as perfollowing requirements
=> Primary group member of guests
=> Secondary group member of www andaccounting
=> Shell must be /usr/bin/bash3
=> Home directory must be/home/guestuser
# useradd -g guests -G www,accounting -d/home/guests -s /home/guestuser/ -m guestuser
# passwd guestuser
3.5 Add a user in Linux Redhat:
You can use tools like useradd or groupaddto create new users and groups from the
shell prompt.
But an easier way to manage users andgroups is through the graphical application,
User Manager.
Users are described in the /etc/passwd file
Groups are stored on Red Hat Linux in the/etc/group file.
Or invoke the Gnome Linuxconf GUI Tool bytyping "linuxconf". In Red Hat Linux,
linuxconf is found in the
/bin directory.
================================
4. Change filemode, permissions:
================================
Permissions are given to:
u = user
g = group
o = other/world
a = all
file/directory permissions (or also called"filemodes") are:
r = read
w = write
x = execute
special modes are:
X = sets execute if already set (this oneis particularly sexy, look below)
s = set setuid/setgid bit
t = set sticky bit
Examples:
readable by all, everyone
% chmod a+r essay.001
to remove read write and executepermissions on the file biglist for the group and
others
% chmod go-rwx biglist
make executable:
% chmod +x mycommand
set mode:
% chmod 644 filename
rwxrwxrwx=777
rw-rw-rw-=666
rw-r--r--=644 corresponds to umask 022
r-xr-xr-x=555
rwxrwxr-x=775
1 = execute
2 = write
4 = read
note that the total is 7
execute and read are: 1+4=5
read and write are: 2+4=6
read, write and exec: 1+2+4=7
and so on
directories must always be executable...
so a file with, say 640, means, the ownercan read and write (4+2=6), the group can
read (4)
and everyone else has no permission to usethe file (0).
chmod -R a+X .
This command would set the executable bit(for all users) of all directories and
executables
below the current directory that presentlyhave an execute bit set. Very helpful when
you want to set
all your binary files executable foreveryone other than you without having to set
the executable bit
of all your conf files, for instance.*wink*
chmod -R g+w .
This command would set all the contentsbelow the current directory writable by your
current group.
chmod -R go-rwx
This command would remove permissions forgroup and world users without changing the
bits for the file owner.
Now you don't have to worry that 'find .-type f -exec chmod 600 {}\;' will change
your binary files
non-executable. Further, you don't need torun an additional command to chmod your
directories.
chmod u+s /usr/bin/run_me_setuid
This command would set the setuid bit ofthe file. It's simply easier than
remembering which number to use
when wanting to setuid/setgid, IMHO.
========================
5. About the sticky bit:
========================
- This info is valid for most Unix OSincluding Solaris and AIX:
A 't' or 'T' as the last character of the"ls -l" mode characters
indicates that the "sticky" (savetext image) bit is set. See ls(1) for
an explanation the distinction between 't'and 'T'.
The sticky bit has a different meaning,depending on the type of file it
is set on...
sticky bit on directories
[From chmod(2)]
If the mode bit S_ISVTX (sticky bit) is seton a directory, files
inside the directory may be renamed orremoved only by the owner of
the file, the owner of the directory, orthe superuser (even if the
modes of the directory would otherwiseallow such an operation).
[Example]
drwxrwxrwt 104 bin bin 14336 Jun 7 00:59/tmp
Only root is permitted to turn the stickybit on or off. In addition the sticky bit
applies to anyone
who accesses the file. The syntax forsetting the sticky bit on a dir /foo directory
is as follows:
chmod +t /foo
sticky bit on regular files
[From chmod(2)]
If an executable file is prepared forsharing, mode bit S_ISVTX prevents
the system from abandoning the swap-spaceimage of the program-text
portion of the file when its last userterminates. Then, when the next
user of the file executes it, the text neednot be read from the file
system but can simply be swapped in, thussaving time.
[From HP-UX Kernel Tuning and PerformanceGuide]
Local paging. When applications are locatedremotely, set the "sticky
bit"
on the applications binaries, using thechmod +t command. This tells the
system to page the text to the local disk.Otherwise, it is "retrieved"
across the network. Of course, this wouldonly apply when there is actual
paging occurring. More recently, there is akernel parameter,
page_text_to_local, which when set to 1,will tell the kernel to page all
NFS executable text pages to local swapspace.
[Example]
-r-xr-xr-t 6 binbin 24111111111664 Nov 14 2000
/usr/bin/vi
Solaris:
--------
The sticky bit on a directory is apermission bit that protects files within that
directory.
If the directory has the sticky bit set,only the owner of the file, the owner of the
directory,
or root can delete the file. The sticky bitprevents a user from deleting other
users' files from
public directories, such as uucppublic:
castle% ls -l /var/spool/uucppublic
drwxrwxrwt 2 uucp uucp 512 Sep 10 18:06uucppublic
castle%
When you set up a public directory on aTMPFS temporary file system, make sure that
you set the sticky bit manually.
You can set sticky bit permissions by usingthe chmod command to assign the octal
value 1 as the first number
in a series of four octal values. Use thefollowing steps to set the sticky bit on a
directory:
1. If you are not the owner of the file ordirectory, become superuser.
2. Type chmod <1nnn> <filename>and press Return.
3. Type ls -l <filename> and pressReturn to verify that the permissions of the file
have changed.
The following example sets the sticky bitpermission on the pubdir directory:
castle% chmod 1777 pubdir
castle% ls -l pubdir
drwxrwxrwt 2 winsor staff 512 Jul 15 21:23pubdir
castle%
================
6. About SETUID:
================
Each process has three user ID's:
the real user ID (ruid)
the effective user ID (euid) and
the saved user ID (suid)
The real user ID identifies the owner ofthe process, the effective uid is used in most
access control decisions, and the saved uidstores a previous user ID so that it
can be restored later.
Similar, a process has three group ID's.
When a process is created by fork, itinherits the three uid's from the parent process.
When a process executes a new file byexec..., it keeps its three uid's unless the
set-user-ID bit of the new file is set, inwhich case the effective uid and saved uid
are assigned the user ID of the owner of thenew file.
When setuid (set-user identification)permission is set on an executable file, a
process that runs this file
is granted access based on the owner of thefile (usually root), rather than the user
who created the process.
This permission enables a user to accessfiles and directories that are normally
available only to the owner.
The setuid permission is shown as an s inthe file permissions.
For example, the setuid permission on thepasswd command enables a user to change
passwords,
assuming the permissions of the root ID arethe following:
castle% ls -l/usr/bin/passwd
-r-sr-sr-x 3 rootsys 96796 Jul 15 21:23 /usr/bin/passwd
castle%
You setuid permissions by using the chmodcommand to assign the octal value 4 as the
first number
in a series of four octal values. Use thefollowing steps to setuid permissions:
1. If you are not the owner of the file ordirectory, become superuser.
2. Type chmod <4nnn> <filename>and press Return.
3. Type ls -l <filename> and pressReturn to verify that the permissions of the file
have changed.
The following example sets setuidpermission on the myprog file:
#chmod 4555 myprog
-r-sr-xr-x 1 winsor staff 12796 Jul 1521:23 myprog
#
The setgid (set-group identification)permission is similar to setuid, except that
the effective group ID
for the process is changed to the groupowner of the file and a user is granted
access based on permissions
granted to that group. The /usr/bin/mailprogram has setgid permissions:
castle% ls -l /usr/bin/mail
-r-x-s-x 1 bin mail 64376 Jul 15 21:27/usr/bin/mail
castle%
When setgid permission is applied to adirectory, files subsequently created in the
directory belong to the group
the directory belongs to, not to the groupthe creating process belongs to. Any user
who has write permission
in the directory can create a file there;however, the file does not belong to the
group of the user,
but instead belongs to the group of thedirectory.
You can set setgid permissions by using thechmod command to assign the octal value 2
as the first number
in a series of four octal values. Use thefollowing steps to set setgid permissions:
1. If you are not the owner of the file ordirectory, become superuser.
2. Type chmod <2nnn> <filename>and press Return.
3. Type ls -l <filename> and pressReturn to verify that the permissions of the file
have changed.
The following example sets setuidpermission on the myprog2 file:
#chmod 2551 myprog2
#ls -l myprog2
-r-xr-s-x 1 winsor staff 26876 Jul 15 21:23myprog2
#
=========================
7. Find command examples:
=========================
Introduction
The find command allows the Unix user toprocess a set of files and/or directories in
a file subtree.
You can specify the following:
where to search (pathname)
what type of file to search for (-type:directories, data files, links)
how to process the files (-exec: run aprocess against a selected file)
the name of the file(s) (-name)
perform logical operations on selections(-o and -a)
Search for file with a specific name in aset of files (-name)
EXAMPLES
# find . -name "rc.conf" -print
This command will search in the currentdirectory and all sub directories for a file
named rc.conf.
Note: The -print option will print out thepath of any file that is found with that
name. In general -print wil
print out the path of any file that meetsthe find criteria.
# find . -name "rc.conf" -execchmod o+r '{}' \;
This command will search in the currentdirectory and all sub directories. All files
named rc.conf will be processed
by the chmod -o+r command. The argument'{}' inserts each found file into the chmod
command line.
The \; argument indicates the exec commandline has ended.
The end results of this command is allrc.conf files have the other permissions set
to read access
(if the operator is the owner of the file).
# find . -exec grep"www.athabasca" '{}' \; -print
This command will search in the currentdirectory and all sub directories.
All files that contain the string will havetheir path printed to standard output.
# find / -xdev -size +2048 -ls | sort -r +6
This command will find all files in theroot directory larger than 1 MB.
# find . -exec grep "CI_ADJ_TYPE"{} \; -print
This command search all subdirs all filesto find text CI_ADJ_TYPE
Other examples:
# find . -name file -print
# find / -name $1 -exec ls -l {} \;
# find / -user nep -exec ls -l {} \;>nepfiles.txt
In English: search from the root directoryfor any files owned by nep
and execute an ls -l on the file when anyare found.
Capture all output in nepfiles.txt.
# find $HOME -name \*.txt -print
In order to protect the asterisk from beingexpanded by the shell,
it is necessary to use a backslash toescape the asterisk as in:
# find / -atime +30 -print
This prints files that have not beenaccessed in the last 30 days
# find / -atime +100 -size +500000c -print
The find search criteria can be combined.This command will locate and list all files
that were last accessed more than 100 daysago, and whose size exceeds 500,000 bytes.
# find /opt/bene/process/logs -name'ALBRACHT*' -mtime +90 -exec rm {} \;
# find /example /new/example -exec grep -l'Where are you' {} \;
# find /
# find . -name '*.trc' -mtime +3 -exec rm{} \;
# find / -fsonly hfs -print
# cd /; find . ! -path ./Disk -only -print| cpio -pdxm /Disk
# cd /; find . -path ./Disk -prune -o-print | cpio -pdxm /Disk
# cd /; find . -xdev -print | cpio -pdm/Disk
# find -type f -print | xargs chmod 444
# find -type d -print | xargs chmod 555
# find . -atime +1 -name '*' -exec rm -f {}\;
# find /tmp -atime +1 -name '*' -exec rm -f{} \;
# find /usr/tmp -atime +1 -name '*' -execrm -f {} \;
# find / -name core -exec rm -f {} \;
# find . -name "*.dbf" -mtime -2-exec ls {} \;
* Search and list all files from currentdirectory and down for the string ABC:
find ./ -name "*" -exec grep -HABC {} \;
find ./ -type f -print | xargs grep -H"ABC" /dev/null
egrep -r ABC *
* Find all files of a given type fromcurrent directory on down:
find ./ -name "*.conf" -print
* Find all user files larger than 5Mb:
find /home -size +5000000c -print
* Find all files owned by a user (definedby user id number. see /etc/passwd) on the
system: (could take a very long time)
find / -user 501 -print
* Find all files created or updated in thelast five minutes: (Great for finding
effects of make install)
find / -cmin -5
* Find all users in group 20 and changethem to group 102: (execute as root)
find / -group 20 -exec chown :102 {} \;
* Find all suid and setgid executables:
find /
find / -type f -perm +6000 -ls
Example:
cd /database/oradata/pegacc/archive
archdir=`pwd`
if [$archdir=="/database/oradata/pegacc/archive" ]
then
find . -name "*.dbf" -mtime +5-exec rm {} \;
else
echo "error in onderhoud PEGACCarchives" >>
/opt/app/oracle/admin/log/archmaint.log
fi
Example:
The following example shows how to findfiles larger than 400 blocks in the current
directory:
# find . -size +400 -print
REAL COOL EXAMPLE:
This example could even help in recovery ofa file:
In some rare cases a strangely-named filewill show itself in your directory and
appear to be
un-removable with the rm command. Here iswill the use of ls -li and find with its
-inum [inode]
primary does the job.
Let's say that ls -l shows your irremovableas
-rw-------1 smith smith 0 Feb 1 09:22 ?*?*P
Type:
ls -li
to get the index node, or inode.
11 smith smith 0 Feb 1 09:22 ?*?^P53805-rw-------
The inode for this file is 153805. Use find-inum [inode] to make sure that the file
is correctly identified.
% find -inum 153805 -print
./?*?*P
Here, we see that it is. Then used the-exec functionality to do the remove. .
% find . -inum 153805 -print -exec /bin/rm{} \;
Note that if this strangely named file werenot of zero-length, it might contain
accidentally misplaced
and wanted data. Then you might want todetermine what kind of data the file contains
and move the file
to some temporary directory for furtherinvestigation, for example:
% find . -inum 153805 -print -exec /bin/mv{} unknown.file \;
Will rename the file to unknown.file, soyou can easily inspect it.
COOL EXAMPLE: Using find and cpio to createreally good backups:
Suppose you have a lot of subdirs and filesin "/dir1/dira"
Now you want to copy, or backup, this to"/dir2/dirb"
And not only just the files and subdirs,BUT ALSO all filemodes (permissions),
wnership information, acl's etc.. oThen DONOT USE "cp -R" or something similar. Instead use "find" incombination with
he "cpio" backup command.
cd /dir1/dira
t#
# find . | cpio-pvdm /dir2/dirb
ote: difference betweeen mtime and atime:
In using the find command where you want todelete files older than a certain date,
ou can use
N-
yommands like cfforind . -name"*.log" -mtime +30 -exec rm {} \;
ind . -name "*.dbf" -atime +30 -exec rm {} \;
Why should you choose, or not choose,between atime and mtime?
It is important to distinguish between afile or directory's change time (ctime),
ccess time (atime),aand modify time(mtime).
ctime -- In UNIX, it is not possible totell the actual creation time of a file. The
time--change time-c
is the time when changes were made to thefile or directory's inode (owner,
ermissions, etc.).p
The ctime is also updated when the contentsof a file change. It is needed
y the dump commandb
to determine if the file needs to be backedup. You can view the ctime with
he ls -lc command. taatime -- Theatime--access time--is the time when the data of a file was last
ccessed. Displaying the contents
of a file or executing a shell script willupdate a file's atime, for example.
mtime -- The mtime--modify time--is the timewhen the actual contents of a file was
ast modified.l
This is the time displayed in a longdirectoring listing (ls -l).
Thats why backup utilities use the mtimewhen performing incremental backups:
When the utility reads the data for a filethat is to be included in a backup, it
oes notdaffect the file's modificationtime, but it does affect the file's access time.
So for most practical reasons, if you wantto delete logfiles (or other files) older
han a certain tdHate, its best to use themtime attribute.
ow to make those times visible?
shows atimels -l""
shows ctimels -lc""
shows mtimels -lm""
"istat filename" will show allthree.
pago-am1:/usr/local/bb>istatbb18b3.tar.gz
Inode 20 on device 10/9 File
Protection: rw-r--r--
Owner: 100(bb) Group: 100(bb)
Link count: 1 Length 427247 bytes
Last updated: Tue Aug 14 11:01:46 2001
Last modified: Thu Jun 21 07:36:32 2001
Last accessed: Thu Nov 01 20:38:46 2001
===================
7. Crontab command:
===================
Cron is uded to schedule or runperiodically all sorts of executable programs or
shell scripts,
like backupruns, housekeeping jobs etc..
The crond daemon makes it all happen.
Who has access to cron, is on most unixesdetermined by the "cron.allow" and
"cron.deny" files.
Every allowed user, can have it's own"crontab" file.
The crontab of root, is typically used forsystem administrative jobs.
On most unixes the relevant files can befound in:
/var/spool/cron/crontabs or
/var/adm/cron or
/etc/cron.d
For example, on Solaris the/var/adm/cron/cron.allow and /var/adm/cron/cron.deny
files control
which users can use the crontab command.
Most common usage:
- if you just want a listing: crontab -l
- if you want to edit and change: crontab-e
crontab [ -e | -l| -r | -v | File ]
--r remove, -l liste: edit, submit
A crontab file contains entries for eachcron job. Entries are separated by newline
characters.
Each crontab file entry contains six fieldsseparated by spaces or tabs in the
following form:
minute hour day_of_month month weekdaycommand
0 0 * 8 * /u/harry/bin/maintenance
Notes:
start and stop cron: Note 1:
-- Solaris and some other unixes:
er way to stop and restart cron are:
nit.d/cron stop
The prop# /etc/i# /etc/init.d/cron start
is 10 you could use the following commandas well:
refresh cron
In Solar# svcadm# svcadm-- Other
restart cron
way to restart cron:
unixes, cron is started by init and thereis a record in the /etc/initab file
which makes that happen. Check if yoursystem has indeed a record of cron in the
inittab file.
In most
The typesuperuseAgain, pRecourseor scrip
of start should be "respawn",which means that should the
r do a "kill -9 crond", the crondaemon is simply restarted again.
referrably, there should be a stop andstart script to restart cron.
Especially on AIX, there is no true way torestart cron in a neat way. Not via the
Control startscr command,
t, a standard method is available. Justkill crond and it will be restarted.
ny linux distros: -- On mart the crondaemon, you could do either a "service crond restart" or a"service
crond reload".
to restaNote 2:
cronjobs file Create aon
your VirYour filYou can do this on yourlocal computer in Notepad or you can create the file directly
tual Server using your favorite UNIX texteditor (pico, vi, etc).
e should contain the following entries:
TO="USER@YOUR-DOMAIN.NAME"
/usr/local/bin/vnukelog1 1-12/3 *
This will run the command"/usr/local/bin/vnukelog" (which clears all of your log
files) at
0 1
1 AM on the first day of the first month ofevery quarter, or January, April, July,
and October (1-12/3).
Obviously, you will need to substitute avalid e-mail address in the place of
UR-DOMAIN.NAME"."USER@YOIf youhname
"cronjobRegisterave created this fileon your local computer,
FTP the file up to your Virtual Server andstore it in your home directory under the
s" (you can actually use any name youwould like).
your cronjobs file with the system
After you have created your cronjobs file(and have uploaded it to your Virtual
Server if applicable),
you need to Telnet to your server andregister the file with the cron system daemon.
To do this, simply type:
crontab cronjobs
Or if you used a name other than"cronjobs", substitute the name you selected for the
occurrence of "cronjobs" above.
Note 3:
# use /bin/sh to run commands, no matterwhat /etc/passwd says
SHELL=/bin/sh
# mail any output to `paul', no matterwhose crontab this is
MAILTO=paul
#
# run five minutes after midnight, everyday
5 6-18 * * */opt/app/oracle/admin/scripts/grepora.sh
# run at 2:15pm on the first of every month-- output mailed to paul
15 14 1 * * $HOME/bin/monthly
# run at 10 pm on weekdays, annoy Joe
0 22 * * 1-5 mail -s "It's 10pm"joe%Joe,%%Where are your kids?%
23 0-23/2 * * * echo "run 23 minutesafter midn, 2am, 4am ..., everyday"
5 4 * * sun echo "run at 5 after 4every sunday"
2>&1 means:
It means that standard error is redirectedalong with standard output. Standard error
could be redirected to a different file,like
ls > toto.txt 2> error.txt If yourshell is csh or tcsh, you would redirect standard
output and standard error like this
lt >& toto.txt Csh or tcsh cannotredirect standard error separately.
Note 4:
thread
Q:
> Isn't there a way to refresh cron topick up changes made using
> crontab -e? I made the changes but thespecified jobs did not run.
> I'm thinking I need to refresh cron topick up the changes. Is this
> true? Thanks.
A:
Crontab -e should do that for you, that'sthe whole point of using
it rather than editing the file yourself.
Why do you think the job didn't run?
Post the crontab entry and the script. Givedetails of the version of
Tru64 and the patch level.
Then perhaps we can help you to figure outthe real cause of the problem.
Hope this helps
A:
I have seen the following problem whenediting the cron file for another
user:
crontab -e idxxxxxx
This changed the control file,
when I verified with crontab -l thecontents was correctly shown,
but the cron daemon did not execute the newcontents.
To solve the problem, I needed to followthe following commands:
su - idxxxxxx
crontab -l |crontab
This seems to work ... since then I preferthe following
su - idxxxxxx
crontab -e
which seems to work also ...
Note 5:
On AIX it is observed, that if the"daemon=" attribute of a user is set to be false,
this user cannot use crontab, even if theaccount is placed in cron.allow.
You need to set the attribute to"daemon=true".
* daemon Defines whether the user canexecute programs using the system
* resource controller (SRC). Possiblevalues: true or false.
Note 6:
If you want to quick test the crontab of auser:
su - user
and put the following in the crontab ofthat user:
* * * * * date >/tmp/elog
After checking the /tmp/elog file, whichwill rapidly fills with dates, don't forget
to remove the crontab entry shown above.
Note 7: the at and atq commands:
On many unix systems the scheduling"at" command and "atq" commands are available.
With "at", you can schedulecommands, and with "atq" you can view all your, or other
users, scheduled tasks.
atq- Display the jobs queued to run atspecified times
For example, on Solaris:
The at command is used to schedule jobs forexecution at a later time. Unlike
crontab, which schedules a job to happen atregular intervals,
a job submitted with at executes once, atthe designated time.
To submit an at job, type at followed bythe time that you would like the program to
execute. You'll see the at> promptdisplayed and it's here
that you enter the at commands. When youare finished entering the at command, press
control-d to exit the at prompt
and submit the job as shown in thefollowing example:
# at 07:45am today
at> who > /tmp/log
at> <Press Control-d>
job 912687240.a at Thu Jun 6 07:14:00
When you submit an at job, it is assigned ajob identification number, which becomes
its filename along with the .a extension.
The file is stored in the/var/spool/cron/atjobs directory. In much the same way as
it schedules crontab jobs,
the cron daemon controls the scheduling ofat files.
===========================
8. Job control, background:
===========================
To put a sort job (or other job) inbackground:
# sort < foo > bar &
To show jobs:
# jobs
To show processes:
# ps
# ps -ef | grep ora
Job in foreground -> background:
Ctrl-Z (suspend)
#bg or bg jobID
Job in background -> foreground:
# fg %jobid
Stop a process:
# kill -9 3535 (3535 is the pid, processid)
Stop a background process you may try this:
# kill -QUIT 3421
-- Kill all processes of a specific users:
To kill all processes of a specific user,enter:
# ps -u [user-id] -o pid | grep -v PID |xargs kill -9
Another way:
Use who to check out your current users andtheir terminals. Kill all processes
related to a specific terminal:
# fuser -k /dev/pts[#]
Yet another method:
Su to the user-id you wish to kill allprocesses of and enter:
# su - [user-id]-c kill -9 -1
Or su - to that userid, and use the killallcommand, which is available on most
unix'es, like for example AIX.
# killall
The nohup command:
When working with the UNIX operatingsystem, there will be times when you will want
to run commands that are immune
to log outs or unplanned login sessionterminations.
UNIX system administrators.
The UNIX command for handling this job isthe nohup (no hangup) command.
This is especially true for
Normally when you log out, or your sessionterminates unexpectedly, the system will
kill all processes you have started.
Starting a command with nohup counters thisby arranging for all stopped, running,
and background jobs to ignore
the SIGHUP signal.
The syntax for nohup is:
nohup command [arguments]
You may optionally add an ampersand to theend of the command line to run the job in
the background:
nohup command [arguments] &
If you do not redirect output from aprocess kicked off with nohup, both standard
output (stdout) and
This file will bestandard error (stderr)are sent to a file named nohup.out.
created in $HOME (your home directory)
Real-time monitoring of what isif it cannotbe created in the working directory.
being written to nohup.out
can be accomplished with the "tail -fnohup.out" command.
Although the nohup command is extremelyvaluable to UNIX system administrators, it is
also a must-know tool
for others who run lengthy or criticalprocesses on UNIX systems
The nohup command runs the commandspecified by the Command parameter and any related
Arg parameters,
ignoring all hangup (SIGHUP) signals. Usethe nohup command to run programs in the
background after logging off.
To run a nohup command in the background,add an & (ampersand) to the end of the
command.
Whether or not the nohup command output isredirected to a terminal, the output is
appended to the nohup.out file
in the current directory. If the nohup.outfile is not writable in the current
directory, the output is redirected
to the $HOME/nohup.out file. If neitherfile can be created nor opened for appending,
the command specified
by the Command parameter is not invoked. Ifthe standard error is a terminal, all
output written by the
named command to its standard error isredirected to the same file descriptor as the
standard output.
To run a command in the background afteryou log off, enter:
$ nohup find / -print &
After you enter this command, the followingis displayed:
670
$ Sending output to nohup.out
The process ID number changes to that ofthe background process started by &
(ampersand). The message Sending
output to nohup.out informs you that theoutput from the find / -print command is in
the nohup.out file.
You can log off after you see thesemessages, even if the find command is still
running.
Example of ps -ef on a AIX5 system:
[LP 1]root@ol16u209:ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Oct 17 -0:00 /etc/init
root 4198 1 0 Oct 17 -0:00/usr/lib/errdemon
root 5808 1 0 Oct 17 -1:15 /usr/sbin/syncd60
oracle 6880 1 0 10:27:26 -0:00 ora_lgwr_SPLDEV1
root 6966 1 0 Oct 17 -0:00/usr/ccs/bin/shlap
root 7942 43364 0 Oct 17 -0:00 sendmail:accepting connections
alberts 9036 9864 0 20:41:49 -0:00 sshd:alberts@pts/0
root 9864 44426 0 20:40:21 -0:00 sshd:alberts [priv]
root 27272 36280 1 20:48:03 pts/0 0:00 ps-ef
oracle 27856 1 0 10:27:26 -0:01ora_smon_SPLDEV1
oracle 31738 1 0 10:27:26 -0:00ora_dbw0_SPLDEV1
oracle 31756 1 0 10:27:26 -0:00ora_reco_SPLDEV1
alberts 32542 9036 0 20:41:49 pts/0 0:00-ksh
maestro 3348034394 0 05:59:45 -0:00 /prj/maestro/maestro/bin/batchman
-parm 32000
root 34232 334800 05:59:45 -0:00 /prj/maestro/maestro/bin/jobman
maestro 3439445436 0 05:59:45 -0:00 /prj/maestro/maestro/bin/mailman -parm
32000 -- 2002 OL16U209 CONMAN UNIX 6.
root 34708 1 0 13:55:51 lft0 0:00/usr/sbin/getty /dev/console
oracle 35364 1 0 10:27:26 -0:01ora_cjq0_SPLDEV1
oracle 35660 1 0 10:27:26 -0:04ora_pmon_SPLDEV1
root 36280 32542 0 20:45:06 pts/0 0:00 -ksh
root 36382 43364 0 Oct 17 -0:00/usr/sbin/rsct/bin/IBM.ServiceRMd
root 36642 43364 0 Oct 17 -0:00/usr/sbin/rsct/bin/IBM.CSMAgentRMd
root 36912 43364 0 Oct 17 -0:03/usr/opt/ifor/bin/i4lmd -l
/var/ifor/logdb -n clwts
root 37186 43364 0 Oct 17 -0:00/etc/ncs/llbd
root 37434 43364 0 Oct 17 -0:17/usr/opt/ifor/bin/i4llmd -b -n wcclwts
-l /var/ifor/llmlg
root 37738 37434 0 Oct 17 -0:00/usr/opt/ifor/bin/i4llmd -b -n wcclwts
-l /var/ifor/llmlg
root 37946 1 0 Oct 17 -0:00/opt/hitachi/HNTRLib2/bin/hntr2mon -d
oracle 38194 1 0 Oct 17 -0:00
/prj/oracle/product/9.2.0.3/bin/tnslsnrLISTENER -inherit
root 38468 43364 0 Oct 17 -0:00/usr/sbin/rsct/bin/IBM.AuditRMd
root 38716 1 0 Oct 17 -0:00/usr/bin/itesmdem itesrv.ini
/etc/IMNSearch/search/
imnadm 39220 1 0 Oct 17 -0:00/usr/IMNSearch/httpdlite/httpdlite -r
/etc/IMNSearch/httpdlite/httpdlite.con
root 39504 36912 0 Oct 17 -0:00/usr/opt/ifor/bin/i4lmd -l
/var/ifor/logdb -n clwts
root 39738 43364 0 Oct 17 -0:01/usr/DynamicLinkManager/bin/dlmmgr
root 40512 43364 0 Oct 17 -0:01/usr/sbin/rsct/bin/rmcd -r
root 40784 43364 0 Oct 17 -0:00/usr/sbin/rsct/bin/IBM.ERrmd
root 41062 1 0 Oct 17 -0:00 /usr/sbin/cron
was 41306 1 0 Oct 17 -2:10/prj/was/java/bin/java -Xmx256m
-Dwas.status.socket=32776 -Xms50m-Xbootclas
oracle 42400 1 0 10:27:26 -0:02ora_ckpt_SPLDEV1
root 42838 1 0 Oct 17 -0:00/usr/sbin/uprintfd
root 43226 43364 0 Oct 17 -0:00/usr/sbin/nfsd 3891
root 43364 1 0 Oct 17 -0:00/usr/sbin/srcmstr
root 43920 43364 0 Oct 17 -0:00/usr/sbin/aixmibd
root 44426 43364 0 Oct 17 -0:00/usr/sbin/sshd -D
root 44668 43364 0 Oct 17 -0:00/usr/sbin/portmap
root 44942 43364 0 Oct 17 -0:00/usr/sbin/snmpd
root 45176 43364 0 Oct 17 -0:00/usr/sbin/snmpmibd
maestro 45436 1 0 Oct 17 -0:00/prj/maestro/maestro/bin/netman
root 45722 43364 0 Oct 17 -0:00/usr/sbin/inetd
root 45940 43364 0 Oct 17 -0:00/usr/sbin/muxatmd
root 46472 43364 0 Oct 17 -0:00/usr/sbin/hostmibd
root 46780 43364 0 Oct 17 -0:00/etc/ncs/glbd
root 46980 43364 0 Oct 17 -0:00/usr/sbin/qdaemon
root 47294 1 0 Oct 17 -0:00/usr/local/sbin/syslog-ng -f
/usr/local/etc/syslog-ng.conf
root 47484 43364 0 Oct 17 -0:00/usr/sbin/rpc.lockd
daemon 48014 43364 0 Oct 17 -0:00/usr/sbin/rpc.statd
root 48256 43364 0 Oct 17 -0:00/usr/sbin/rpc.mountd
root 48774 43364 0 Oct 17 -0:00/usr/sbin/biod 6
root 49058 43364 0 Oct 17 -0:00/usr/sbin/writesrv
[LP 1]root@ol16u209:
Another example of ps -ef on a AIX5 system:
# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Jan 23 -0:33 /etc/init
root 69706 1 0 Jan 23 -0:00/usr/lib/errdemon
root 81940 1 0 Jan 23 -0:00/usr/sbin/srcmstr
root 86120 1 2 Jan 23 - 236:39/usr/sbin/syncd 60
root 98414 1 0 Jan 23 -0:00/usr/ccs/bin/shlap64
root 114802 81940 0 Jan 23 -0:32/usr/sbin/rsct/bin/IBM.CSMAgentRMd
root 135366 81940 0 Jan 23 -0:00/usr/sbin/sshd -D
root 139446 81940 0 Jan 23 -0:07/usr/sbin/rsct/bin/rmcd -r
root 143438 1 0 Jan 23 -0:00/usr/sbin/uprintfd
root 147694 1 0 Jan 23 -0:26 /usr/sbin/cron
root 155736 1 0 Jan 23 -0:00/usr/local/sbin/syslog-ng -f
/usr/local/etc/syslog-ng.conf
root 163996 81940 0 Jan 23 -0:00/usr/sbin/rsct/bin/IBM.ERrmd
root 180226 81940 0 Jan 23 -0:00/usr/sbin/rsct/bin/IBM.ServiceRMd
root 184406 81940 0 Jan 23 -0:00/usr/sbin/qdaemon
root 200806 1 0 Jan 23 -0:08/opt/hitachi/HNTRLib2/bin/hntr2mon -d
root 204906 81940 0 Jan 23 -0:00/usr/sbin/rsct/bin/IBM.AuditRMd
root 217200 1 0 Jan 23 -0:00 ./mflm_manager
root 221298 81940 0 Jan 23 -1:41/usr/DynamicLinkManager/bin/dlmmgr
root 614618 1 0 Apr 03 lft0 0:00 -ksh
reserve 1364024 1548410 0 07:10:10 pts/00:00 -ksh
root 1405140 1626318 1 08:01:38 pts/0 0:00ps -ef
root 1511556614618 2 07:45:52 lft0 0:41 tar -cf /dev/rmt1.1 /spl
reserve 1548410 1613896 0 07:10:10 -0:00sshd: reserve@pts/0
root 1613896 135366 0 07:10:01 -0:00 sshd:reserve [priv]
root 1626318 1364024 1 07:19:13 pts/0 0:00-ksh
Some more examples:
# nohup somecommand & sleep 1; tail -fpreferred-name
# nohup make bzImage &
# tail -f nohup.out
# nohup make modules 1> modules.out2> modules.err &
# tail -f modules.out
==========================================
9. Backup commands, TAR, and Zipped files:
==========================================
For SOLARIS as well as AIX, and many otherunix'es, the following commands can be used:
tar, cpio, dd, gzip/gunzip,compress/uncompress, backup and restore.
Very important:
If you will backup to tape, make sure youknow what is your "rewinding" class and
"nonrewinding" class
of your tapedevice.
9.1 tar: Short for "TapeArchiver":
===================================
Some examples should explain the usage of"tar" to create backups, or to create
easy to transport .tar files.
Create a backup to tape device 0hc of filesys01.dbf
# tar -cvf/dev/rmt/0hc /u01/oradata/sys01.dbf
# tar -rvf/dev/rmt/0hc /u02/oradata/data_01.dbf
-c create
-r append
-x extract
-v verbose
-t list
Extract the contents of example.tar anddisplay the files as they are extracted.
# tar -xvf example.tar
Create a tar file named backup.tar from thecontents of the directory /home/ftp/pub
# tar -cf backup.tar /home/ftp/pub
list contents of example.tar to the screen
# tar -tvf example.tar
to restore the file /home/bcalkins/.profilefrom the archive:
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。