Friday, May 16, 2014

re-create AIX /dev/null

The type of /dev/null was accidentally changed  by command "rm /dev/null*"

Its type should be char device as shown below.

-rw-r--r--    1 root     system    619851909 May 15 14:23 null 2>&1
crw-rw-rw-    1 root     system        2,  2 May 15 14:24 null

after "rm null*" , it became 

-rw-r--r--    1 root     system           41 May 15 14:24 null
-rw-r--r--    1 root     system          190 May 15 14:24 null 2>&1

something like a normal file.

Googled but those solution doesn't work, as I failed to delete /dev/null "file" although there is no error message returned.

e.g.  

rm /dev/null ; mknod -m 0666 /dev/null c 2 2 ; chown root:system /dev/null


So my solution is to reboot the server, and it works for me since this is a test server.
 #ls -l null*
crw-rw-rw-    1 root     system        2,  2 May 15 14:56 null
-rw-r--r--    1 root     system        31458 May 15 14:56 null 2>&1