Dovetailed Technologies

Appendix A. Managing the /tmp filesystem

The /tmp filesystem is important to the operation of many applications that use z/OS UNIX services. Some common uses include:

  • z/OS UNIX shell scripts often create temporary, transient work files. One example is setting a variable with the output of a command. Although tiny and short lived, a temporary file is required. If temp space is unavailable, then the script can fail in unexpected ways. If you will be running batch jobs that use Co:Z SFTP, IBM ssh or IBM sftp clients, you will likely be using the shell and need temp files.

  • If you will be using Co:Z SFTP server, each session causes SSHD to invoke a shell script which configures the session.

  • Co:Z SFTP server by default creates a log file for each session in /tmp. These are important to keep for some period of time:

    • The current session log file can be accessed by the remote sftp client (e.g: get /+error.log) to get details of a problem.

    • If there is a failure, support personnel can review the session log file for diagnostic information.

    • Trace messages, if enabled, will go to the session log.

    In many cases, installations will choose to put Co:Z SFTP server session logs in a separate zFS or HFS filesystem.

A.1 Best practices

Installations should review the references below, but here are some general suggestions:

  1. Schedule a nightly job that runs the z/OS UNIX skulker command to clean up old files. For example, the following job (run as a superuser) uses the IBM skulker script to remove files from tmp that have not been accessed for 5 days:

    //STDIN   DD   *
     cd /tmp || exit 8
     /samples/skulker -R -l /dev/fd2 . 5

  2. Monitor your temp filesystem(s) for full threshold conditions using the FSFULL mount parameter. Use the threshold messages to alert your operations personnel.

    Note: FSFULL monitoring of TFS filesystems is not supported prior to z/OS 2.1

  3. Document procedures, commands, and tools to be used by personnel in the event of a full condition. Some useful commands include:

    # display filesystem status
    $ df -kP /tmp
    # display 10 largest files in /tmp
    $ du -aktx /tmp | sort -nr | head -10
    # display pids(users) that are using a file
    #   - should do this before removing a file to verify no users
    $ fuser -u file
    # display process/job info for a pid
    $ ps -o pid,ppid,user,jobname,xasid,stime,time,comm -g <pid>
    # truncate an in-use log file 
    #   - removing would leave an unnamed file until all using processes complete
    $ cat /dev/null > file
    # kill processes using a file
    $ fuser -ku file
    # (z/OS 2.1) list hidden in use files in a filesystem
    $ zlsof -d /tmp
    # (pre-z/OS 2.1) list users of deleted files
    #   from IBM Tools & Toys:
    $ delinuse /tmp      


Copyright© 2009-2017 Dovetailed Technologies, LLC. All rights reserved.
Co:Z® is a registered trademark of Dovetailed Technologies, LLC.