execute deduplication

#apt install jdupes
jdupes --one-file-system --dedupe --recurse --size /storage/


alternative

# apt install duperemove
duperemove -r -d -h -v --hashfile=/storage/.dupe_hash /storage



Check deduplication

btrfs filesystem du --summarize --human-readable  /storage/

example output

root@server5:~# btrfs filesystem du --summarize --human-readable  /storage/
     Total   Exclusive  Set shared  Filename
   9.56TiB     6.70TiB     1.37TiB  /storage/

root@server5:~# df -h /storage
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   15T  8.1T  6.5T  56% /storage


mount with compression enabled

root@server5:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/mmcblk0p3 during curtin installation
# eMMC Space
/dev/disk/by-uuid/04b08549-62d1-41eb-818d-bf301872b67e / ext4 defaults 0 1
/dev/disk/by-uuid/dda5b65e-2cb5-4648-9867-1eaa0e717e2e /boot ext4 defaults 0 1
/dev/disk/by-uuid/F557-B88C /boot/efi vfat defaults 0 1
/swap.img       none    swap    sw      0       0
# NVMe btrfs RAID0
UUID=47679023-51c8-4242-9117-f4b6e76dd3b8 /storage btrfs defaults,compress,autodefrag 0 1



check compression

compsize /storage


root@server5:~# compsize /storage/
Processed 1929919 files, 3560064 regular extents (3764806 refs), 160357 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       99%      8.0T         8.0T         9.5T
none       100%      8.0T         8.0T         9.5T
zlib        31%      7.9G          25G          25G
prealloc   100%      219M         219M         329M


root@server5:~# btrfs fi show /storage/
Label: 'storage'  uuid: 47679023-51c8-4242-9117-f4b6e76dd3b8
        Total devices 4 FS bytes used 8.07TiB
        devid    1 size 3.64TiB used 2.32TiB path /dev/nvme0n1p1
        devid    2 size 3.64TiB used 2.32TiB path /dev/nvme1n1p1
        devid    3 size 3.64TiB used 2.31TiB path /dev/nvme2n1p1
        devid    4 size 3.64TiB used 2.31TiB path /dev/nvme3n1p1