I wanted to recreate the following two directory structures (including all sub-directories, which there are many of):
/u02/prn/app
/u02/prn/oradata
On the server you want to model the directory structure(s) after you would run the following commands.
# find /u02/prn/app -type d | cpio -ov >/tmp/appdirs.cpio
# find /u02/prn/oradata -type d | cpio -ov >/tmp/oradatadirs.cpio
Now using "scp" I can copy these files to the server I want to recreate the directory structure on.
# scp /tmp/*.cpio destination_server_here
Now I will extract the archive which will create the directory structures I want (with the appropriate owners and permissions). Note: run this command from the "/" filesystem. If you run it from /tmp, it will look for u02 in tmp. It obviously doesn't live there. So, do it from /
# cpio -iv </tmp/appdirs.cpio
# cpio -iv </tmp/oradatadirs.cpio
Done! Not quite magic, but almost.
Assumptions: You have the same users and groups created on the destination server as you do on the source server.
Hope this helps someone out there.
No comments:
Post a Comment