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.

    [Note]Note
    Co:Z release 5.5.0 introduced a log file cleanup feature that can help significantly with the management of session log files. Please refer to Co:Z SFTP User's Guide - Server Logging for more details.

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:

    //SKULKER EXEC PGM=COZBATCH
    //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.

  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:
    #   http://www-03.ibm.com/systems/z/os/zos/features/unix/bpxa1ty2.html
    $ delinuse /tmp      

References:


Saint Charles, Missouri
info@coztoolkit.com
+1 636.300.0901

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

Saint Charles, Missouri
info@coztoolkit.com
+1 636.300.0901

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