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

I'm backing up user uploaded files from my primary server to my failover server using rsync.

If I use rsync -a to mirror an /uploads directory from server A to server B, can I expect programs using the files in /uploads on server B (e.g., Nginx, etc.) to function like it did on server A, assuming I've created users with the same names and permissions on server B, or will I run into subtle problems later that I may have just overlooked? So, is copying a directory of files with preserved ownership and permissions interoperable amongst similar machines, or will it copy ownership via UID and therefore screw everything up when I happen to create users in a different order, etc.? Are there other considerations when doing this, or do you have any recommendations on a better way to handle this sort of backing up with rsync?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

In most cases, this will work as expected, but -a won't copy extended attributes (-X), ACLs (-A) and hard links (-H), so if your files use these, add these parameters.

One note: Permissions will be copied based on numerical UID and GID and not an a text name. If these don't match on the target server, you obviously might face problems.

share|improve this answer
    
Ah, thanks. Is there a common pattern that's used to prevent problems like this, such as manually assigning numeric IDs to users upon creation, or something else? I would hate for this to accidentally work just because I happened to create the users in the same order or something to that effect. –  orokusaki May 12 '13 at 22:10
1  
The common pattern for this is to create a central user database (like LDAP) when you have many servers with users that need to be the same. –  SvW May 12 '13 at 23:15
1  
Small correction: Usernames and Groups are mapped based on the names unless you use --numeric-ids –  fukawi2 May 13 '13 at 0:14
    
@fukawi2 - excellent, thanks! SvW - thank you, as well. –  orokusaki May 13 '13 at 1:47

I think you have two paths to follow. First, you should create users and groups with the same UID and GID in both servers, so that you have no surprises later on. Second, once the rsync is done, you should really access the backup server in every way that main server is accessed: try httpd, mail, files, etc and check if it works as intended.

share|improve this answer
    
Thanks, I'll do that, at least for initial testing purposes. –  orokusaki May 12 '13 at 22:12

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.