scrub(1)
๐ scrub(1) โ the manual, but make it make sense ๐
okay bestie, sit down, we're talking about scrub, the general commands manual's own little chaos goblin. no cap, this thing is iconic.
โจ NAME โจ
scrub โ write patterns on disk/file. that's it. that's the whole vibe. it writes stuff over your stuff so nobody can get your stuff back. ๐
โจ SYNOPSIS โจ
scrub [OPTIONS] special-file [special-file ...]
scrub [OPTIONS] file [file ...]
scrub -X [OPTIONS] directory
โจ DESCRIPTION โจ
so like, scrub iteratively writes patterns on files or disk devices to make retrieving the data more difficult. iteratively!! it just keeps going. it's giving main character energy with a spray can. ๐ฆ
scrub operates in one of three modes:
- The special file corresponding to an entire disk is scrubbed and all data on it is destroyed. This mode is selected if file is a character or block special file. This is the most effective method. (aka the one that actually slays ๐ )
- A regular file is scrubbed and only the data in the file (and optionally its name in the directory entry) is destroyed. The file size is rounded up to fill out the last file system block. This mode is selected if file is a regular file. See CAVEATS below. (iykyk, there are caveats)
- A temporary directory is created under directory (which must exist) and is filled with files until the file system is full. Then the files are scrubbed as in 2). This mode is selected with the
-Xoption. See CAVEATS below.
โจ OPTIONS โจ
Scrub accepts the following options:
-v,--versionโ Print scrub version and exit. short and sweet, she's just here to say hi ๐-r,--removeโ Remove the file after scrubbing. gone gone gone ๐-p,--pattern PATTERNโ Select the patterns to write. See SCRUB METHODS below. The default,nnsa, is reasonable for sanitizing modern PRML/EPRML encoded disk devices. (yes, those are real acronyms, we don't make the rules)-b,--blocksize blocksizeโ Performread(2)andwrite(2)calls using the specified blocksize (in bytes).K,M, orGmay be appended to the number to change the units to KiBytes, MiBytes, or GiBytes, respectively. Default:4M. ๐พ-f,--forceโ Scrub even if target contains signature indicating it has already been scrubbed. bestie said "i don't care, do it again" ๐ค-S,--no-signatureโ Do not write scrub signature. Later, scrub will not be able to ascertain if the disk has already been scrubbed. you're on your own for bookkeeping here fr fr-X,--freespaceโ Create specified directory and fill it with files until write returnsENOSPC(file system full), then scrub the files as usual. The size of each file can be set with-s, otherwise it will be the maximum file size creatable given the user's file size limit or1gif unlimited. filling the whole thing UP ๐ฅ-D,--dirent newnameโ After scrubbing the file, scrub its name in the directory entry, then rename it to the new name. The scrub patterns used on the directory entry are constrained by the operating system and thus are not compliant with cited standards. This option only works with a single target. one target only, no harem ๐ซถ-s,--device-size sizeโ Override the device size (in bytes). Without this option, scrub determines media capacity using OS-specificioctl(2)calls.K,M, orGmay be appended to the number to change the units to KiBytes, MiBytes, or GiBytes, respectively.-L,--no-linkโ If file is a symbolic link, do not scrub the link target. Do remove it, however, if--removeis specified. look but don't touch ๐-R,--no-hwrandโ Don't use a hardware random number generator even if one is available. we're doing this the software way, periodt-t,--no-threadsโ Don't generate random data in parallel with I/O. one thing at a time, she's monogamous with her syscalls-n,--dry-runโ Do everything but write to targets. the rehearsal โจ-h,--helpโ Print a summary of command line options on stderr. yes, stderr, not stdout, don't come for me
โจ SCRUB METHODS โจ
the patterns, the lore, the whole menu. obsessed. ๐
nnsaโ 4-pass NNSA Policy Letter NAP-14.1-C (XVI-8) for sanitizing removable and non-removable hard disks, which requires overwriting all locations with a pseudorandom pattern twice and then with a known pattern: random(x2),0x00, verify.dodโ 4-pass DoD 5220.22-M section 8-306 procedure (d) for sanitizing removable and non-removable rigid disks which requires overwriting all addressable locations with a character, its complement, a random character, then verify. NOTE: scrub performs the random pass first to make verification easier: random,0x00,0xff, verify.bsiโ 9-pass method recommended by the German Center of Security in Information Technologies (http://www.bsi.bund.de):0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f.gutmannโ The canonical 35-pass sequence described in Gutmann's paper cited below. thirty-five. passes. ๐ญschneierโ 7-pass method described by Bruce Schneier in "Applied Cryptography" (1996):0x00,0xff, random(x5)pfitzner7โ Roy Pfitzner's 7-random-pass method: random(x7).pfitzner33โ Roy Pfitzner's 33-random-pass method: random(x33). (Roy was NOT playing around)usarmyโ US Army AR380-19 method:0x00,0xff, random. (Note: identical to DoD 522.22-M section 8-306 procedure (e) for sanitizing magnetic core memory).fillzeroโ 1-pass pattern:0x00.fillffโ 1-pass pattern:0xff.randomโ 1-pass pattern: random(x1).random2โ 2-pass pattern: random(x2).oldโ 6-pass pre-version 1.7 scrub method:0x00,0xff,0xaa,0x00,0x55, verify.fastoldโ 5-pass pattern:0x00,0xff,0xaa,0x55, verify.custom=stringโ 1-pass custom pattern. String may contain C-style numerical escapes:\nnn(octal) or\xnn(hex).
โจ CAVEATS โจ
bestie. read this part. i'm serious. ๐ซถ
Scrub may be insufficient to thwart heroic efforts to recover data in an appropriately equipped lab. If you need this level of protection, physical destruction is your best bet. like, actually smash it. ๐จ
The effectiveness of scrubbing regular files through a file system will be limited by the OS and file system. File systems that are known to be problematic are journaled, log structured, copy-on-write, versioned, and network file systems. If in doubt, scrub the raw disk device. (scrub the raw disk. raw. RAW.)
Scrubbing free blocks in a file system with the -X method is subject to the same caveats as scrubbing regular files, and in addition, is only useful to the extent the file system allows you to reallocate the target blocks as data blocks in a new file. If in doubt, scrub the raw disk device. (seeing a pattern here? scrub the raw disk.)
On MacOS X HFS file system, scrub attempts to overwrite a file's resource fork if it exists. Although MacOS X claims it will support additional named forks in the future, scrub is only aware of the traditional data and resource forks. she only knows the classics, sorry ๐
scrub cannot access disk blocks that have been spared out by the disk controller. For SATA/PATA drives, the ATA "security erase" command built into the drive controller can do this. Similarly, the ATA "enhanced security erase" can erase data on track edges and between tracks. The DOS utility HDDERASE from the UCSD Center for Magnetic Recording Research can issue these commands, as can modern versions of Linux hdparm. Unfortunately, the analogous SCSI command is optional according to T-10, and not widely implemented. ๐
โจ EXAMPLES โจ
To scrub a raw device /dev/sdf1 with default NNSA patterns:
# scrub /dev/sdf1
scrub: using NNSA NAP-14.1-C patterns
scrub: please verify that device size below is correct!
scrub: scrubbing /dev/sdf1 1995650048 bytes (~1GB)
scrub: random |................................................|
scrub: random |................................................|
scrub: 0x00 |................................................|
scrub: verify |................................................|
To scrub the file /tmp/scrubme with a sequence of 0xff 0xaa bytes:
# scrub -p custom="\xff\xaa" /tmp/scrubme
scrub: using Custom single-pass patterns
scrub: scrubbing /tmp/scrubme 78319616 bytes (~74MB)
scrub: 0xffaa |................................................|
look at those little progress bars. she's so tidy. ๐ธ
โจ AUTHOR โจ
Jim Garlick <garlick@llnl.gov>
This work was produced at the University of California, Lawrence Livermore National Laboratory under Contract No. W-7405-ENG-48 with the DOE. Designated UCRL-CODE-2003-006, scrub is licensed under terms of the GNU General Public License. ๐
โจ SEE ALSO โจ
- DoD 5220.22-M, "National Industrial Security Program Operating Manual", Chapter 8, 01/1995.
- NNSA Policy Letter: NAP-14.1-C, "Clearing, Sanitizing, and Destroying Information System Storage Media, Memory Devices, and other Related Hardware", 05-02-08, page XVI-8.
- "Secure Deletion of Data from Magnetic and Solid-State Memory", by Peter Gutmann, Sixth USENIX Security Symposium, San Jose, CA, July 22-25, 1996.
- "Gutmann Method", Wikipedia,
http://en.wikipedia.org/wiki/Gutmann_method. - Darik's boot and Nuke FAQ:
http://dban.sourceforge.net/faq/index.html - "Tutorial on Disk Drive Data Sanitization", by Gordon Hugues and Tom Coughlin,
http://cmrr.ucsd.edu/people/Hughes/DataSanitizationTutorial.pdf. - "Guidelines for Media Sanitization", NIST special publication 800-88, Kissel et al, September, 2006.
shred(1),hdparm(8)
and that's the whole page, bestie!! ๐โจ this little icon is version scrub-2.6.1+git20240819.9b4267e, it's part of the scrub(1) general commands manual, and yeah โ this is the page for scrub(1) too, we contain multitudes ๐
bye bye, go scrub responsibly! ๐๐๐ฆ
๐ฆ where this page comes from
- debian trixie: scrub 2.6.1+git20240819.9b4267e-1 ยท GPL-2.0-or-later
- ubuntu questing: scrub 2.6.1+git20240819.9b4267e-1
- ubuntu resolute: scrub 2.6.1+git20240819.9b4267e-1build1 ยท GPL-2.0-or-later
- ubuntu stonking: scrub 2.6.1+git20240819.9b4267e-1build1 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms