meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:fs:btrfs:compression [2021/03/02 09:44] – created niziaklinux:fs:btrfs:compression [2025/08/22 17:17] (current) niziak
Line 1: Line 1:
 ====== BTRFS compression ====== ====== BTRFS compression ======
  
-[[https://btrfs.wiki.kernel.org/index.php/Compression]]+[[https://btrfs.readthedocs.io/en/latest/Compression.html|]] 
  
 Compression: Compression:
Line 40: Line 41:
 <code>btrfs filesystem defrag -c file.iso</code> <code>btrfs filesystem defrag -c file.iso</code>
 <code>btrfs filesystem defrag -c -r mydir</code> <code>btrfs filesystem defrag -c -r mydir</code>
 +
 +Force ZSTD compression dufing defrag:
 +<code>btrfs filesystem defrag -czstd file</code>
  
 It is not possible to get compression ratio of file. It is not possible to get compression ratio of file.
Line 45: Line 49:
 Internals: Internals:
   * In compressed extents, individual blocks are not compressed separately; rather, the compression stream spans the entire extent.   * In compressed extents, individual blocks are not compressed separately; rather, the compression stream spans the entire extent.
-  * BTRFS: There is a simple decision logic: if the first portion of data being compressed is not smaller than the original, the compression of the file is disabled -- unless the filesystem is mounted with compress-force+  * BTRFS: There is a simple decision logic: if the first portion of data being compressed is not smaller than the original, the compression of the file is disabled -- unless the filesystem is mounted with ''compress-force'' 
 + 
 +==== btrfs property ==== 
 + 
 +<code bash> 
 +btrfs property set <file> compression <zlib|lzo|zstd> 
 +</code>