1ZEROFREE(8)                 System Manager's Manual                ZEROFREE(8)
2
3
4

NAME

6       zerofree — zero free blocks from ext2, ext3 and ext4 file-systems
7

SYNOPSIS

9       zerofree [-n]  [-v]  [-f fillval]  filesystem
10

DESCRIPTION

12       zerofree  finds  the unallocated, blocks with non-zero value content in
13       an ext2, ext3 or ext4 filesystem (e.g. /dev/hda1) and fills  them  with
14       zeroes (or another octet of your choice).
15
16
17
18       Filling  unused areas with zeroes is useful if the device on which this
19       file-system resides is a disk image. In this  case,  depending  on  the
20       type  of disk image, a secondary utility may be able to reduce the size
21       of the disk image after zerofree has been run.
22
23
24       Filling unused areas may also be useful with solid-state drives (SSDs).
25       On  some  SSDs,  filling blocks with ones (0xFF) is reported to trigger
26       Flash block erasure by the firmware, possibly giving  a  write  perfor‐
27       mance increase.
28
29
30       The  usual  way  to  achieve  the  same result (zeroing the unallocated
31       blocks) is to run dd (1) to create a file full of zeroes that takes  up
32       the entire free space on the drive, and then delete this file. This has
33       many disadvantages, which zerofree alleviates:
34
35          •  it is slow;
36
37          •  it makes the disk image (temporarily) grow to its maximal extent;
38
39          •  it (temporarily) uses all free space on the disk, so  other  con‐
40             current write actions may fail.
41
42
43       filesystem  has  to  be  unmounted or mounted read-only for zerofree to
44       work. It will exit with an error message if the filesystem  is  mounted
45       writable.  To  remount  the  root  file-system  readonly, you can first
46       switch to single user runlevel (telinit 1) then use mount -o remount,ro
47       filesystem.
48
49
50       zerofree has been written to be run from GNU/Linux systems installed as
51       guest OSes inside a virtual machine. In this case, it is typically  run
52       from  within  the guest system, and a utility is then run from the host
53       system to shrink disk image (VBoxManage  modifyhd  --compact,  provided
54       with virtualbox, is able to do that for some disk image formats).
55
56
57       It  may  however  be useful in other situations: for instance it can be
58       used to make it more difficult to retrieve deleted  data.  Beware  that
59       securely  deleting  sensitive  data  is not in general an easy task and
60       usually requires writing several times on the deleted blocks.
61
62

OPTIONS

64       -n        Perform a dry run  (do not modify the file-system);
65
66       -v        Be verbose: show the number of blocks  modified  by  zerofree
67                 (or that would be modified, in case the -n is used), the num‐
68                 ber of free blocks and the total  number  of  blocks  on  the
69                 filesystem;
70
71       -f value  Specify  the  octet value to fill empty blocks with (defaults
72                 to 0). Argument must be within the range 0 to 255.
73

SEE ALSO

75       dd (1).
76

AUTHOR

78       This manual page was written by Thibaut Paumard  <paumard@users.source‐
79       forge.net>  for the Debian system (but may be used by others).  Permis‐
80       sion is granted to copy, distribute and/or modify this  document  under
81       the  terms  of  the  GNU General Public License, Version 2 or any later
82       version published by the Free Software Foundation.
83
84
85       On Debian systems, the complete text of the GNU General Public  License
86       can be found in /usr/share/common-licenses/GPL-2.
87
88
89
90
91                                                                   ZEROFREE(8)
Impressum