kilobyte / compsize

btrfs: find compression type/ratio on a file or set of files
Other
344 stars 23 forks source link

Values calculated are incorrect - ca. 10x smaller #10

Closed madmanxxx closed 6 years ago

madmanxxx commented 6 years ago

I have a freshly created BTRFS file system with only one file. It is ca. 68GB in size when compressed:

[root@nas ~]# df -h /dev/sdc1
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdc1       932G   68G  863G   8% /mnt/m3

The uncompressed file is 257GB:

[root@nas ~]# du -h /mnt/m3/rav.img
257G    /mnt/m3/rav.img
[root@nas ~]# ls -lh /mnt/m3
total 257G
-rw-r--r-- 1 root root 257G 12-25 17:02 rav.img

But when I use compsize, I get the following result:

[root@nas compsize]$ ./compsize /mnt/m3/rav.img
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       40%       10G          26G          26G
none       100%      3.0G         3.0G         3.0G
zstd        32%      7.6G          23G          23G

Environment:

roiderats commented 6 years ago

I was almost sure about wrong reporting with my 240 and 120 GB disk-image files, reported so small(like 9GB if I remember correctly) that maybe there's bytes worth of highest bits lost somewhere. Can't get into studying that now thou.

kilobyte commented 6 years ago

@roiderats: is this with or without the fix I applied two weeks ago?

The value of 24GB shows only on fully compressed, unfragmented files — having any non-compressed extents (the original reporter had 3G of them) moves the max up, fragmentation moves it down.

roiderats commented 6 years ago

My observation was atleast two weeks ago. Status closed=fine