Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the compressed and uncompressed sizes of a file on a btrfs file system?

Is it possible to determine what the compressed size (I assume that is what is listed by ls -l) and uncompressed size of files on a btrfs filesystem with transparent compression enabled?

like image 515
gandalf3 Avatar asked Oct 20 '13 00:10

gandalf3


People also ask

Does Btrfs support compression?

Btrfs supports transparent file compression. There are three algorithms available: ZLIB, LZO and ZSTD(since v4. 14).

How do you enable compression on Btrfs?

To enable Btrfs filesystem-level compression, you have to mount the Btrfs filesystem you have created on the sdb1 partition with either the compress or compress-force mount option. i) compress mount option: The compress mount option will simply enable Btrfs filesystem-level compression.

Is Btrfs better than Ext4?

Advantages of Btrfs over Ext4:Btrfs removes duplicate data from disk directly while Ext4 cannot do that, Btrfs support CoW so users can create writable and read-only snapshots of files. Ext4 lacks this feature. Btrfs Can handle more data than Ext4.

Does Btrfs save space?

The Btrfs filesystem is a modern Copy-on-Write (CoW) filesystem that supports deduplication. If you need to keep a lot of redundant data (i.e., file backups, database) on your computer, then the Copy-on-Write (CoW) and deduplication feature of the Btrfs filesystem can save a huge amount of disk spaces.


1 Answers

there is a third party tool that can do this.

https://github.com/kilobyte/compsize

usage:

ayush@devbox:/code/compsize$ sudo compsize /opt Processed 54036 files, 42027 regular extents (42028 refs), 27150 inline. Type       Perc     Disk Usage   Uncompressed Referenced   Data        82%      5.3G         6.4G         6.4G        none       100%      4.3G         4.3G         4.3G        zlib        37%      427M         1.1G         1.1G        lzo         56%      588M         1.0G         1.0G   
like image 194
Ayush Avatar answered Oct 01 '22 03:10

Ayush