1

Today is my last day at a job and I want to wipe the hard drive before I leave. It doesn't need to be insanely randomized or anything, just delete the os and most data. I'd rather not have to download, burn, and boot a LiveCD.

Is there a way to wipe the hard drive while booted? I realize this will crash the os at some point, but that's okay :)

1
  • You can use a magnet. A small one will do the trick. Oh! Yes... it will damage the whole hard disk drive's ability to read/write and probably will also harm it at a physical level. Is that what you expect? If so, I suggest you to open an already broken hard disk drive. You'll find 2 excellent magnets in the movable section of the head's base. These magnets are stronger and smaller than conventional magnets. :D Ok, Maybe I shouldn't post this but it seems you need something fast and reliable to wipe your hard disk drive. And this procedure works. The rest is collateral damage. Apr 12, 2014 at 3:10

4 Answers 4

2

dd allows you to write data directly to a block device, but doing so to a physical device requires root.

sudo dd if=/dev/zero of=/dev/sdX

Change the X to whatever drive you wish to wipe, and use either sd or hd, depending on your disk type.

This doesn't really protect your data though. Anything in memory could still be read (in theory) by your employeer.

I can't think of a use case where destroying your data would be that critical. With that said, I've turned in plenty of laptops where my goal was to destroy my PERSONAL files like my KeepassX databases, and for those cases, I'd suggest focusing only on your personal data and using GNU Wipe (sudo apt-get install wipe -y). This will let you overwrite your file content and then renaming them so they shouldn't leak data just by name.

But ultimately, any adversary that has physical access to a machine that's powered on should be assume to be able to get some information from that machine. A more secure method would be booting from a LiveCD so that none of your data is loaded as the machine is powered on.

Additionally, make sure to encrypt your laptop (including swap, which might leak information unencrypted) at your next job.

EDIT: Corrected a typo that specified sda rather than sdX.

0

In short, NO you cannot delete the boot disk while it is Mounted....

1
  • 2
    That is not true at all ;)
    – Panther
    Apr 11, 2014 at 22:08
0

I'm not sure what you intend is ethical, but I would suggest dd. Something along the lines of:

sudo dd if=/dev/zero of=/dev/your_favourite_sda_device

should work just fine. It seems that you need root privileges, but I'm not sure that it matters whether the partition is mounted or not.

1
  • You need root privileges. Apr 11, 2014 at 22:08
0

I'm not aware of any methods for deleting a drive while an operating system runs from it (at least not in it's entirity), but cloning your OS to a ramdrive could be a potential work-around. Once booted into the ramdrive your host system drive can be low level formatted using dd.

Steps:

Step #1

In terminal type:

sudo mkdir /workingfolder

sudo -i

sudo rsync -a --delete --one-file-system / /workingfolder --exclude=/workingfolder

Step #2

In terminal type:

sudo apt-get update 

sudo apt-get install squashfs-tools 

sudo apt-get install live-boot

Step #3

In terminal type:

sudo mkdir /live

Step #4

In terminal type:

sudo mksquashfs /workingfolder /live/livefs.squashfs

Step #5

In terminal type:

gksu gedit /etc/default/grub

Change "GRUB_TIMEOUT=10" to read "GRUB_TIMEOUT=-1".

Step #6

In terminal type:

gksu gedit /etc/grub.d/40_custom

Add the following to the file and save it:

menuentry "Ramboot" {
 set root='(hd0,1)'
 linux /boot/vmlinuz-3.11.0-12-generic boot=live toram=livefs.squashfs
 initrd /boot/initrd.img-3.11.0-12-generic
}

Keep in mind that the text specifying your kernel must match what you actuall have so you may need to browse your "/boot" folder to see what # you have. The numbers I've used are for Lubuntu 13.10.

Step #7

In terminal type:

sudo update-grub

Step #8

Open gparted, right click on your swap partition, and choose "swap off". Now delete the paritition.

Step #9

Reboot the computer and choose "Ramboot".

Step #10

In terminal type:

sudo -i

dd if=/dev/zero of=/dev/sda

It's important that you use "sudo -i" rather than "sudo dd" whenever working with dd to avoid interuptions. Also you should not have any mounted partitions on the drive being erased.

Step #11

Shutdown. Your hard drive is now erased.

Notes:

Note #1 = If your installation has several gigabytes of software installed you may need to uninstall some before proceeding.

Note #2 = If you have several gigabytes of data on the root partition (eg: in your home folder) you will need to delete it before beginning, or use the "-ef" flag when creating the squashfs. Eg: "mksquashfs /workingfolder /live/livefs.squashfs -ef /home/username/somethingtoexclude".

Note #3 = It will take a while to create the squashfs, and then a very long time to format the drive.

Note #4 = This is just a quick-n-dirty way of doing this. You should not use this approach for creating squashfs files you intend to ramboot for regular use. Normally you should create a squashfs file from another installation to ensure ALL files are copied.

Note #5 = I tested this on Ubuntu 12.04 - Desktop X86-64, but I didn't bother waiting for the hard drive to totally zero out.

Sources:

http://blog.sleeplessbeastie.eu/2012/05/02/ubuntu-boot-to-ram-couple-of-notes/

h#t#t#p#://askubuntu.com/questions/253096/low-level-format-of-hard-drive

http://postbin.djun.net/pages/article16/page.php

Additional Information:

While I don't know if it's possible an alternative to the above approach might be simply adding an entry for the initrd in grub, booting into it and running dd from there. However I don't know if this is possible, or if dd is installed in the initrd? However if it is this would be an equally affective method, and faster since you don't have to generate an image first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .