Jérôme Warnier wrote:
Hi guys,

You can enable compression on a (ZFS) filesystem when already filled with files. However, it is my understanding that the previously-existing files are not compressed, only the file added afterwards. Is there any way to force a "recompression" of the existing files not already compressed?

Currently no simple way to do it.

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/f...@1
zfs send -R tank/f...@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/f...@2
zfs send -i tank/f...@1 tank/f...@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.

--
Darren J Moffat
_______________________________________________
zfs-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to