ZEROFREE(8)
β¨ ZEROFREE(8) β NAME β¨
okay so bestie, zerofree (the manual name is ZEROFREE(8) π) is a tool that zeroes out free blocks on ext2, ext3 and ext4 file-systems π§ that's literally the whole vibe.
π SYNOPSIS π
zerofree [-n] [-v] [-f fillval] filesystem
π DESCRIPTION π
okay so zerofree goes hunting for the unallocated blocks that still have non-zero content in an ext2, ext3 or ext4 filesystem (think /dev/hda1) and fills them with zeroes, or with another octet of your choice π¦ no cap, it's giving tidy.
filling unused areas with zeroes is super useful if the device this file-system lives on is a disk image π«Ά depending on what kind of disk image it is, a secondary utility might be able to shrink the image after zerofree has run. iconic behaviour π₯
filling unused areas can also be useful on solid-state drives (SSDs) β¨ on some SSDs, filling blocks with ones (0xFF) is reported to trigger Flash block erasure by the firmware, which could give a write performance boost πΈ
the usual way to get the same result is to run dd (1) to make a file full of zeroes that eats up the entire free space on the drive, then delete that file. ngl this has a lot of downsides, and zerofree fixes most of them π
- it is slow π
- it makes the disk image (temporarily) grow to its maximal extent π
- it (temporarily) uses all the free space on the disk, so other concurrent write actions may fail π
the file-system has to be unmounted or mounted read-only for zerofree to work π« if it's mounted writable, zerofree will exit with an error message. to remount the root file-system read-only, switch to single user runlevel first withtelinit 1, then runmount -o remount,ro filesystem.
zerofree was written to run on GNU/Linux systems installed as guest OSes inside a virtual machine π it's typically run from inside the guest, and then a utility gets run from the host to shrink the disk image (VBoxManage modifyhd --compact, which comes with virtualbox, can do that for some disk image formats) β¨
it can also be useful in other situations, for instance to make it harder to retrieve deleted data π beware though: securely deleting sensitive data is not an easy task in general, and it usually means writing over the deleted blocks several times.
π OPTIONS π
-nβ a dry run π§ͺ it won't modify the file-system at all-vβ be verbose π£ shows the number of blocks modified by zerofree (or that would be modified, if you used-n), the number of free blocks, and the total number of blocks on the file-system-f valueβ pick the octet value to fill empty blocks with π¨ it defaults to0, and the argument must be within the range0to255
π¦ SEE ALSO π¦
dd (1).
π AUTHOR π
this manual page was written by Thibaut Paumard <paumard@users.sourceforge.net> for the Debian system (but others are welcome to use it) π permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 or any later version published by the Free Software Foundation.
on Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2.
ttyl bestie, this was ZEROFREE(8) from System Manager's Manual, and it's giving main character energy π«Άπ
π¦ where this page comes from
- debian bookworm: zerofree 1.1.1-1
- debian trixie: zerofree 1.1.1-1+b1
- ubuntu jammy: zerofree 1.1.1-1build3
- ubuntu noble: zerofree 1.1.1-1build5
- ubuntu questing: zerofree 1.1.1-1build5
- ubuntu resolute: zerofree 1.1.1-1build6
- ubuntu stonking: zerofree 1.1.1-1build6
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms