1831061 Members
2546 Online
110019 Solutions
New Discussion

Recreating /dev/null

 
SOLVED
Go to solution
Timothy Czarnik
Esteemed Contributor

Recreating /dev/null

Hey all,

First off, this is a Unisys box running SVr4 (System Five, revision Four I think is how its said).

Anywho, before I got here someone had removed the file /dev/null and then created a regular file in its place. You can imagine the fun that this presents us from time to time :)

Are there any special circumstances surrounding this file that I need to be aware of in order to use the mknod command to recreate it? How do I find the major/minor number of this?

-Tim
Hey! Who turned out the lights!
7 REPLIES 7
Timothy Czarnik
Esteemed Contributor

Re: Recreating /dev/null

Hey all,

Found this post about this very thing...

http://us-support2.external.hp.com/cki/bin/doc.pl/sid=74dede071df77c4168/screen=ckiDisplayDocument?docId=200000024603238

Basically, its this:

To recreate /dev/null, follow these steps as a superuser:
# rm /dev/null
# mknod /dev/null c 3 0x000002
# chown bin /dev/null
# chgrp bin /dev/null
# chmod 666 /dev/null

Does this seem correct?

-Tim
Hey! Who turned out the lights!
Santosh Nair_1
Honored Contributor

Re: Recreating /dev/null

That sounds about right. I checked on my system and that's how its set up here.

-Santosh
Life is what's happening while you're busy making other plans
A. Clay Stephenson
Acclaimed Contributor

Re: Recreating /dev/null

Hold on Guys, this is an Unisys box. I would not assume that those are the correct major/minor device numbers without more digging.
If it ain't broke, I can fix that.
Timothy Czarnik
Esteemed Contributor

Re: Recreating /dev/null

Hey all,

I looked on the development box, and it seems those numbers are correct. The output of 'ls -l /dev/null' below shows it...

crw-rw-rw- 1 root sys 2, 2 Oct 4 11:00 /dev/null

I looked at the man page for mknod on the Unisys server, and it says you can specify the major/minors as decimal or hex, so it loks like this is what I need to do...

-Tim
Hey! Who turned out the lights!
Timothy Czarnik
Esteemed Contributor

Re: Recreating /dev/null

Actually, upon second look, the numbers are not the same. The major is different...

-Tim
Hey! Who turned out the lights!
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Recreating /dev/null

Great in that case all you need to do is:
mknod /dev/null c 2 2
chown bin:bin /dev/null
chmod 666 /dev/null
If it ain't broke, I can fix that.
Timothy Czarnik
Esteemed Contributor

Re: Recreating /dev/null

Thanks guys! That did the trick.

By the way, have I mentioned lately how much I LOVE THESE FORUMS!

Thanks again!

-Tim
Hey! Who turned out the lights!