Operating System - HP-UX
1833779 Members
2461 Online
110063 Solutions
New Discussion

copy /dev directory , preserve premissions

 
SOLVED
Go to solution
rleon
Regular Advisor

copy /dev directory , preserve premissions

Over the weekend we had someone delete several files in /dev including /dev/vg00

We do not have a tape backup to this server since it is at a field site. But we do have a lifeboat disk that is updated weekly via dd.

I was able to mount the lifeboat disk and /dev was fully intact. So I decided to copy ( cp -o -r ) over /dev.

I then realized that /dev/null did not copy over correctly, it copied over with the umask instead of preserving the permissions.

My question is how can I copy /dev and preserve all of the permissions?

Thanks

2 REPLIES 2
James R. Ferguson
Acclaimed Contributor
Solution

Re: copy /dev directory , preserve premissions

Hi:

You could use 'cpio' like:

# cd srcdir && find . -depth -print | cpio -xpudlmv dstdir

The '-x' switch is key to handling the special files of '/dev'.

If the issue is only '/dev/null' can always remove it and recreate it with with:

# mknod /dev/null c 2 2
# chown bin:bin /dev/null
# chmod 666 /dev/null

Regards!

...JRF...
rleon
Regular Advisor

Re: copy /dev directory , preserve premissions

Thanks

that worked great.