Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
Another extra preventative step that was suggested: reinstall the OS using the VPS tools. –  Mike B Dec 30 '12 at 1:25
add comment

4 Answers 4

up vote 4 down vote accepted
  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.

share|improve this answer
    
One minor and seemingly obvious note to mention in case others use this - the cat /dev/urandon > /bigfile command will have the file grow indefinitely so admins should monitor the growth and terminate the command when the file has reached a sufficient size to cover the data. –  Mike B Dec 30 '12 at 16:47
1  
The intention here is to fill the volume: cat will exit once it runs out of space. If the volume being completely full for a time is a problem (it won't be in this case as we are talking about decommissioning) then create a file of a few hundred Mb first, shred that, create the huge volume filling file, then delete the small file before shredding the larger one. –  David Spillett Jan 2 '13 at 11:44
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
1  
You want to add an extra step there and shred the contents in "free" space too. The content of deleted files lives on until it is actually overwritten by something. –  David Spillett Jun 29 '10 at 0:04
2  
You can also just shred the device directly, as in shred /dev/sda1/ or shred /dev/sda. This will overwrite the entire device. I recall that about ext3 too, but the current shred manual states "In the case of ext3 file systems, the above disclaimer applies (and shred is thus of limited effectiveness) only in data=journal mode, which journals file data in addition to just metadata. In both the data=ordered (default) and data=writeback modes, shred works as usual." –  JAL Jun 29 '10 at 0:15
add comment

Ask the staff; some hosts will keep backup snapshots of their volumes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.