put password to clipboard
[sunny256-utils.git] / wdisk
blob196a9f93426346adb4c618943c14c3f49861113d
1 #!/bin/sh
3 # wdisk
4 # File ID: 8945d66e-5d49-11df-8e4e-90e6ba3022ac
5 # Overwrites fre space on a disk.
6 # Should be run as root to overwrite super-user reserved space.
8 [ -z $1 ] && { echo "Syntax: $0 directory" ; exit 1; }
10 wdir=$1
11 [ -d $wdir ] || { echo "$0: $wdir: Not a directory" >&2; exit 1; }
12 [ -w $wdir ] || { echo "$0: $wdir: Need write access to this directory" >&2; exit 1; }
13 datafil=$wdir/wdata.tmp
14 count=1
16 while :; do
17 echo -n Creating $datafil...
18 head -c 1234157 /dev/urandom >$datafil
19 echo OK
20 echo -n Filling disk...
21 cat <$datafil >>$datafil 2>/dev/null
22 echo OK
23 ls -l $datafil
24 echo -n sync...
25 sync
26 echo OK
27 echo -n sleep...
28 sleep 5
29 echo OK
30 echo -n Removing $datafil...
31 rm -fv $datafil
32 echo OK
33 echo ==== $count wipes done ====
34 echo
35 count=$[$count+1]
36 done