How can I completely delete the contents of my old VPS?

Solution 1:

  1. Remove as many files as you can either using shred or just plain rm.
  2. Create a large randomish file over all the space with cat /dev/urandom > /bigfile
  3. Wipe this with shred (how many iterations you run is up to you unless you have some very sensitive information there you might just use shred /bigfile -n 0 -z to zero the newly randomed space.
  4. 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.


Solution 3:

First, mount all your ext3 partitions as ext2. This will disable using the journal so that you can destroy things properly. This can be done by editing /etc/fstab and changing all instances of ext3 to ext2 and then rebooting.

Then use find together with shred to destroy and remove the contents of /var, /srv, /home, /root, /usr/local, and /opt.

find /var /srv /home /root /usr/local /opt -depth \( -type f -exec shred -f -z -u {} \; -o -type d -exec rmdir {} \; -o rm -f {} \; \)

Then destroy your volumes in the control panel.