How to destroy a filesystem

rmrf

The G1 ‘execute every command you type‘ bug naturally spawned ‘rm -rf /’ jokes. rm is the Linux command for deleting files. The -r and -f flags will cause it to remove files recursively and ignore confirmation. Executed as root it will annihilate the entire filesystem. Won’t it? [Jon Hohle] decided to test exactly how destructive the command was to *nix systems. How functional would the system be afterwards? He tested it side by side with the Windows equivalent, both ‘format c:’ and ‘del /F /S /Q’. He wanted to see what protections were available and what would be left working. Linux ended up completely broken while Windows, thanks to file locking, actually shutdown cleanly… and never came back. Some OSes, like Solaris, refuse to run the command ‘rm -rf /’ to prevent accidents.

29 thoughts on “How to destroy a filesystem

  1. Strange, I tried to format the system drive on a windows machine that I was decommissioning one time and I seem to remember windows refusing to allow it to run, even under an administrator account… this was under NT 4.0 I think?

  2. I tried this on my Ubuntu system (I was going to do a reformat upgrade to 8.10 anyways, so I decided to have fun with my existing install) and it deleted a lot of stuff (first my desktop icons, then my background, then other stuff) but it never completely destroyed the system. I was quite sad, I thought it’d be a nuclear meltdown and instead just a few user files deleted.

  3. Kinda reminds me of messing with department stores by typing format C: /autotest
    I don’t know that autotest still works though.. last time I tried it was on win98 :)

  4. The solaris story mentions, that they got standards changed. Now I’m really tempted to check if my systems are compliant… Must no!@#$% CONNECTION LOST

  5. Unfortunately formatting the system drive doesn’t work on any version of Windows :(

    To be honest it really is shocking that other OS’s haven’t implemented proper compulsory file locking, since it adds quite a lot to the reliability of a system if it’s binaries can’t be patched/overwritten/upgraded while they’re executing.

  6. “I tried this on my Ubuntu system … just a few user files deleted.”

    Sounds like you forgot to do “sudo rm -rf /”.

  7. newer versions of Solaris may refuse, but SunOS 4 would cheerfully execute rm -rf / – DAMHIKT (yes, you can do it accidentally, if your typing is sufficiently bad).

  8. I actually did this once, completely on purpose (ubuntu), meaning to mount and cp another filesystem in.. turns out mount and cp were both deleted, game over.

    Got it back up and running from a livecd though.

  9. I once fell from my chair and right onto the return button while typing an rm-command, and sadly it said “/” at the time of my mishap. but lucily, my old iBook was so incredible slow at deleting (encrypted filesystem and two digit load average :D), that it barely emptied /bin.
    thankfully, the shell was still in memory (although deleted from disk), so I could copy the essential files from another computer.

    What struck me as odd was, though, that dpkg/apt-get does not seem to have any kind of “repair”-functionality, that looks through the installed packages file lists, and in case of missing files/wrong checksums for binaries etc, does a reinstall. I had to figure out the broken packages manually, and dpkg -r –force them away, only to reinstall them again.

  10. The windows equivalent would be rmdir not del, del as is shown stops dead on locked files.
    I wonder how many decades it will take before people will get familiar with rmdir, and other ‘new’ commands introduced after win98..

  11. Is this such a big surprise? When you delete important shit, other important shit dies….

    Sure, OS’s such as Windows have protections against it, but for Linux/Unix/BSD its just a way to cull the idiots…

    Hardly hackaday.com quality… Hell, hardly digg.com quality.

  12. @Mattos:

    Linux (and presumably other Unicies) load their binaries to memory on execute, so it doesn’t matter if they’re deleted. Also, files aren’t actually unlinked until all handles to them are closed.

  13. using fdisk to delete the partition may not be a single command but you can run it on a windows system drive without any problems

  14. This article is full of fail.

    Who the hell approves this shit? if anything.. it’s proof you’re all either Windows users or Ubuntu zealots.

    “Linux would not continue with the command until the root password was entered.”

    Wrong. You don’t enter your root password, you enter your users password.

    Deleting all the files in ones C:\ drive is not the equivalent of rm -rf / under Unix, for one, multiple drives are mounted under / on Unix.

    Anyway, notta-hack god dammit! ban these idiots from posting stupid stories already!

  15. Yeah this isn’t exactly a “hack” it reminds me when I trashed the “macintosh hard drive” on an old school machine running like 5.0 mac os or something and a stupid security program that all you had to do was unclick “guard” in control panels. Boy the computer did not like that. It was funny seeing the computer person trying to fix it. All that would show up was the infamous bomb logo in the white box.

  16. what i want to know is which system was easier to restore back to normal. Not reinstal, but repair. I’m betting the linux one could be easily repaired via a live-cd.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s