Disk space full on /tmp Mount in Linux

Disk space full on /tmp Mount in Linux

Title: Disk Full on /tmp Location in Linux 

Category: Troubleshooting 

Applies To: Linux 9.4(Linux version) 

Last Updated: 23/06/2025 

Issue Summary: 

The /tmp directory has consumed all available disk space, causing application failures, service crashes, or system instability. This can impact Hadoop daemons (e.g., NameNode, DataNode), YARN jobs, or general system operations. 

Typical errors: 

No space left on device 

Hadoop job/application fails with temp file creation error 

Services fail to start or crash due to lack of temp space 

Possible Causes: 

  1. Large temporary files not cleaned Applications or scripts create large files under /tmp and don’t remove them. 

  1. Zombie or orphaned Hadoop job files Hadoop or Spark may leave temporary directories in /tmp after job failure. 

  1. Users writing heavy data to /tmp Users running scripts or data pipelines that write gigabytes to /tmp. 

Step-by-Step Resolution: 

Step 1: Check Disk Usage 

df -h /tmp 

Example output: 

Filesystem Size Used Avail Use% Mounted on /dev/sda1 40G 39G 0.5G 99% / 

Step 2: Identify Large Files 

du -sh /tmp/* 

or to find top space hogs 

find /tmp -type f -exec du -sh {} + | sort -rh | head -20 

Also check hidden files: 

du -sh /tmp/.* 

Step 3: Safely Remove Unused Files 

Remove old or unnecessary files (only if sure): 

rm -r /tmp/hsperfdata_*  

rm -r /tmp/tmp.*  

rm -r /tmp/hadoop-*  

rm -r /tmp/spark-* 

You can also clean files older than X days: 

find /tmp -type f -mtime +2 -exec rm -f {} ; 

Step 4: Stop Services (If Needed) Before Cleanup 

To safely delete active app temp files: 

stop-dfs.sh  

stop-yarn.sh 

rm -r /tmp/hadoop-*  

start-dfs.sh  

start-yarn.sh 

Step 5: Monitor Live Usage (Optional) 

While cleaning: 

watch -n 1 df -h /tmp 

Additional Notes: 

For mission-critical clusters, use a separate volume or partition for /tmp. 

Use lsof | grep /tmp to check which processes are locking large temp files. 

Always verify files are not in use before deleting. 

    • Related Articles

    • Managing HDFS Space and Replication

      Managing HDFS Space and Replication Category: Troubleshooting → HDFS Applies To: Apache Hadoop HDFS 2.x, 3.x Issue summary: Effective management of HDFS disk space and data replication is crucial for the stability, performance, and data availability ...
    • Kafka Retention, Cleanup, and Performance Tuning

      Kafka Retention, Cleanup, and Performance Tuning Category: Administration → Kafka Applies to: Apache Kafka 2.x 3.x Issue Summary This document outlines critical configurations and best practices for managing data retention, ensuring efficient ...
    • Troubleshooting Yarn Application Failures

      Troubleshooting Yarn Application Failures Category: Troubleshooting → YARN Applies To: Apache YARN 2.x, 3.x Issues Summary: YARN applications (such as Spark, MapReduce, Tez jobs) fail to complete successfully, often exiting with a FAILED status, or ...
    • Backups and Disaster Recovery Strategy – MySQL

      Backups and Disaster Recovery Strategy – MySQL Category: Administration → MySQL Applies To: MySQL 8.x Issues Summary: A robust backup and disaster recovery (DR) strategy is paramount for any MySQL database production. It ensures data protection ...
    • Remote Server Unreachable via SSH/HTTP/All Services

      Title: Remote Server Down – Step-by-Step Troubleshooting Guide Category: Troubleshooting Last Updated: 23/06/2025 Issue Summary Users are unable to connect to a remote server via SSH, HTTP, or any other service. The server appears to be unresponsive ...