Shootout: 'rm -Rf /' vs. 'Format C:'
skyshock21 writes "There's an article over at hohle.net about what actually happens when you type the commands Format C: in windows versus rm -Rf / in Linux. Very interesting results indeed. Myths are busted, and hilarity ensues."
I prefer the magnet or throwing the disk out the window.
openbsd has rm -P which will overwrite the bytes of the 3 times
Well, without the verbose/interactive flag, it's quite more dangerous the 'rm' approach, still the word 'format' itself it is, subjectively, less musical than 'remove'.
would be 'mkfs /dev/hda1' vs 'format c:'
http://www.dealsites.net/wrap.php?file=hohle_post. htm
they apparently did a rm -rf / on their webserver..
i'll go back to laughing at the election results. or was it crying, i cant remember now.
In the article he mentions sudo asks the root password, while it's actually asking the password of the user performing the sudo ! So I guess he must have set the root password identical to his user password during the installation.
Talk about trying to kill a simple joke, for all the braindead: it's the intention of the commands that is funny, not typing the command (well that too if it would work but only del *.* in real dos works and that was pretty much the original joke I guess).
To remove this comment press F4 on windows...
And FP btw
this comment is provided "as is" and without any express or implied legibility or congruity [...]
rm -Rf / removes all the files mounted on the file system. format c:\ rewrites a new file allocation table.
The issue of Linux not running as cleanly after all the files are whiped out vs. Windows still able to run isn't much a means of stability. Remember in Linux/Unix systems, Everything is a file. While in windows it is some hodgepodge framework where some are files and other are not. So naturally if you wipe out all the files on a Linux/Unix system problem will happen. While windows which puts a lot of its features in memory and stayes there so it can still operate even after you logout. In some ways having X windows crash after you try to leave is a good thing because you know that something is wrong sooner. vs. Windows just acting like nothing happend.
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
You never know - he might do it. This time he has popular support.
In Soviet America the banks rob you!
I once saw an errant script run as a cron job (I DIDN'T WRITE IT, DAMN IT! WHY DON'T PEOPLE BELIEVE ME!!!) execute "rm -f *" in root AS root once. No big deal, right? What if someone accidentally (IT WASN'T ME!!!) created a file called "-r" in / two years prior to the errant rm? Hmm? Now what happens if you have nearly two terabytes of data mounted rw without root squashing via NFS on that workstation? Now what happens if that runs on a Saturday night and nobody notices until Monday morning?
I'll tell you what happens. What happens is that the next several days are very, very, very long and very, very, very uncomfortable.
-- Minds are like parachutes... they work best when open.
format c:
/" in Linux. Besides noting how effectively I could trash the system, I wanted to see how the operating system responded, and what it took to be able to destroy the system. I know that "format c:" and "rm -Rf /" aren't equivalent, but they usually are interchangeable punchlines to jokes, which is why they were chosen.
/FS:NTFS" command, in Linux "rm -Rf *".
/F /S /Q *". Linux was a no brainer. All I had to do was escalate my permissions with sudo, "sudo rm -Rf *" to be exact.
There's a nerdy idea floating around that you can tell an uninformed Windows user to type "format c:" in the Run dialog to solve their problems. This is perpetuated in office jokes and comics among other places, but how many people have actually tried to destroy their using "format c:".
I made a goal for myself to find out what would happen if I ran "format c:" on a freshly installed Windows system and decided to compare it to the equally notorious "rm -Rf
Read more for the destruction of two perfectly good operating system installations.
My target OSes were Windows XP Pro and Ubuntu Linux, both with all the latest and greatest updates. The installs were both fresh and no additional security settings had been set. Ubuntu asked me for a password during installation, Windows did not, which we will see makes a difference later down the line.
First I established a baseline for my environment: a virtual shell parked at the root of the file system (C:\ for Windows, / for Linux).
Windows Linux
Larger Image Larger Image
Well, that was simple enough. Getting to each file system's root was a nearly identical process. Now is where things will change, however. In Windows, I am going to attempt to format the drive, a low level operation which usually occurs on drives not being used and in Linux I am going to attempt to remove all of the files from the filesystem. Both should give me an empty file tree when I'm done, but come at it from different angles. In Windows, I use the "format c:
Windows Linux
Larger Image Larger Image
Thankfully, and as I expected, neither of these commands wiped out my filesystem. To my shock, Windows looked as if it was going to comply with my wishes. It asked me if I would like to proceed and I confirmed that indeed I would. Ah, but as I expected, the drive was mounted and could not be formatted until it was unmounted; so I told it to try to forcefully unmount the drive. Finally it told me that it could not gain sole access to the drive and would not continue. So, straight away "format c:" will not erase your hard drive! Now how did Linux fare? Also, as I expected, almost nothing was deleted by my "rm -Rf *". My personal home directory (~/jonathanhohle) might have been erased, I didn't think to check it before I moved on. All in all, however, both systems were still up, stable, and in need of more abuse!
Windows Linux
Larger Image Larger Image
Larger Image
Larger Image
My goal was to mass erase these disks from the command line and so far I hadn't had much luck. With Windows I knew I was going to have to take a different approach, with Linux, I knew exactly what I had to do to kill this system.
I decided to attack Windows from the same attack point as I was hitting Linux. Instead of trying to do a low level erasure of my files I was just going to recursively delete them. So after a little mucking around at the command prompt, I came up with "del
Windows Linux
Larger Image Larger Image
Well, that did the trick on both systems with one caveat. As the first Linux screenshot under this paragraph shows, Linux would not continue with the command until the root password was entered. Windows, on the other hand had no problems going to town unlinking files after the [Enter] key was struck.
Windows Linux
Larger Image Larger Image
Afte
I thought it was pretty interesting that it took so much longer to delete everything under windows/NTFS. Anyone know why this is (is NTFS slow, or is it the del command as the author guessed, or is there some other reason for this).
Famous Last Words: "hmm...wikipedia says it's edible"
Seriously folks,
..
this proves almost nothing.
This guy really needs to find something better to occupy his time with, ideas include polishing the spoons, re-arranging the sock drawer and cleaning the fridge.
We all know the best way to screw a Windows XP SP2 user is to convince them to turn off the firewall
mod me down, see if I care
Comment removed based on user account deletion
He's got my vote!
Now pass the freedom fries!
3. Profit!
2. ???
1. On Soviet Slashdot, a Beowulf cluster of alien Natalie Portman overlords welcomes YOU!
I like to use "shred /dev/hda". That takes time but it is worth it if you know you will never use that hard drive again, such as when you leave a company. If you are in a pinch, you can first do a "cat /dev/zero > /dev/hda". You can also use "dd" or "sdd". If you want to erase a magnetic medium, zero out the media first and then use "shred".
I'm pretty sure they removed deltree from winXP.
This post written under Gentoo-linux with an SCO IP license.
Only to idiots, are orders laws.
-- Henning von Tresckow
was the message I got after trying to logout of a similarly trashed Debian Woody system.
From: "Solaris 10 has (since build 36) a version of /usr/bin/rm (/bin is a sym-link to /usr/bin on Solaris) and /usr/xpg4/bin/rm which behaves thus:
[28] /bin/rm -rf /
rm of / is not allowed
[29]"
... this one, I mean. And I'm convinced it is one of those Magic Eye things.
Rome wasn't bilked in a day.
>su >dd if=/dev/zero of=/dev/hda Works every time for me!
It amazes me how often I see people trying to seem 7331 by saying shit like, "Just rm -rf
I'm not even a system administrator, but even I know that any admin worth their salt knows to type the flags after the destination, ala:
rm / -rfv
or
rm
This way, if you accidently hit return before typing the full path, you will be prompted for confirmation, since you didn't get to the part where you type the "-f" flag.
Microwave the drive... works everytime. If the room is dark, you're in for watching some serious fireworks!
...use the shell's built in file expansion:
echo *
I don't know half of you half as well as I should like, and I like less than half of you half as well as you deserve. BB
Humor can be dissected as a frog can, but the thing dies in the process and the innards are discouraging to any but the pure scientific mind.
E. B. White (1899 - 1985)
It seems that the author misunderstands an important part of the Unix philosophy:
That's far from true. Linux locks the executable file, i.e. if you attempt to open it for writing, you get an error. You can, however, remove the directory entry, in which case the file is retained as long as the program is still running.
Under Linux, a file can have zero, one, or more directory entries (a.k.a. hard links). It's not possible to remove files, only directory entries can be removed. The kernel removes the file automatically once two conditions are fulfilled:
In fact, under Linux the /proc filesystem allows it to get the contents of an open file back even if it has no directory entries outside of /proc.
Its not so hard to run either windows/DOS or linux in a VM with debug/trace turned on, logging all, for analysis. Its not something that 'takes a lot of time', just a bit of effort.
.. guess i'll go read the article now..
the beautifulness of this article (which i haven't read) is that it (probably) frames the difference between two OS's on the basis of 'stupidest luser thing to type', and thus is interesting to
; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
Back in the '80s, my boss had one of the first PCs in the building with a hard disk. One day he asked me to copy some files off onto a floppy, so I put the floppy in the drive and typed "format", as I was used to doing...
C:>FORMAT
Insert floppy into drive C: and hit return.
The rest is history. As was everything on the drive.
I tried some similar expressions recently:
/FS:KERRY
format c:
rm -Bush *
The results were very telling. Both candidates made about 5,000 prompts all on the order of "5 more years?:" and "The American people will pick the right man for 5 more years?:". As most of these prompts were gibberish, I responded in a random fashion.
In the end, the files of the Bush system remained on the system, but still functioned poorly and continued to periodically core dump.
What amazed me on the Kerry system was that the files actually wrote over themselves many times before all simultaneously deleting!
All in all, the process took about 7 months and I can honestly say that I hope never to have to do that again. Further more, based on how both operate when active, I would like to see a completely new category of OS if I do have to go through this again.
Hunger is the best sauce.
He notes that "dir" is a built-in and "ls" is an external, so he could get a directory in windoz, but not on linux. Thats wrong, he could have used "echo *" on linux to get the directory listing.
Szo
Red Leader Standing By!
Ok, I've just finished installing Linux on a fresh hard drive and have spent a few hours editing stuff in /etc using my favourite editor joe. The editor creates backup files everytime it overwrites a file, naming them as the original filename with a tilde appended. I wanted to quickly remove all the backup files so I typed
But curses, my caffeine-overloaded fingers were too quick to hit that spacebar and I ended up with AARGH! There goes BOTHCause wildcards aren't actually recognised by the kernel. It's entirely up to your shell what characters are used as wildcards, so why should the kernel discriminate against weird shells by only recognising the wildcards used by the bourne and C shells? Or should they just outlaw anything that might be a wildcard? What if I wrote a shell that used 'e' as its wildcard? :)
Site was /.-ed (well, what a surprise). Please, use MirrorDot. This particular story (with full images) can be found under this link.
Anyway, the comparison is good. But how about comparing mkfs with format c:?
These methods are pretty good ways to kill a system. However, I found that a large electromagnetic field generated by an old bulk eraser produces similar results in just seconds! Man, was my cube mate pissed!
I don't have screenshots, though. I think I'm sterile, too.
I might know what I'm talkin' about, but then again, this is Slashdot...
I believe he is wrong. Firstly, everyone knows how dogg slow EXT3 is at just about everything.
There is an easy fix for this -- just don't have massive amounts of text scrolling through a windowed command prompt; minimize the window, pipe the text to a file, or even make the command prompt full screen. Any of the above tricks will dramatically speed things up, as the CPU is no longer spending large amounts of its time writing text to the screen.
If anyone out there is feeling adventurous (or insane), go ahead and try to replicate Jonathan's test -- only don't leave the command prompt in windowed mode. Minimize it or redirect the text. I'd bet you my ex-girlfriend's right arm that NTFS is suddenly as fast as, if not faster than, EXT3.
/dev/random
I don't know about you, but I believe in the sysadmin credo, do as little work as possible.
Therefore, any competent sysadmin would never use rm -Rf, they'd use rm -rf, that R takes a lot of effort for me to move my pinky to the shift key.
*sheesh*
He was already in Gnome
Understanding is a three-edged sword. -- Kosh Naranek
We used to login as root and type 'rm -r' into the console WITHOUT pressing Enter.
We then took turns at throwing stuff at the keyboard to see if we would just-so-happen to hit the Enter key.
Luckily, none of us were very good shots...
RM
I have no sig yet I must scream.
The problem with the tester's premise is that he is from the wrong era. These punch lines originate from 20 years ago. In those ancient days of computing, the commands did indeed allow a user to effectively (in the case of UNIX) or completely (in the case of MS-DOS) wipe out their file system.
I speak from personal experience on both OSes; 20 years ago, when both OSes were still young.
A fair test of these punch lines can only be executed on MS-DOS 1.x and on one of the *many* UNIX varients from the mid-1980s.
Along the same lines, I had at one point a link "~achurch" in my public_html directory, for compatibility after my homepage changed URLs. So (you can guess what comes next, I'm sure) I decided one day, several years later, to clean up my web stuff:
$ rm -r tmp/ x.html [...] ~achurch/ /home/achurch/.xcdroast? _
rm: override permissions 000 for
I have no idea why mny .xcdroast was 000, but it saved me a huge amount of frustration. I now place a file "..norm-r", mode 000, in important directories and rename things around to make sure it's always first in the directory file. And I never, ever use -f.
You want your data really gone... Follow these rules... The DOD rules for HDD disposal. 1. Triple Overwrite security erase. 2. De-gauze with a powerful electro magnet. 3. Crush drives with a cement roller. 4. Melt fragments into slag. 5. Bury Slag in a secure waist disposal site under a minimum of 6' of cement.
Get your torrents...
simmer your drive for 40 minutes on high heat till tender. Add taters, carrots, celery. spices. Remember to Floss now.
Sorry about the writing. Robot fingers, you know? Cliff Steele in DOOM PATROL #23
A very unbalanced comparison:
/dev/sda0
Format c: is more analogous to mkfs
rm -Rf / is more like deltree c:
and IIRC the Windows del command waits 5 seconds on each busy file before giving up the delete, making NTFS deletes on busy files seem very slow.
Let's at least do our meaningless comparisions correctly!
I once did a recursive rm -rf / as root on Slackware linux. After it completed I tried to log out and all I got was a message that said:
"You don't exist, go away!"
Very amusing.
Anybody know which Linux package is responsable for this message?
You can unmount an ext3 file system, and remount it as an ext2 file system. Then you'll get known in-situ overwrites. But if you didn't increase the length of a file, there's no reason for the OS not to write it back right where it used to be, so sync ought to force it to complete the operation. Although some of the writes may be optimised away.
..... For one, the authorities would like to pretend they can recover data even if they couldn't {even if only to give plausible deniability to some of their operations; they'd prefer you to think they got that data from your used hard disk than to find out how they really got it}. For another, HDD manufacturers sell more new units if there aren't so many second hand ones on the market. And for the kicker, if it can be shown that the Government has been needlessly destroying valuable goods bought with taxpayers' money, it's going to be every lawyer's birthday at once.
And I'm not so sure about the viability of recovering overwritten data anyway, even with electron microscopes and whatnot. Let's face it, if it was at all practical, someone, somewhere would have used the techniques to build a high-capacity drive that worked by storing new data "over the top of" old data, and there'd be a fanfare of press releases about it -- and no end of debate on Slashdot over whether the patent was enforcible.
Microscopic techniques might have worked once with low density devices, but today's drives can easily pack 2000x as much information into the same amount of space as was common just 10 years ago. It's my assertion that all claims regarding the recoverability of overwritten data are hopelessly exaggerated if not absolute bullshit. I'd like to see a proper scientific study, but I have a feeling there are more compelling reasons not to do one
Je fume. Tu fumes. Nous fûmes!
To verify this, try the following as root. Don't worry, this is safe.
# dd if=/dev/zero of=dump bs=512 count=1000
# mke2fs dump
# mkdir dumpdir
# mount -o loop dump dumpdir
# mke2fs dump
And you shall get this:
mke2fs 1.35 (28-Feb-2004)
dump is not a block special device.
Proceed anyway? (y,n) y
dump is mounted; will not make a filesystem here!
However, if you issue a
# mkswap dump
You'll be happily notified:
Setting up swapspace version 1, size = 507 kB
Done. ;)
People who dislike China tend to mention Tiananmen Square a lot, but they always forget the Tank Man is also a Chinese.
This usenet article on how a partially deleted filesystem was restored with some ingenuity makes an interesting read.