wipefreespace(1)

πŸ“¦ version 3.0, in nixos 26.05, nixpkgs unstable

πŸ’… wipefreespace(1) β€” General Commands Manual, but make it cute πŸ’…

πŸ’– NAME πŸ’–

WipeFreeSpace β€” secure cleaning of free space on filesystems.

πŸŽ€ SYNOPSIS πŸŽ€

wipefreespace [options] /dev/XY ...

✨ DESCRIPTION ✨

okay so bestie, the WipeFreeSpace program securely cleans the free space and undelete data on the given ext2/3/4, NTFS, XFS, ReiserFSv3/4, FAT12/16/32, MinixFSv1/2, JFS, HFS+ and OCFS file systems. Write permissions are required for the devices (or regular files containing the file system), but the program MUST NOT be setuid(root).

🚨 no cap: MUST NOT be setuid(root) β€” that part is serious, bestie.

Each given filesystem is wiped ONLY ONCE, no matter how many times it appears on the command line. WipeFreeSpace also works for file systems created inside regular files on any host file system. It's giving "flexible and thorough" ✨

WipeFreeSpace wipes the following things (when supported by the backing library):

  • free space (space in unused blocks/clusters)
  • free space in partially used blocks (also called the "slack space")
  • deleted files' names and other data that can be used to undelete a file (like the journal)

WipeFreeSpace does NOT decrease the amount of available free space when working. periodt πŸ’…

To perform a command after wiping (like sending e-mail), simply run a program after WipeFreeSpace is finished, for example:

wipefreespace [options] /dev/XY; mail [options]

or in a script:

#!/bin/bash

wipefreespace [options] /dev/XY

mail [options]

To run WipeFreeSpace with a higher or lower priority, simply use the renice utility, for example:

renice +1 $(pidof wipefreespace)

🌸 OPTIONS 🌸

Any option affects all filesystems given on the command line, not just the ones following it. iykyk πŸ‘‘

  • --all-zeros β€” Use only zeros for wiping.
  • --background β€” Continue work in the background, if possible. This disables verbose mode (the source page says "verose" β€” iconic typo, but yeah 😭).
  • -b|--superblock OFFSET β€” Superblock offset on the given filesystems
  • -B|--blocksize SIZE β€” Block size on the given filesystems
  • -f|--force β€” Wipe even if the file system has errors
  • -h|--help β€” Print help
  • --last-zero β€” Perform additional wiping with zeros
  • -l|--license β€” Print license information
  • -n|--iterations NNN β€” Number of passes (greater than 0)
  • --method NAME β€” Use the given method for wiping (read below).
  • --nopart β€” Do NOT wipe free space in partially used blocks.
  • --nounrm β€” Do NOT wipe undelete information
  • --nowfs β€” Do NOT wipe free space on file system
  • --no-wipe-zero-blocks β€” Do NOT wipe all-zero blocks on file system (useful for virtual/sparse devices, where empty areas are read as all-zeros and do not take physical space unless actually written to).
  • --order TYPE β€” Use the given order for wiping (read below).
  • --use-dedicated β€” Use the program dedicated for the given filesystem type if supported. Fallback to WipeFreeSpace if unsupported (currently, only 'ntfswipe' is supported)
  • --use-ioctl β€” Disable device caching during work (can be DANGEROUS)
  • -v|--verbose β€” Verbose output. Use twice for more. This also enables progress bars, but be warned: these may not always be accurate or increase at a constant rate.
  • -V|--version β€” Print version number

πŸ¦‹ WIPING METHODS πŸ¦‹

The following method names (case-insensitive) are available:

  • Gutmann β€” method similar to Gutmann's, the default, 36 passes
  • random β€” shred-like, 25 passes
  • schneier β€” Shneier's method, 7 passes, contains ITSG-06
  • dod β€” DoD, 3 passes, contains NAVSO P-5239-26 and German Federal Office for Information Security

🌈 WIPING ORDERS 🌈

WipeFreeSpace supports two wiping orders:

  • block β€” wipe block by block with all patterns and flush the overwriting data to disk after each pattern (so, each block waits to be wiped until the previous one is done)
  • pattern β€” wipe the whole filesystem with each pattern (all blocks with the first pattern, then all blocks with the second pattern, and so on), and flushing the overwriting data to disk after each pattern. This is the default

πŸ’€ DIAGNOSTICS πŸ’€

The program returns with 0 exit code if everything went fine. If there were errors, the program exits with non-zero exit code:

  • 1: β€” Only version number, help or licence information was requested and printed, no action.
  • -1: β€” Bad/missing command line syntax.
  • -2: β€” Unable to check if the file system is mounted. Cannot continue.
  • -3: β€” The file system was mounted in read-write mode. Cannot continue.
  • -4: β€” Unable to open the file system.
  • -5: β€” Unable to read block bitmap from the file system (thus, unable to determine, which blocks are unused).
  • -6: β€” Memory allocation failed.
  • -7: β€” The file system contained errors and the option --force was not given.
  • -8: β€” Closing the file system failed.
  • -9: β€” Opening i-node scan failed. Thus, the program was unable to wipe free space in partially used blocks.
  • -10: β€” Iterating over blocks failed. Thus, the program was unable to wipe free space in partially used blocks.
  • -11: β€” I-node read failed. Some undelete data may not have been removed.
  • -12: β€” Directory iterating failed. Thus, the program was unable to remove some of (maybe all) undelete data.
  • -13: β€” The program found out that it has the suid permission bit set and the owner is root. Read the first chapter of the info documentation for an explanation and a solution.
  • -14: β€” Flushing the changes to the filesystem failed.
  • -15: β€” Block writing failed.
  • -16: β€” Failed to open an attribute (mostly on NTFS).
  • -17: β€” Failed runlist on NTFS.
  • -18: β€” Getting name failed.
  • -19: β€” Context error (NTFS).
  • -20: β€” Bad parameter was passed to one of the functions.
  • -21: β€” Pipe error (mostly XFS).
  • -22: β€” Fork error (XFS or ReiserFSv3).
  • -23: β€” Exec error (XFS).
  • -24: β€” Seek error (mostly ReiserFSv4).
  • -25: β€” Block reading failed.
  • -26: β€” I/O control command (ioctl) failed.
  • -100: β€” A signal was caught and the program was forced to exit.

🫢 NOTES 🫢

Only the last error is returned. If the last file system was wiped successfully, but the previous weren't, the last error will be returned, but not the previous ones.

It is best to use this program on un-mounted file systems, which makes sure the journal is committed and there aren't any concurrent modifications. bestie, that's the vibe check: unmounted = safer energy πŸ”₯

πŸ‘‘ AUTHOR πŸ‘‘

Bogdan 'bogdro' Drozdowski,

🧚 THANKS 🧚

  • Theodore Ts'o, for the great ext2fs library and e2fsprogs.
  • The linux-ntfs team for their research on NTFS and a great programming library.
  • Colin Plumb, for the great 'shred' program, parts of which are used here.
  • Patrick R. McDonald 'marlowe' (www.antagonism.org) - for bug reports, testing and promoting WipeFreeSpace.
  • Mark Lord (mlord@pobox.com) for the great hdparm utility.
  • knightray@gmail.com for The Tiny FAT FS library (on LGPL).
  • Gregory Grosse - for bug reports and testing WipeFreeSpace.
  • Travis CI (https://www.travis-ci.com/) for providing build environments.
  • GitHub (https://github.com/) for providing code versioning, security tests, build environments and integration with Travis CI.

⭐ SEE ALSO ⭐

shred(1), info libsecrm

The 'info' documentation is more descriptive and is the main one. Type

info wipefreespace

to read it.


πŸ’– xoxo, that's the page β€” source/version: User's Manual Β· Linux Β· wipefreespace(1); the date isn't listed on this page, so I'm not inventing one, periodt πŸŽ€

πŸ“¦ where this page comes from