Accidentally deleted /dev directory

I’ve accidentally performed

sudo rm -fr /dev

Will I suffer from data loss or any side effects?

I’ve rebooted the system and my data seems ok, but I’m afraid there is hidden or non-obvious loss of data that I simply haven’t found out yet.


I’ve read this post but didn’t get sure enough that no data loss happened; I need to be more sure.

Asked By: ibrahem


No. Look at the output of mount: you’ll see that a devtmpfs (or devfs) filesystem is mounted there. In other words, all the device nodes you see there aren’t stored anywhere "permanently". This is just a pseudo-filesystem that your software (the userland in cooperation with the kernel) populates with devices nodes that you can use to get handles to devices.

In other words, not only is /dev re-populated every boot, also, it’s just used for getting handles. It’s not the actual devices, nor the actual data on the devices.

The good thing is that you henceforth probably think twice before you hit enter on a sudo rm -rf, and no real harm was done 🙂

Answered By: Marcus Müller
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.