Re: free space considerations writing bhyve image to a zvol
- Reply: void : "Re: free space considerations writing bhyve image to a zvol"
- In reply to: void : "free space considerations writing bhyve image to a zvol"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 18 Oct 2023 15:37:59 UTC
> On Oct 18, 2023, at 08:58, void <void@f-m.fm> wrote: > > A linux file-backed vm was created initially like this: > > truncate -s 2T linuxvm.img > > Within the vm, df -h reports 1.1Tb used in total. > Externally, on the freebsd host, the linuxvm.img is 2Tb. > > If i write the vm to a 1.6Tb zvol with compression set (lz4), > would it be feasible to expect the vm to work? > > I expect it might break the vm's filesystem internally, > now, thinking about it. > -- > By "zvol" do you mean a volume created with zfs create -V? If so, compression does not affect how much data you can store before the volume becomes full. # zfs create -V 32M data/scratch # dd if=/dev/zero of=/dev/zvol/data/scratch bs=1m dd: /dev/zvol/data/scratch: end of device 33+0 records in 32+0 records out 33554432 bytes transferred in 0.021722 secs (1544723175 bytes/sec) By default zfs reserves enough space in the pool to allow the volume to be filled with uncompressed data. If you want a volume to hold 2 TB of logical data and you expect the compressed data to fit in 1.6 TB, set the refreservation property on the volume to the smaller size. See the discussion of the volsize parameter in zfsprops(7). https://man.freebsd.org/cgi/man.cgi?zfsprops # zfs set volsize=64M refreservation=32M data/scratch # dd if=/dev/zero of=/dev/zvol/data/scratch bs=1m dd: /dev/zvol/data/scratch: end of device 65+0 records in 64+0 records out 67108864 bytes transferred in 0.037005 secs (1813511443 bytes/sec)