Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
You won't have a backup, you'll have more highly available data. This isn't going to save you if someone deletes something that they shouldn't. –  MDMarra Sep 2 '10 at 15:22
    
Understood. Essentially, what I want to do is retire an old server and make a very seamless transition to the new one. However, I need the file permissions to remain exactly the same for it to be as transparent and seamless as possible. –  Phanto Sep 2 '10 at 15:45

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
Essentially I want to create a copy so I can retire the server. I was running the command while logged in as root. Thus, I don't understand why I was getting permission issues. For that reason, I would like to create a mirror so when I retire the old server, the transition is seamless. –  Phanto Sep 2 '10 at 15:42
    
Use rsync, and re-initate it the moment before you retire your old server to get fresh data. –  pauska Sep 2 '10 at 16:01
    
I've never actually used rsync before. Does it require a server component to be installed? Does it also preserve all file permissions? From what I read about it, it only likes to download diffs. Is there a way to only download whole files such that I could easily just flip a switch and use the new server to host the files instead of the old one? –  Phanto Sep 2 '10 at 16:05
1  
Rsync doesn't need a server component. The best way I've found is to run it tunneled with secure shell, so if you have sshd running on the destination you should be fine. There is a switch for it to preserve permissions. As for "flipping the switch", I don't think you can easily do that with anything that's not designed to do so, as you'd have IP configuration issues, but you would have something close to it. I'm not sure what you mean in hesitating because it only downloads diffs... –  Bart Silverstrim Sep 2 '10 at 16:17
1  
If the file isn't there, rsync will copy the entire file. If a portion of the file changed (think editing a big graphic or video, for example) AND it's a network copy, not directory to directory copy, it will only transfer the changed parts (which you'd want since it'll go much faster if you're trying to capture changes then shut the machine down). –  Bart Silverstrim Sep 2 '10 at 16:18

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.

rsync -aplxo --delete /nfsmount/ /newmountlocation/

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.