sherpaurgen
sherpaurgen

Reputation: 3274

How to compress existing data on a ZFS files system?

I have a zfs pool and it already have around 3TB of data. I have set the compression=lz4 by running

zfs set compression=lz4 secondarystore

root@home:/home/user1# zfs get compression secondarystore
NAME            PROPERTY     VALUE     SOURCE
secondarystore  compression  lz4       local

# zfs get compressratio secondarystore 
NAME            PROPERTY       VALUE  SOURCE
secondarystore  compressratio  1.00x  -

Does this compress the existing data or are there any other method of compression using zfs tools ?

Upvotes: 4

Views: 6665

Answers (2)

sherpaurgen
sherpaurgen

Reputation: 3274

moving data out of pool and getting it back to pool compressed those files. 200G-out of pool and back in was 12G

Upvotes: 1

Gary
Gary

Reputation: 923

I wrote a small shell script to replicate, verify and overwrite all files in the current working directory and all its descendant directories in order to trigger ZFS compression. Use with significant caution and make sure to have a backup beforehand.

Upvotes: 0

Related Questions