{"id":1270,"date":"2026-10-02T02:31:19","date_gmt":"2026-10-02T02:31:19","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=1270"},"modified":"2026-10-09T22:02:32","modified_gmt":"2026-10-09T22:02:32","slug":"filesystem-level-compression-small-vps-btrfs-zstd-ext4","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/","title":{"rendered":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the write-amplification that comes with copy-on-write. This article compares btrfs with zstd against plain ext4 across throughput, space savings, and CPU overhead, using a reproducible benchmark so you can rerun it on your own box rather than trusting a blog post.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why ext4 Cannot Compress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">ext4 is a mature, journaling, in-place filesystem. It has no compression layer, so every byte written lands on disk 1:1. Its strengths are predictable latency, low CPU overhead, and tooling that never surprises you. comprerssion on ext4 is only possible through a stacked device (dm-verity variants, or a FUSE layer), both of which add latency and complexity that a small VPS cannot afford.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">btrfs builds compression into the filesystem. Data and metadata are compressed before they hit the extent tree, and checksums protect every block. Set it once at mount time or per-file with <code>chattr<\/code>, and it applies transparently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting Up a Comparable Test<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Mount btrfs with zstd and compression level 3, then create the ext4 volume of the same nominal size. Use the same backing device class on both so the numbers are comparable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># btrfs with zstd\nmkfs.btrfs -f \/dev\/vdb\nmount -o compress=zstd:3,noatime,ssd \/dev\/vdb \/mnt\/btrfs\n\n# enable inherited compression for future files\nchattr +c \/mnt\/btrfs\/data\n\n# ext4 baseline\nmkfs.ext4 -F \/dev\/vdc\nmount -o noatime \/dev\/vdc \/mnt\/ext4<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Benchmark Results<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Test box: 2 vCPU, 4 GB RAM, NVMe under QEMU. Two workloads: a source tree of 120,000 small text files (4.1 GB inflated), and a database-style single file written with <code>fio<\/code> at 4k random. Numbers are medians of three runs.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Workload<\/th><th>ext4<\/th><th>btrfs+zstd:3<\/th><th>Delta<\/th><\/tr><\/thead><tbody><tr><td>Text tree space used<\/td><td>4.10 GB<\/td><td>1.62 GB<\/td><td>-60%<\/td><\/tr><tr><td>Sequential write (1M)<\/td><td>410 MB\/s<\/td><td>352 MB\/s<\/td><td>-14%<\/td><\/tr><tr><td>Sequential read (1M)<\/td><td>498 MB\/s<\/td><td>566 MB\/s<\/td><td>+14%<\/td><\/tr><tr><td>4k random write IOPS<\/td><td>21,800<\/td><td>13,900<\/td><td>-36%<\/td><\/tr><tr><td>CPU during write<\/td><td>~8%<\/td><td>~54%<\/td><td>+46 pts<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The headline: <strong>60% disk saved on text, but 36% fewer random-write IOPS and a sixfold jump in CPU load during sustained writes.<\/strong> That CPU cost is the real constraint on a 2 vCPU box, and it also shows up as disk-write amplification if you have enabled snapshots.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When Each Choice Wins<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pick btrfs + zstd<\/strong> when your disk is dominated by compressible data: source code, logs, JSON, HTML, documentation, container layers. You trade CPU and random-write IOPS for capacity and often faster sequential reads, because reading compressed data pulls fewer bytes from the device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pick ext4<\/strong> when your workload is write-heavy and random, or when CPU is the scarce resource. Databases with 4k random writes and any service that fsyncs frequently will feel the btrfs penalty directly. On a 1 vCPU instance, do not enable zstd on the database volume.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A hybrid is common and effective: ext4 or raw btrfs for the database, and a separate zstd-compressed subvolume for logs and web roots. Use <code>chattr +c<\/code> to keep the choice per-directory without repartitioning.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Measuring Your Own Numbers<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># space\ncompsize \/mnt\/btrfs\/data\n\n# io profile\nfio --name=rw4k --rw=randwrite --bs=4k --numjobs=4 --size=1G \\\n    --directory=\/mnt\/btrfs\/fio --runtime=30 --time_based --group_reporting\n\n# per-file compression ratio\nbtrfs filesystem du -s --human-readable \/mnt\/btrfs\/data\/*<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run the same <code>fio<\/code> job against both mounts before you commit. If you are provisioning a new instance and want to size the volume against the workload rather than the other way around, the disk and CPU tradeoffs are laid out in the <a href=\"https:\/\/virtualserversvps.com\/cloud-vps-benefits\">cloud VPS benefits comparison<\/a>. And if you later find writes amplifying beyond what the data justifies, the method in <a href=\"https:\/\/virtualserversvps.com\/managed-vs-unmanaged\">the managed versus unmanaged operations overview<\/a> will help you trace it back to snapshots or scrubm, not just the filesystem.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the write-amplification that&#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":1,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1270","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>btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks - Virtual Servers VPS Blog<\/title>\n<meta name=\"description\" content=\"Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the\" \/>\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\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks\" \/>\n<meta property=\"og:description\" content=\"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-02T02:31:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-09T22:02:32+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/\",\"name\":\"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-10-02T02:31:19+00:00\",\"dateModified\":\"2026-10-09T22:02:32+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"description\":\"Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the\",\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks\"}]},{\"@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":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks - Virtual Servers VPS Blog","description":"Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the","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\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/","og_locale":"en_US","og_type":"article","og_title":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks","og_description":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks","og_url":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-10-02T02:31:19+00:00","article_modified_time":"2026-10-09T22:02:32+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/","url":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/","name":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-10-02T02:31:19+00:00","dateModified":"2026-10-09T22:02:32+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"description":"Filesystem-level compression sounds like free disk space, and on a small VPS with a 25-40 GB root volume it often is. The catch is CPU cost and the","breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/filesystem-level-compression-small-vps-btrfs-zstd-ext4\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"btrfs zstd vs ext4 on a Small VPS: Real Compression Benchmarks"}]},{"@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\/1270","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=1270"}],"version-history":[{"count":3,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1270\/revisions"}],"predecessor-version":[{"id":1346,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1270\/revisions\/1346"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=1270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=1270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=1270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}