CentOS Scrub Example: wipe files off usb disks, clearing free space

Alert: the syntax on this page is for a particular usb disk plugged into a CentOS server.  You will need to edit the paths very carefully to avoid erasing the wrong data on your system !

Scrub Manual Page

Note: if you tried option -p and got the "wrong type of file" error, like this,

# scrub -p dod /media/OldDisk1
scrub: using DoD 5220.22-M patterns
scrub: /media/OldDisk1 is wrong type of file

then you should have a look at the -X syntax option because that lets you scrub the freespace under a directory.  The way to use it is to specify a directory name that does NOT EXIST, and then it will create that, scrub it and erase it.

My entire sequence, including mounting the usb disk, finding my path for my usb data on the old disk via lsblk, scrubbing and then unmounting, was:

# mkdir /media/OldDisk1

# lsblk

# mount /dev/sdb1  /media/OldDisk1  

# scrub -X -p dod -S /media/OldDisk1/a
scrub: using DoD 5220.22-M patterns
scrub: created directory /media/OldDisk1/a
scrub: scrubbing /media/OldDisk1/a/scrub.000 1073741824 bytes (~1024MB)
scrub: random  |......................xxxxxxxxxxxxxxxxxxxxxxxxxx|
scrub: 0x00    |................................................|
scrub: 0xff    |................................................|
scrub: verify  |................................................|
scrub: unlinked /media/OldDisk1/a/scrub.000
scrub: removed /media/OldDisk1/a

# umount /media/OldDisk1

# rmdir /media/OldDisk1

Note that scrub has various ways of clearing the disk.  The DOD pattern is only one of the choices.  Read all disclaimers and choose carefully.  The link to the man page for scrub is at the top of this post.

Note that if you have Logical Volumes on your usb disk, i.e. LVM partitions, you will need more than lsblk to get the identifier to mount. See this excellent set of instructions for LVM mounting.



Comments

Popular Posts