User:Tegan

From BitFolk
Jump to navigation Jump to search

Jamie Stallwood <hostmaster@project76.net> Homepage

Securely erasing a server BEFORE shutting down, I installed cfdisk to get the size of the disk: cfdisk /dev/xvda. You can do the same thing with fdisk and using the option p to show the partition table.


It told me I had 255 heads, 63 sectors/track, and 2039 cylinders. Multiply these together gave me 32756535. A sector is 512 bytes, and 32756535*512 = 16,771,345,920 (which is just larger than the size of my partition, because you have to deduct the Master Boot Record!)


In the rescue console, I could use the random number generator to generate garbage, and write this directly to the disk. The command below does exactly that, and then gets the PID of the running process, poking it regularly to get an updated status:

sudo dd if=/dev/urandom of=/dev/xvda bs=512 count=32756535 & pid=`ps -A f|grep dd|grep -v grep|cut -c1-5`; while true; do sudo kill -USR1 $pid; sleep 10; done


Note the 32756535 which we worked out earlier.


After some time:

32756535+0 records in

32756535+0 records out

16771345920 bytes (17 GB) copied, 3805.13 s, 4.4 MB/s

[1]+ Done sudo dd if=/dev/urandom of=/dev/xvda bs=512 count=32756535