Professional Documents
Culture Documents
Oz Melamed
E&M Computing
Nov 2007
Introduction to SMF
2
SMF functions
Makes it easy to backup, restore, and undo
changes to services by taking automatic snapshots
of service configurations.
Makes it easy to debug and ask questions about
services by providing an explanation of why a
service isn't running by using svcs -x.
Boots faster on large systems by starting services
in parallel according to the dependencies of the
services.
Allows you to customize the boot console output to
either be as quiet as possible, which is the default,
or to be verbose by using boot -m verbose.
Preserves compatibility with existing administrative
practices wherever possible.
3
SMF Actions
4
Changes in Behavior When Using SMF
5
Changes in Behavior When Using SMF
6
SMF Concepts
The fundamental unit of administration in the
SMF framework is the service instance.
An instance is a specific configuration of a
service.
A web server is a service.
A specific web server daemon that is
configured to listen on port 80 is an instance.
A milestone is a special type of service
Milestone services represent high-level
attributes of the system.
For example, the services which constitute
run levels S, 2, and 3 are each represented
by milestone services.
7
Service Identifiers
8
Service States
The svcs command displays the state, start time,
and FMRI of service instances. The state of each
service is one of the following:
degraded – The service instance is enabled, but is
running at a limited capacity.
disabled – The service instance is not enabled and is
not running.
legacy_run – The legacy service is not managed by
SMF, but the service can be observed.
maintenance – The service instance has encountered
an error that must be resolved by the administrator.
offline – The service instance is enabled, but the service
is not yet running or available to run.
online – The service instance is enabled and has
successfully started.
uninitialized – This state is the initial state for all services
9
before their configuration has been read.
Run Level & SMF Milestone
10
Monitoring SMF Services
List the Status of a Service :
% svcs -l FMRI
% svcs -l network/login:rlogin
fmri svc:/network/login:rlogin
enabled true
state online
next_state none
restarter svc:/network/inetd:/default
Showing the Status of all Services :
% svcs –a
Display the service dependencies :
% svcs -d FMRI
11
Managing SMF Services
12
Troubleshooting the Service
Management Facility
Request information about the hung service.
svcs –x
13
Boot Without Starting Any Services
14
Example
tricks console login: root
:Password
Last login: Thu Nov 15 16:53:20 on console
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
tricks:/ ROOT > who -r
run-level 3 Nov 15 16:55 3 0 S .
tricks:/ ROOT > svcs |grep mile
online 16:55:33 svc:/milestone/name-services:default
online 16:55:42 svc:/milestone/network:default
online 16:55:52 svc:/milestone/devices:default
online 16:55:55 svc:/milestone/single-user:default
online 16:55:58 svc:/milestone/sysconfig:default
offline 16:55:31 svc:/milestone/multi-user:default
offline 16:55:33 svc:/milestone/multi-user-server:default
15
Troubleshooting
tricks:/ ROOT > svcs | grep maint
maintenance 16:55:58 svc:/system/filesystem/local:default
tricks:/ ROOT > svcs -xv /system/filesystem/local | more
(svc:/system/filesystem/local:default (local file system mounts
State: maintenance since Thu Nov 15 16:55:58 2007
.Reason: Start method exited with $SMF_EXIT_ERR_FATAL
See: http://sun.com/msg/SMF-8000-KS
See: /var/svc/log/system-filesystem-local:default.log
Impact: 31 dependent services are not running
tricks:/ ROOT > tail /var/svc/log/system-filesystem-local:default.lo
[ .Nov 15 16:51:13 Stopping because service disabled ]
[ (Nov 15 16:51:13 Executing stop method (null ]
[ ("Nov 15 16:55:55 Executing start method ("/lib/svc/method/fs-local ]
dev/rdsk/c0t0d0s5: I/O error/
mount: I/O error
mount: Cannot mount /dev/dsk/c0t0d0s5
WARNING: /sbin/mountall -l failed: exit status 1
16
Clear Fault
tricks:/ ROOT > svcadm clear /system/filesystem/local
tricks:/ ROOT > svcs | grep mile
online 16:55:33 svc:/milestone/name-services:default
online 16:55:42 svc:/milestone/network:default
online 16:55:52 svc:/milestone/devices:default
online 16:55:55 svc:/milestone/single-user:default
online 16:55:58 svc:/milestone/sysconfig:default
online 17:03:32 svc:/milestone/multi-user:default
online 17:03:34 svc:/milestone/multi-user-server:default
17
Q&A
18