How can I completely delete the contents of my old VPS?
Ubuntu 9.10 | VPS
I'm getting ready to stop using my old VPS host (linode) and am a little concerned about my old data remaining on the VPS. Is there a command I can run from the command-line that will delete most of the old data permanently?
And yes, I've already collected backups. =)
-M
Solution 1:
- Remove as many files as you can either using
shred
or just plainrm
. - Create a large randomish file over all the space with
cat /dev/urandom > /bigfile
- Wipe this with
shred
(how many iterations you run is up to you unless you have some very sensitive information there you might just useshred /bigfile -n 0 -z
to zero the newly randomed space. - Repeat steps 2 and 3 for each file system, unless your setup was all on one filesystem.
One massive caveat though: you are only affecting the space on the physical media that your data resides on at this moment. It may have been elsewhere entirely yesterday because the host decided to reorganise the LVM volumes/groups the data is on, or perhaps your VM was moved from host to host as part of a load re-balancing exercise, and the host may well have backups in several places as part of the standard disaster recovery plans (so if the host machine died catastrophically they could restore your machine from the last known good backup).
The only true way to ensure data is unreadable is to make sure it starts out unreadable by using a strong cryptographic filesystem (or any old filesystem on a strong encrypting block device) and keeping the encryption keys properly safe (i.e. not stored anywhere near the encrypted content itself). Unfortunately you can not do this from your current position unless you have access to a time machine as the data is already there (and possible elsewhere) unencrypted.
Solution 2:
Have you asked the Linode staff what their recommendations are? In my experience, they're very responsive and will be most honest and forthright in their response.
Linode makes available the Finnix rescue image on all accounts. You can grant that image access to your disk images in LPM, boot up Finnix, and then use the steps outlined in the other answers to do a secure wipe of your filesystems.