This article hasn't been updated for over 5 years. The information below may be obsolete.

How to enable SAM-FS and QFS daemon tracing

SAM-QFS enables logging after it is installed, but if you want tracing, you have to enable it manually.

Trace files can be used in debugging. By default, trace files are not enabled. You can enable trace files by editing the defaults.conf file. You can enable tracing for all processes, or you can enable tracing for individual processes.

This document details how to enable daemon trace files for the all or some of the following SAM-FS and QFS daemons:

  • sam-archiverd
  • sam-catserverd
  • sam-fsd
  • sam-ftpd
  • sam-recycler
  • sam-sharefsd
  • sam-stagerd

Enable daemon tracing

To enable daemon tracing, simple edit the /etc/opt/SUNWsamfs/defaults.conf configuration file, towards the bottom you'll see the trace section. For example:

exported_media = unavailable 
attended = yes
tape = lt
log = LOG_LOCAL7
timeout = 300
# trace
# all on
# endtrace
labels = barcodes_low
lt_delay = 10
lt_unload = 7
lt_blksize = 256

As you can see daemon tracing is disabled by default. To enable, simple remove the hash (#) at the begining of the lines from trace through to endtrace inclusively will enable daemon tracing for all daemons.

trace
all on
endtrace

If you only want to enable daemon tracing for a specific daemon, you would have an entry similar to this:

<daemon-name> = on

For examle, if you want to enable daemon tracing for the archiver and stager daemons only, we will have an entry as follows:

trace
sam-archiverd on
sam-stagerd on
endtrace

You can also set the size of the daemon trace file by using the following entry:

<daemon-name>.size = <size>

For example. to rotate the trace file for the archiver daemon after 10 megabytes, we would have an entry similar to this:

trace
sam-archiverd on
sam-archiverd.size = 10M
endtrace

The file /opt/SUNWsamfs/examples/defaults.conf contains an example of a defaults.conf file.

Commiting your changes

Once you've made changes to the configuration file, we need to inform sam-fsd daemon to reread the configuration file. This is achived by simply sending a SIGHUP signal to the sam-fsd damon. For example:

root@samfs# pkill -HUP sam-fsd

This command restarts the sam-fsd daemon and enables the daemon to recognise the changes in the defaults.conf file.

Trace file location

By default, trace files are written to the /var/opt/SUNWsamfs/trace directory. In that directory, the trace files are named for the processes (archiver, catserver, fsd, ftpd, recycler, sharefsd, and stager).

If you want to change the filename and location of the trace file, we can add an entry in the trace section of the configuration file:

<daemon-name> = <path-to-trace-file>

For example, to change the location and filename for the archiver daemon, we can have an entry like:

trace
sam-archiverd on
sam-archiverd.size = 10M
sam-archiverd.file = /tmp/sam-archiverd.trace
endtrace

Trace file rotation

To prevent trace files from growing indefinitely, the sam-fsd daemon monitors the size of the trace files and periodically executes the following command:

/opt/SUNWsamfs/sbin/trace_rotate

This script moves the trace files to sequentially numbered copies. You can modify this script to suit your operation. Alternatively, you can provide this function using cron or some other facility.

Disabling daemon tracing

Once youve finished troubleshooting or debugging your problem you'll probably want to turn off daemon tracing. This is achived by simply commenting out the entire trace/endtrace section in the configuration file. For example:

#trace
#sam-archiverd on
#sam-archiverd.size = 10M
#endtrace

Now simply inform sam-fsd to restart and read it's configuration file:

root@samfs# pkill -HUP sam-fsd