GEOM_ZERO(4)
π« hiii bestie, welcome to GEOM_ZERO(4) π«
okay so this is the manual for gzero / geom_zero β the GEOM-based zero disk/block device. yes it's giving "why does this exist" and then it turns out to be iconic. let's go π
β¨ SYNOPSIS β¨
compile it in:
options GEOM_ZERO
and in loader.conf(5) or sysctl.conf(5) you've got your two besties:
kern.geom.zero.byte
kern.geom.zero.clear
π¦ DESCRIPTION π¦
so gzero is a GEOM(4) device that literally pretends to be a one-exabyte disk. she's fake but she's huge π«Ά any data you write to her? thrown away, gone, not thinking about it. and every byte you read back? she returns the value of <italic>kern.geom.zero.byte</italic>. that's the whole personality.
now bestie, don't get it twisted β gzero is not the same as zero(4). zero(4) is a regular character device with an infinite length, while /dev/gzero is a GEOM(4) provider β big, yes, but limited in size. iykyk.
for how to use the supported commands of the GEOM(4) ZERO class, go read geom(8). she explains it better than i ever could, no cap.
so what is gzero actually for? benchmarking performance of GEOM and GEOM classes where data compression doesn't mess with the results β because blocks from /dev/gzero compress exceptionally well like it's not even trying π. examples include comparing the speed of two disk encryption algorithms, and comparing a hardware versus software implementation of a single encryption algorithm. slay, science.
πΈ MIB VARIABLES πΈ
these two are available as both sysctl(8) variables and loader(8) tunables. double threat energy:
kern.geom.zero.byteβ sets the fill byte of thegzerodevice. default:'0'.kern.geom.zero.clearβ controls the clearing of the read data buffer. if it's set to'0',gzerowill not copy any data into the read data buffers and just returns them as they are, without modifying them. in particular, it will not fill the read buffer with the value ofkern.geom.zero.byte(not not not β that's literally what the manual says, don't come for me π). this is useful for read benchmarking, to reduce the measurement noise caused by extra memory initialization. default:'1'.
π FILES π
/dev/gzeroβ thegzerodevice. the main character.
π₯ EXAMPLES π₯
okay this is the fun part, let's actually do stuff.
create the /dev/gzero device by loading the geom_zero kernel module:
# geom zero load
show information about the gzero device:
# geom zero list
Geom name: gzero
Providers:
1. Name: gzero
Mediasize: 1152921504606846976 (1.0E)
Sectorsize: 512
Mode: r0w0egzero0
set the fill byte of the gzero device to 70 (decimal for letter "F" in ascii(7)):
# sysctl kern.geom.zero.byte=70
kern.geom.zero.byte: 0 -> 70
# head -c 1 /dev/gzero
F
benchmark read and write throughput of geli(8)'s default encryption algorithm with a 4-KiB sector size:
# geom zero load
# geli onetime -s 4096 gzero
# sysctl kern.geom.zero.clear=0
# dd if=/dev/gzero.eli of=/dev/zero bs=4k count=$((1024 * 256))
262144+0 records in
262144+0 records out
1073741824 bytes transferred in 1.258195 secs (853398307 bytes/sec)
# dd if=/dev/zero of=/dev/gzero.eli bs=4k count=$((1024 * 256))
262144+0 records in
262144+0 records out
1073741824 bytes transferred in 1.663118 secs (645619658 bytes/sec)
ate. no crumbs. π
π SEE ALSO π
GEOM(4), zero(4), geom(8), sysctl(8), bio(9)
π HISTORY π
a gzero device first appeared in FreeBSD 6. a legend since day one.
π AUTHORS π
the gzero device was written by PaweΕ Jakub Dawidek <pjd@FreeBSD.org>.
the gzero manual page was originally written by Greg White <gkwhite@gmail.com> and rewritten by Mateusz Piotrowski <0mp@FreeBSD.org> before landing in FreeBSD. iconic collaborative behavior honestly π«Ά
π this page lived its best life as part of Debian, dated November 9, 2025, and you read all of GEOM_ZERO(4). go benchmark something and tell me all about it, bestie β¨π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- π the page's license: BSD-2-Clause
- Copyright (c) 2019 Greg White <gkwhite@gmail.com>. All rights reserved
- Copyright (c) 2025 Mateusz Piotrowski <0mp@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms