Deleting unnecessary directory files

You can delete unnecessary files in the spooling directory.

Some of these commands require root user or system group authority.
  1. Determine if there are unnecessary files stored in the spooling directory by entering the following du command:
    du -rs /var/spool
    The du command summarizes disk usage. The -s flag instructs the du command to display only the total disk usage of the /var/spool directory and the files it contains. The -r flag tells the du command to display an error message if it cannot read a file or directory.
  2. Delete or move files in a full directory by doing one of the following:
    • Delete any extraneous files. For example:
      rm extrafile
    • Move files that are a few hours old to a safe temporary directory. For example:
      mv extrafile /u/spoolhold
      Note: You must have root user authority to remove or move files other than your own.
  3. Prevent users from storing files in your spooling directories by doing the following:
    • Set permissions on the spooling directory using the chmod command. Change the directory to exclude general users. For example:
      chmod go-rw /var/spool/lp0
    • Create a cron job to clean out the directory (you must have root user authority). Edit the crontab file. For example, you might add the following line to your crontab file:
      find /spool -mtime +7 -a -exec rm -f
      This line removes any file in the /var/spool directory one week after the last modification.
    • Establish policy for the whole user group.

      Create a script to identify all users whose disk holdings are above a certain threshold and send them e-mail requesting that they clean up their files.

    • Provide an alternate way to store files, such as a tape drive in a public area, so that users can archive infrequently used files.
  4. As a last resort, mount more space to the spool directory by using one of the following methods:
    • Use the mount command, which makes a file system available for use at a specified location. For example:
      mount /var/spool morespool
    • Use the smit mount command, choose the Mount a File System option, and specify the file system name and attributes.