{"id":916,"date":"2026-08-18T23:40:27","date_gmt":"2026-08-18T23:40:27","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=916"},"modified":"2026-08-23T22:05:02","modified_gmt":"2026-08-23T22:05:02","slug":"small-vps-disk-full-find-and-reclaim-space","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/","title":{"rendered":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A 20-40 GB VPS disk fills up faster than you expect. One day <code>df -h<\/code> shows 100%, <code>apt<\/code> refuses to run, MySQL stops writing, and your site starts returning random 500s. The fix is rarely &#8220;upgrade to a bigger plan&#8221; \u2014 it is methodically finding what you forgot about. This guide covers the full forensic routine: from the initial panic to long-term prevention, with tools and techniques for every Linux distribution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 1: Diagnose the Problem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When disk space vanishes, start with three commands that rule out the most common false leads:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Check actual disk usage vs. inode exhaustion\ndf -h \/\ndf -i \/\n\n# Check for deleted files still held open by processes\nsudo lsof +L1 | head -20\n\n# Find the biggest directories (one filesystem only)\nsudo du -xhd1 \/ | sort -hr | head -20<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">1. Inode Exhaustion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>df -i<\/code> shows 100% but <code>df -h<\/code> shows free space, you have run out of inodes. The filesystem cannot create new files even though space exists. This is common on VPS images with small default inode tables. The culprit is usually a directory full of tiny files: mail spools (<code>\/var\/mail<\/code>), PHP session files (<code>\/var\/lib\/php\/sessions<\/code>), or Docker overlay filesystems. Deleting files is the only fix \u2014 ext4 cannot add inodes after creation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Deleted Files Held Open<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A process (commonly a logging daemon, database, or web server) may keep a file open after it has been deleted. The kernel does not release the disk blocks until the file descriptor is closed. <code>lsof +L1<\/code> lists these hidden consumers. Restart the owning process to release the space \u2014 do not just kill the PID without understanding what it is.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Rapid Space Survey with ncdu<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For interactive exploration, <code>ncdu<\/code> is the best tool. It walks the filesystem, shows directory sizes in a sortable interface, and lets you delete with a single keypress. Install it, run it on the root filesystem, and drill into the largest directories:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install ncdu   # Debian\/Ubuntu\nsudo dnf install ncdu   # Fedora\/RHEL\nsudo ncdu -x \/<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 2: Attack the Usual Suspects<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">systemd Journal (the #1 Hidden Consumer)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">On modern Linux distributions, <code>journald<\/code> stores logs in a binary format that is not managed by logrotate. It can easily consume several gigabytes. Check and cap it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># See current usage\njournalctl --disk-usage\n\n# Shrink immediately\nsudo journalctl --vacuum-size=200M\n\n# Cap future growth\n# Edit \/etc\/systemd\/journald.conf:\n# SystemMaxUse=200M\n# MaxFileSec=1week\nsudo systemctl restart systemd-journald<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Package Cache and Old Kernels<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">APT and DNF keep downloaded package files in a cache. Old kernels accumulate in <code>\/boot<\/code> and are never removed automatically on most distributions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Debian\/Ubuntu\nsudo apt clean\nsudo apt autoremove --purge\n\n# Check installed kernels\ndpkg --list | grep linux-image\n\n# Fedora\/RHEL\nsudo dnf clean all\nsudo dnf autoremove<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Docker and Container Overhead<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Docker images, build cache, and container logs grow without bound unless you enforce limits. Run a prune and configure log rotation:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Check usage\ndocker system df\n\n# Prune everything (caution: removes unused images, containers, volumes)\nsudo docker system prune -af --volumes\n\n# Cap container logs in \/etc\/docker\/daemon.json:\n# {\n#   \"log-driver\": \"json-file\",\n#   \"log-opts\": {\n#     \"max-size\": \"10m\",\n#     \"max-file\": \"3\"\n#   }\n# }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Database Binary Logs and WAL Files<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL\/MariaDB binary logs and PostgreSQL WAL segments accumulate without bound when retention is misconfigured:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># MySQL: show and purge old binary logs\nmysql -e \"SHOW BINARY LOGS;\"\nmysql -e \"PURGE BINARY LOGS BEFORE NOW() - INTERVAL 2 DAY;\"\n\n# PostgreSQL: check WAL directory size\nsudo du -sh \/var\/lib\/postgresql\/*\/pg_wal\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Snap Packages (Ubuntu Only)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Snap keeps old revisions of every installed package. A handful of snaps can quietly eat several gigabytes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># List all revisions\nsnap list --all\n\n# Limit retained revisions\nsudo snap set system refresh.retain=2\n\n# Remove old revisions\nsudo snap remove --revision OLD_REVISION package-name<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Application-Specific Caches<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Common cache directories that grow unbounded: Composer (<code>~\/.cache\/composer<\/code>), npm (<code>~\/.npm\/_cacache<\/code>), pip (<code>~\/.cache\/pip<\/code>), and PHP sessions (<code>\/var\/lib\/php\/sessions<\/code>). Set up a cron job to clear caches older than 30 days, or configure <code>tmpwatch<\/code> \/ <code>tmpreaper<\/code> for automatic cleanup.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Phase 3: Configure Long-Term Prevention<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Three guardrails prevent 90% of recurrence:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Cap journald<\/strong> at 200 MB as shown above.<\/li>\n<li><strong>Set up disk usage alerts<\/strong> \u2014 a simple cron check that emails or pushes a notification when disk exceeds 85%:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# \/usr\/local\/bin\/disk-alert.sh\nTHRESH=85\nUSE=$(df -h \/ | awk 'NR==2 {print $5}' | tr -d '%')\nif [ \"$USE\" -ge \"$THRESH\" ]; then\n  echo \"Disk ${USE}% full on $(hostname)\" | mail -s \"Disk Alert\" you@example.com\nfi\n# Add to crontab: 0 * * * * \/usr\/local\/bin\/disk-alert.sh<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Automate log rotation<\/strong> \u2014 verify that logrotate runs daily, and add custom configs for any service that writes logs outside the standard paths.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">The Last Resort: What to Do When You Cannot Free Enough Space<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you have pruned everything and still sit at 80%+ usage, you have three options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Move data to block storage.<\/strong> Attach a separate volume for databases, logs, or user uploads. Most VPS providers let you add storage volumes without changing plans.<\/li>\n<li><strong>Offload static assets.<\/strong> Use an object storage service (S3, B2, or similar) for images, backups, and archives. Mount it with rclone.<\/li>\n<li><strong>Upgrade the plan.<\/strong> If your workload genuinely needs more space, compare storage specs before you pay. SSD vs. NVMe, IOPS guarantees, and provisioning matter \u2014 the <a href=\"https:\/\/virtualserversvps.com\/#providers\">VPS provider comparison table<\/a> breaks down storage types and sizes across providers.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, run <code>sudo fstrim -av<\/code> weekly (or enable the <code>fstrim.timer<\/code> systemd service) so the SSD keeps reclaiming freed blocks. This does not create space, but it prevents a nearly-full disk from getting slower over time as the SSD controller struggles to find reusable blocks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A 20-40 GB VPS disk fills up faster than you expect. One day df -h shows 100%, apt refuses to run, MySQL stops writing, and your site starts returning random&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-916","post","type-post","status-publish","format-standard","hentry","category-vps-guides-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS\" \/>\n<meta property=\"og:description\" content=\"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-18T23:40:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-23T22:05:02+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/\",\"name\":\"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-08-18T23:40:27+00:00\",\"dateModified\":\"2026-08-23T22:05:02+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/","og_locale":"en_US","og_type":"article","og_title":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS","og_description":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS","og_url":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-08-18T23:40:27+00:00","article_modified_time":"2026-08-23T22:05:02+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/","url":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/","name":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-08-18T23:40:27+00:00","dateModified":"2026-08-23T22:05:02+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/small-vps-disk-full-find-and-reclaim-space\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"VPS Disk Space Forensics: The Complete Guide to Finding and Reclaiming Storage on a Small VPS"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/916","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=916"}],"version-history":[{"count":2,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/916\/revisions"}],"predecessor-version":[{"id":953,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/916\/revisions\/953"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}