Disk Full: Diagnostics & Troubleshooting

What to do when your drive runs out of space

Low disk space occurs when the available storage on a disk partition or volume is running out. This situation can cause various issues, including system slowdown, inability to install new software, and potential data loss. To diagnose and solve low disk space problems in Linux, you can use several tools and techniques.

Checking Disk Space

The df command displays the amount of disk space used and available on all mounted file systems. Running df -h provides a more readable output with sizes in human-readable format.

The du command allows you to estimate the disk usage of files and directories. You can use it with options like -h for a human-readable output or -s for a summary of disk usage for a particular directory.

Identifying Large Files and Directories

The ncdu command (if installed) provides an interactive disk usage analyzer. It allows you to explore disk usage and quickly identify large files and directories.

The find command can be used to locate large files. For example, find / -type f -size +100M will search for files larger than 100 megabytes.

Also keep in mind, that some filesystems like btrfs store snapshots of older file versions. These snapshots can take up a large amount of space, but may not be visible to tools like du.

Cleaning Disk Space

Remove unnecessary or old log files located in /var/log/ directory. You can delete them manually or use tools like logrotate to manage log files.

Clear package cache files used by package managers like apt or yum. For instance, apt clean (for Debian-based systems) or yum clean all (for Red Hat-based systems) will remove cached package files.

Identify and remove unused software, temporary files, or large downloads that are no longer needed. Move or delete large files that are occupying excessive disk space.

Expanding Disk Space

If you're using a virtual machine or a cloud service, you can allocate additional disk space to the partition that is running low. The process for expanding disk space varies depending on the specific environment.

Alternatively, if you have multiple partitions, you can move data from a full partition to a less utilized one using tools like rsync.

It's important to exercise caution when deleting or moving files, ensuring you don't remove any critical system files or important user data. Always review the files and directories before taking any action to avoid accidental data loss.

How CleverUptime can help

CleverUptime will alert you, before you run out of space. It monitors disk utilization and detects trends how quickly the disks are getting full.

Except where otherwise noted, content on this site is licensed under a CC BY-SA 4.0 license CC BY SA