GEOM_ZERO(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’« 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 the gzero device. default: '0'.
  • kern.geom.zero.clear β€” controls the clearing of the read data buffer. if it's set to '0', gzero will 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 of kern.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 β€” the gzero device. 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