I want to empty out all the data on a partition. What is the quickest way to do this? It is an Amazon EBS volume if that matters.
I want to empty out all the data on a partition. What is the quickest way to do this? It is an Amazon EBS volume if that matters.
It all depends on how much you want the data gone. If you just want to avoid having to sit through a lengthy
rm
, then a reformat (as suggested by Sysadmin1138) would do the trick. If you'd prefer not to have to worry (too much) about the data still being accessable, then being an EBS volume you can just unattach it and attach a new one, and let Amazon worry about wiping it. If, on the other hand, you really want to make sure that data's gone and don't trust Amazon to do it, then you'll need todd if=/dev/zero of=/dev/blah
to obliterate it yourself.Then we're into the world of hardware forensics, which if that's a worry for you, you really made a mistake going to the cloud.
Very briefly:
The basic concept here is that by formatting the partition, you get rid of everything on it really fast. I chose xfs here because it formats really fast versus ext3/4.
Here's something easy, but can take a while for lots of files, and the deleted files can be recovered from the block device until they are overwritten:
Here's something quick, but as above, does not necessarily make your data unrecoverable:
Replace "ext4" with the file system of your choice (I prefer xfs as it is fast). Remove "sudo" if you are already root.
If you care about making sure that nobody can access the data you had on that volume, the most complete solution would be:
This process trusts Amazon to wipe your old data before letting anybody else use those disk blocks (pretty standard). If you want to take more care, you should encrypt the block device before using it.