[CentOS] In A UEFI World, "rm -rf /" Can Brick Your System

Gordon Messmer gordon.messmer at gmail.com
Mon Feb 1 22:58:54 UTC 2016


On 02/01/2016 02:46 PM, Valeri Galtsev wrote:
> Will doing
>
> rm -rf /
>
> actually delete anything in /sys? IMHO, not.

Yes, it will.  Probably.  It's possible that it'll hang on some of the 
files in /proc if it gets to that directory before /sys, but that's 
largely a matter of chance.

>   The above command first will
> get to removing /dev, and it will delete /dev/sda1 or whichever device /
> filesystem lives on. And after that the command will fail, as there will
> be nothing accessible under / on that system after device root filesystem
> "/" lives on will be deleted.

Access to your filesystems doesn't depend on the device nodes after 
they're mounted.  You can remove all of the nodes in /dev, and your 
filesystems remain available.  Spin up a VM and test it.  I promise, it 
works.

> And portion of /dev - whatever alphabetically is before
> root filesystem device.

rm doesn't process files in alphabetical order.  It processes them in 
directory order, which is unpredictable.



More information about the CentOS mailing list