1compsize(8)                          btrfs                         compsize(8)
2
3
4

NAME

6       compsize - calculate compression ratio of a set of files on btrfs
7

SYNOPSIS

9       compsize file-or-dir [ file-or-dir ... ]
10

DESCRIPTION

12       compsize  takes a list of files on a btrfs filesystem (recursing direc‐
13       tories) and measures used compression types and the effective  compres‐
14       sion ratio.  Besides compression, compsize shows the effect of reflinks
15       (cp --reflink, snapshots, deduplication), and certain  types  of  btrfs
16       waste.
17
18       The program gives a report similar to:
19       Processed 90319 files.
20       Type       Perc     Disk Usage   Uncompressed Referenced
21       TOTAL       79%      1.4G         1.8G         1.9G
22       none       100%      1.0G         1.0G         1.0G
23       lzo         53%      446M         833M         843M
24
25       The fields above are:
26
27       Type   compression algorithm
28
29       Perc   disk usage/uncompressed (compression ratio)
30
31       Disk Usage
32              blocks  on  the  disk; this is what storing these files actually
33              costs you (save for RAID considerations)
34
35       Uncompressed
36              uncompressed extents; what you would need without compression  -
37              includes deduplication savings and pinned extent waste
38
39       Referenced
40              apparent  file  sizes  (sans  holes); this is what a traditional
41              filesystem that supports holes and efficient  tail  packing,  or
42              tar -S, would need to store these files
43
44       Let's  see  this  on  an example: a file 128K big is stored as a single
45       extent A which compressed to a single 4K  page.   It  then  receives  a
46       write  of 32K at offset 32K, which also compressed to a single 4K page,
47       stored as extent B.
48
49       The file now appears as:
50                +-------+-------+---------------+
51       extent A | used  | waste | used          |
52                +-------+-------+---------------+
53       extent B         | used  |
54                        +-------+
55
56       The "waste" inside extent A can't be gotten rid until the whole  extent
57       is  rewritten (for example by defrag).  If compressed, the whole extent
58       needs to be read every time that part of the file is being  read,  thus
59       the "waste" is still required.
60
61       In this case, we have: Disk Usage: 8KB, Uncompressed: 160K, Referenced:
62       128K.
63

OPTIONS

65       -b/--bytes
66              Show raw byte counts rather than human-friendly sizes.
67
68       -x/--one-file-system
69              Skip files and directories on different file systems.
70

SIGNALS

72       USR1   Displays partial data for files processed so far.
73

CAVEATS

75       Recently written files may show as not taking any space  until  they're
76       actually  allocated and compressed; this happens once they're synced or
77       on natural writeout, typically on the order of 30 seconds.
78
79       The ioctls used by this program require root.
80
81       Inline extents are considered to be always unique, even if  they  share
82       the same bytes on the disk.
83
84       This  program doesn't currently support filesystems above 8TB on 32-bit
85       machines  but neither do other btrfs tools.
86
87
88
89btrfs                             2017-09-04                       compsize(8)
Impressum