Internal documentation only
This page has been marked as draft.
ITRS Products - Hard Disk is full or out of space (Unix/Linux)
Maintenance tasks or configuration related to the Operating System or any other third party applications are outside of scope ITRS Technical Support Services. We provide this as a guidance to those clients that are not so familiar with some commands of the Linux Operating System.
Related to Copied
Hard Disk is full, Partition is full, hard drive full, run out of space.
Problem Copied
- A hard disk or a partition is out of space available to store new data.
Possible Cause(s) Copied
- **Root Cause 1:**An application or system task has filled the disk with data.
Possible Solution(s) Copied
- Solution Root Cause 1:
The first thing it would be to find out what directory is using the more amount of data or look for large files that might be causing the issue.
The command
df -h
It can provide you a view of the percent utilization of your different partitions within the system. Also provide information on the size of the partition and the amount used.
The Command
du -h <dir> 2>/dev/null | grep '[0-9\.]\+G'
It can provide you a view of the directory indicated and subfolders sorting out directories that is 1+ GBs and up.
The Command
du -a | sort -n -r | head -n 5
It can provide you the top 5 biggest directories in the current working directory
The Command
find <dir> -type f -exec du -Sh {} + | sort -rh | head -n 5
It can provide you the biggest file sizes only in that directory
Most of the time the hard disk get filled by rotating logs or backups which go filling a directory until complete the disk space, therefore not necessarily the root cause might be the biggest files on the disk.
To delete the files(s) in Linux, you will need to use the command
rm /path/to/directory/*
to delete the contents of a specific directory
rm filename.xyz
to delete a file
rm *.xyz
to delete all files with specific extension
The command will ask you for confirmation if you want to delete the file (you can use the option -f to avoid the confirmation).
NOTE: You need to make sure you are not deleting files relevant for the operation of any of your applications or system (eg: a database file might be big but it is required for the operation of your application).
Normally, old log files or old backups are safe to delete but with the consideration of your security policy for retention (eg - have backups for the last 7 days etc)
Please, Always check with your system administrator or software vendor if it is safe to delete those files.
Related Articles Copied
- There are a great number of articles and references on the internet for system maintenance tasks and system administration.