incremental disk wipe?

Karl Auer kauer at biplane.com.au
Sat Mar 7 21:39:55 UTC 2015


On Sat, 2015-03-07 at 06:25 -0800, rikona wrote:
> Thanks to you and others for the replies. I wasn't thinking of
> multiple chunks simultaneously - rather sequentially. Let's say I'll
> be away from the comp for 30 min or so. How can I keep it busy for
> JUST 30 min - no more, to do *part* of the wipe? Then, later, do
> another 30 min, eventually wiping the entire disk?

Try cpulimit. Run your shred or other job in the background. Have two
scripts, one that limits its CPU usage to (say) 1%, another that sets
its CPU limit to (say) 75%. Both of those should let you work. Then just
run the 1% script when you want to do other stuff, and the 75% script
when you are happy to be impeded.

Alternatively, just kill cpulimit to let the shredding have its head,
and run it again when you want to use the computer for something else.
The scrip below will do both those things for you.

> I was considering filling the disk with huge numbers of innocuous
> files, to replace the original data

This will take just as long as the shredding.

This is my "relimit" script. I'm only ever limiting one process; you'll
have to fix that "killall" in the script if you use cpulimit for several
different processes at once. NAME is the process name (needs to be
unique, otherwise read the cpulimit man page to find out about the -p
option) and LIMIT is a percentage like "45". Examples:

   To limit the avconv process to 65% of CPU: relimit avconv 65
   To change avconv's limit to 95%: relimit avconv 95
   To stop cpulimit completely: relimit

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/sh
NAME=$1
LIMIT=$2

killall cpulimit

if [ -z $NAME ] ; then
   echo "No arguments specified!"
   echo "cpulimit killed with no replacement."
   exit 0 ;
fi

if [ -z $LIMIT ] ; then
   echo "No limit specified!"
   echo "No changes made."
   exit 0 ;
fi

echo "Limiting process \"$NAME\" to $LIMIT%."
cpulimit -e $NAME -l $LIMIT > /dev/null 2>&1 &
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Regards, K.


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
Old fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882






More information about the ubuntu-users mailing list