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.

Comments

  1. poisomike87 says:

    i did that in operating systems unix2 at my college

    so much fun watching stuff crash and burn lol

  2. Johnny says:

    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?

  3. CalcProgrammer1 says:

    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.

  4. scoobywan says:

    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 :)

  5. aoeu says:

    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

  6. dandin1 says:

    On NT it might have told you that you must unmount the filesystem first. I myself was surprised by that very unix-sounding error message.

  7. realyst says:

    Looks like the webmaster tried it himself, the page is down :)

  8. O Mattos says:

    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.

  9. music says:

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

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

  10. Adam Ziegler says:

    Since when is “rm -rf /” equivalent to formatting a drive?

  11. funtimes says:

    dd if=/dev/zero of=/dev/sda

  12. MrChick says:

    We once got someone to try cat /dev/mouse > /dev/hda

    He swore to kill us, but he hasn’t done it… yet.

  13. joeuser says:

    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).

  14. issackelly says:

    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.

  15. pascal says:

    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.

  16. fucter says:

    issackelly deleted his mount and cp?
    i guess he can just go to 4chan and get more.

  17. Bryan Price says:

    As soon as it nukes sync, you’re done. So while destructive, it won’t take out the whole file system.

  18. Chris Hansen says:

    @issackelly:

    Why don’t you have a seat right over here?

  19. the_glu says:

    rm -rf dosen’t work. You have to use rm -rf –no-preserve-root / ;)

  20. Wwhat says:

    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..

  21. Da_Blitz says:

    find / -iname * -exec cat /dev/mem \> {} ;

    try this as root

    caches files in ram for faster access

  22. fragged says:

    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.

  23. @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.

  24. Bob says:

    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

  25. ragnar says:

    How exactly does that destroy a filesystem? It’s ext-3 (or whatever) before and after. It might destroy your OS, tho.

  26. aka-44 says:

    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!

  27. gilbert says:

    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.

  28. Andrew says:

    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.

  29. hackepapaz says:

    would this work on an iphone???
    if not what sort of command does Darwin accept to make it crash?? :D
    Would like to see the effect on an iphone :P

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

Follow

Get every new post delivered to your Inbox.

Join 96,660 other followers