« What not to say... | Main | Timing.... »

November 10, 2005

Recreate /dev/null

If for some reason you have lost your /dev/null you can easily recreate it by moving a file to /dev/null as root. Another way is to just recreate the soft link (as root again):

devlinks

But if you have messed up the original device in /devices proceed as follows:

mknod /devices/pseudo/mm@0:null c 13 2
chown root:sys /devices/pseudo/mm@0:null
chmod 666 /devices/pseudo/mm@0:null
cd /dev
ln -s ../devices/pseudo/mm@0:null null

Posted by Ozguru at November 10, 2005 06:00 AM

Comments

Can I ask how you lose your /dev/null? I'm yet to do it, not that I've ever tried. Do you send it to the bitbucket?

Posted by: Dave at November 10, 2005 05:12 PM

I think "rm /dev/null" would do it :-)

Actually I seem to remember a newbie doing his "rm -rf *" in /dev and causing this. I have also seen a badly corrupted disk destroyed by fsck (under solaris 2.0 or 2.1) which removed most of /dev.

Posted by: Ozguru [TypeKey Profile Page] at November 10, 2005 09:12 PM