can I preserve UIDs/GIDs when transferring with rsync?

Tomasz Chmielewski mangoo at mch.one.pl
Fri Jun 24 07:04:03 GMT 2005


I noticed that rsync can preserve most of the file's characteristics 
when it is used with "-a" option (it includes -o and -g flags for 
preserving owners and groups).

However, when I transfer data between systems, it affects my UIDs/GIDs, 
making the data hard to recover.

Example:

Sending side:

/etc/passwd:
mark:x:503:503::/home/mark:/bin/bash

file:
-rw-rw-r--  1 mark mark 19525 Jun 23  2004
/home/mark/somefile.txt


Receiving side:
/etc/passwd:
mark:x:659:103::/home/mark:/bin/bash

file:
-rw-rw-r--  1 mark mark 19525 Jun 23  2004 /backup/users/home/somefile.txt


But in reality, UID and GID of that file changed from 503:503 to 659:103.
It is a big obstacle in my backup system.


Is it possible to transfer files with rsync, and to preserve the *exact* 
UIDs and GIDs, rather than usernames/groupnames (which in turn point to 
invalid UIDs and GIDs)?


-- 
Tomek



More information about the rsync mailing list