ZFS Changing the compression of a zfs dataset

Say you created a new dataset with inherited compression=on the dataset got populated and after a while you need to change to compression=off.

Now what does that mean to how the files are stored in that dataset?
Do the files that exist get uncompressed or stay they untouched and compressed?
Do only new created files get stored uncompressed?
Should better a new dataset be created with the option compression=off?
 
existing files stay compressed, new files will be written uncompressed. there's scripts to rewrite the files, and i think newer openzfs has such functionality built in. as to which option is better, only you can make that judgement.
 
[…] Now what does that mean to how the files are stored in that dataset?
Do the files that exist get uncompressed or stay they untouched and compressed?
Do only new created files get stored uncompressed?
This is mentioned in zfsprops(7) at compression, although – to be fair – buried somewhere in the middle:​
This property can also be referred to by its shortened column name compress. Changing this property affects only newly‐written data.​
The abstraction level is wrong, though: compression occurs at the record level, not file level. You can seek(2) and (over‑)write(2) just a portion of a file. This is an implementation detail, so for all intents and purposes referring to files is OK (you cannot open(2) a specific record).​
Should better a new dataset be created with the option compression=off?
Refer to the refcompressratio property. The algorithm bails out as soon as data appears to be “uncompressible”, or not compressible enough to warrant the overhead. If the ratio is close to 1, you’re really just relieving the CPU of making a decision. Rewriting the data set is unnecessary.​
 
Back
Top