To copy an entire directory including links and properties (snap-shot), use the find command in conjunction with cpio.
Here's an example for copying all of /usr to /backup-usr (must be root to do this example):
#cd /usr #find . -print | cpio -pduvm /backup-usr
Then, you can rename the /backup-usr to /usr and you will have no problems with links or system permissions.
About the author: Greg Hearn is a UNIX Systems Administrator at LVVWD.
Editor's Note: We provide user-submitted tips as a service to our members to help foster other comments and advice. This tip has not been checked in detail for its technical accuracy. Instead, we rely on our community members to police themselves via our tip rating system and by sending in follow-up comments to
email@example.com about a specific tip or tip author. We appreciate your help in making searchStorage a more successful and collaborative community of storage professionals.
This was first published in February 2001