Upon deploying a new server and migrating the entire contents of /home using rsync I noticed that the group and user ownership were in fact preserved, despite the fact that the ids differ between the two servers.
Specifically, the command I ran was:
rsync -avz oldserver:/home/ /home
Though I have recreated all of the same users and groups on the new server, most of them have different ids than the old, but somehow this command has magically kept the correct ownership (based on name) and assigned new gid and uid where applicable. I am able to verify this with ls -n /home.
How is this possible? Does rsync do some kind of name lookup?