Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Oct 2023 15:37:59 +0000
From:      "John F Carr" <jfc@mit.edu>
To:        void <void@f-m.fm>
Cc:        "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org>
Subject:   Re: free space considerations writing bhyve image to a zvol
Message-ID:  <1ACB40C4-6EA3-45AE-AC62-1D5ED71C22FF@mit.edu>
In-Reply-To: <ZS_WZD-JlHEo_Em5@int21h>
References:  <ZS_WZD-JlHEo_Em5@int21h>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Oct 18, 2023, at 08:58, void <void@f-m.fm> wrote:
>=20
> A linux file-backed vm was created initially like this:
>=20
> truncate -s 2T linuxvm.img
>=20
> Within the vm, df -h reports 1.1Tb used in total.
> Externally, on the freebsd host, the linuxvm.img is 2Tb.
>=20
> If i write the vm to a 1.6Tb zvol with compression set (lz4),
> would it be feasible to expect the vm to work?
>=20
> I expect it might break the vm's filesystem internally,
> now, thinking about it.
> --=20
>=20

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=3D/dev/zero of=3D/dev/zvol/data/scratch bs=3D1m
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 logica=
l
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=3D64M refreservation=3D32M data/scratch
# dd if=3D/dev/zero of=3D/dev/zvol/data/scratch bs=3D1m
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)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1ACB40C4-6EA3-45AE-AC62-1D5ED71C22FF>