For back-up and restoration purposes the purpose of retiring an old server, I will need to create a perfect mirror image of an NFS share. This mirror is not a simple re-direct, but rather, an exact copy of the contents of an NFS Share (including file-permissions).
I have tried simple tasks, such as copying files as root
with the command:
cp -pR /path-to-nfs-share/ /local-directory-to-mirror-nfs-share-contents/
Unfortunately, the command above does not copy all files, as it returns permission denied
errors for some of the files and directories it encounters. Thus, to avoid potential permissions issues, I wanted to create a perfect mirror (i.e. preserving all permissions) of the files.
Unfortunately, I can't seem to find much documentation on performing this task. Is this doable?
Thank you.
Did you issue the command using sudo so you have elevated privileges?
Rsync might also work better for something like that.
I'd caution against considering it a backup, as it's just a copy. Backups protect against corruption issues or deleted files. Making copies is more like protecting availability of resources.
Your permission errors may stem from the fact that the machine you were on mounted the NFS filesystem as your userid rather than root, meaning that you weren't seeing the entire filesystem. Or, possibly the NFS mounts are changing the UID on purpose for different groups.
Is probably the best way to do it since you don't want to break userids and if you run into a situation where you need to stop, it'll move only changed files. You can stage it and run this several times and make sure you have a complete copy before decommissioning.