zfs compression of a volume

Allan Jude allanjude at freebsd.org
Wed Jul 15 14:21:13 UTC 2020


On 2020-07-15 10:04, tech-lists wrote:
> Hi,
> 
> If a zfs-backed bhyve instance is created, and compression is not set,
> if the
> instance is turned off, then compression set on the host for the volume
> (and
> then the bhyve instance is started), is the instance compressed in its
> entirety at that time, or just data subsequently added to it?
> 
> thanks,

When you change the compression setting on any ZFS dataset (filesystem
or volume), it only applies to blocks that are written (or overwritten)
after that point.

You do not need to stop the bhyve to change the compression setting.

If you want to recompress the entire volume:

1) stop the bhyve
2) snapshot the volume
3) create a new volume, with compression enabled
4) zfs send -e oldvolume at snapshot | zfs recv -F newvolume
5) start the bhyve using the new volume
6) (optional) destroy the old volume


-- 
Allan Jude


More information about the freebsd-virtualization mailing list