This is an old revision of the document!
Recompress zfs
#You basically have to rewrite every block of every file.
#A reasonably safe and simple way to do it is like this, however this
#assumes you have sufficient space.
#First set the new value for compression.
zfs set compression=on tank/fs
#Send a snapshot to a temporary name
zfs snapshot tank/***@1
zfs send -R tank/***@1 | zfs recv -vFd tank/fs-recompressed
#Mark the original as readonly and send anything newly written
#since the 'zfs send' above started.
zfs set readonly=on tank/fs
zfs snapshot tank/***@2
zfs send -i tank/***@1 tank/***@2 | zfs recv -v tank/fs-recompressed
#Now delete the original and rename the newone into its place.
zfs delete tank/fs
zfs rename tank/fs-recompressed tank/fs
#Note that the new tank/fs will have all the the snapshots of
#the original as well since -R was used with the zfs send.