ZEROFREE(8)

πŸ“¦
version 1.1.1 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 with telinit 1, then run mount -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 to 0, and the argument must be within the range 0 to 255

πŸ¦‹ 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 πŸ«ΆπŸ’–