Let's say theoretically, I've been using a cloud server instance (such as an AWS EC2 Linux instance) and I want to delete the instance, but before I delete the instance I want to purge ALL the data that is currently on the server before I delete this instance. Can this be done by simply performing a rm -r -f /* command? I've used this before, and I would think that it removes EVERYTHING (even to the extent that one would no longer be able to login via SSH anymore). Does this really remove everything? Or does it only appear to remove everything? Since all the commands in the /bin directory are gone at this point, I can't see what's left over. So I'm just wondering, by the time the "rm" command removes itself, would everything else be deleted?

  • There are a few general questions about rm -rf / on the site that someone will be along to note as duplicates soon, but note also that "deleting" on these sorts of servers may mean even less deletion than on local hardware. It's unlikely to get any more deleted when you delete the instance either way. (This may or may not mean that the purported duplicates aren't, depending on specifics) Commented Jun 23, 2019 at 22:15
  • While your shell is still running you've got cd and echo commands, so you can (for example) cd /bin; echo * to see what's there. Commented Jun 23, 2019 at 22:18

1 Answer 1


Even on physical hardware, rm -rf / will just unlink every file, not "delete" it in the sense that it wouldn't be possible to recover by looking at the contents of the hard disk with a disk editor or a tool like photorec.

On a cloud server, you often have no idea how the data is actually stored and what the specific effects of an rm command will be. Even dd if=/dev/zero of=/dev/sda or similar is not guaranteed to actually overwrite anything; for all you know, the zeroes could be written to new storage while the old one could live on in a snapshot, invisible to you but accessible to the provider.

If you're worried about the cloud provider recovering your data after you cancel your cloud server, you should encrypt the storage. Since the provider has access to the cloud server while it is running, they can still extract the encryption key (as well as any other data they want), but once it's switched off (and provided it's really switched off) it would be a lot safer than after any attempt to merely delete the data.

You must log in to answer this question.

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