LightYear
/Docs
DocsTroubleshootingResolve Disk Full Errors

Resolve Disk Full Errors

Find and remove large files to free disk space when your server's disk is full.

beginner
6 min read
LightYear Docs Team
Updated April 24, 2026
diskstoragedfdutroubleshooting
Ready to get started?

A full disk causes applications to crash, logs to stop writing, and databases to become corrupted. This guide shows how to quickly find and remove large files.

Check Disk Usage

>_BASH
$df -h
OUTPUT
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        25G   25G     0  100% /
tmpfs           1.9G     0  1.9G   0% /dev/shm

The root filesystem is 100% full.

Find Large Directories

>_BASH
$du -sh /* 2>/dev/null | sort -rh | head -10
OUTPUT
8.5G    /var
6.2G    /home
3.1G    /usr
2.8G    /opt

Drill down into the largest directory:

>_BASH
$du -sh /var/* 2>/dev/null | sort -rh | head -10
OUTPUT
7.8G    /var/log
512M    /var/lib
128M    /var/cache

Find Large Files

>_BASH
$find / -type f -size +100M 2>/dev/null | sort -k5 -rn

Or use a more readable approach:

>_BASH
$find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5 -rh | head -20

Common Disk Space Culprits

Large Log Files

>_BASH
$ls -lh /var/log/*.log | sort -k5 -rh | head -10

Truncate a large log file (do not delete — the process may hold the file handle):

>_BASH
$truncate -s 0 /var/log/nginx/access.log

Old Kernel Images

>_BASH
$apt autoremove --purge

Docker Images and Containers

>_BASH
$docker system df
$docker system prune -a

Package Cache

>_BASH
$apt clean
$du -sh /var/cache/apt/

Journald Logs

>_BASH
$journalctl --disk-usage
$journalctl --vacuum-size=500M

Set Up Log Rotation

Prevent logs from growing unbounded:

>_BASH
$nano /etc/logrotate.d/myapp
INI
/var/log/myapp/*.log {
    daily
    rotate 14
    compress
    delaycompress
    missingok
    notifempty
    sharedscripts
    postrotate
        systemctl reload myapp
    endscript
}

[!TIP] If the disk is completely full and you cannot write any files, use truncate -s 0 /path/to/large/file to free space without needing to create a new file.

Was this article helpful?

Your cookie choices for this website

This site uses cookies and related technologies, as described in our privacy policy, for purposes that may include site operation, analytics, and enhanced user experience. You may choose to consent to our use of these technologies, or manage your own preferences. Cookie policy