Monday, May 31, 2010

redrum a distro: rm -rf /Fedora13

Some discussion recently came up as to what the outcome of a "rm -rf /" would be on a Linux machine. It's been ages since I last tested, and at the time there was no LVM in use, and /dev was actual nodes instead of a virtual filesystem. So, I was installing Fedora 13 64bit to test some hardware out and couldn't resist "seeing what happens". Needless to say, its not going to be an outcome that is pleasant, but academically interesting perhaps. If you don't know what the command does, don't execute it! And probably, don't even if you know what it does ;)

Also, I ran this from a gnome-terminal under a normal graphical session.

The filesystem layout was:


Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_test-lv_root
51606140 3111784 45872916 7% /
tmpfs 769704 548 769156 1% /dev/shm
/dev/sda1 495844 28538 441706 7% /boot
/dev/mapper/vg_test-lv_home
560152184 203192 531494900 1% /home


The home partition still contained /home/whiteele/.gvfs and the root lvm had var/lib/nfs/rpc_pipefs and empty boot, dev, home, proc, selinux, sys directories. But other than that everything else was eaten by the rmrf. Oh yes, and you have to supply the --no-preserve-root option to ensure the rm command that you know you are being silly.

No comments: