Today’s rather inconvenient discovery

If you use rsync to backup your system, and the system you’re backing up to has different uids for some userids, it converts them as it stores! I just found this out because after restoring my xen1 backup, I’ve discovered that all my postgres files belong to 114, which is the uid of postgres on my home server, not on xen1.

This is going to make restoring all the xen backups a royal pain in the ass.

6 thoughts on “Today’s rather inconvenient discovery”

  1. > it converts them as it stores!
    That has never happened while I was a linux sysadmin.

  2. uh oh. I’m using rsync from three remote system to do mirror’d backups from my server. each night they each rsync from my server to themselves (using the sh script you once sent me).

    now i’m worried that if i need to recover from them it’s going to be a huge pain.

    i’ll try checking UIDs across the systems, but, no way they are going to line up right.

    wait. it just uses the uid numbers so even if they show as the ‘wrong’ UID on the backup system, if they are moved back to the original system won’t they be owned correctly?

  3. the more i think about this the more i just can’t believe it’s doing this ‘wrong’

  4. I just looked and I do not see that conversion happening between my server and the systems that are rsync mirror backing it up.

    wonder what’s happening to you?

  5. All I know is that the postgresql user is uid 106 on xen1, but uid 114 on my home box. When I rsync from xen1 to home, the backups of postgresql files have uid 114.

    ptomblin@xen1:~$ ls -ldn /var/lib/postgres
    drwxr-xr-x 2 106 108 4096 2009-01-18 09:21 /var/lib/postgres

    homebox:~> ls -ldn /1u_backup/xen1/Sun/var/lib/postgres
    drwxr-xr-x 2 114 123 4096 2009-01-18 09:21 /1u_backup/xen1/Sun/var/lib/postgres/

    And of course when I restore on the new xen1-test machine, the postgresql user hasn’t been created yet, so rsync doesn’t know how to translate back.

  6. I often use rsync –numeric-ids, although more for the (theoretical? I certainly haven’t tested it) performance gain from not having to look them up in LDAP. Not that it’d help in your case – Debian uids > 100 are created on-demand when you install a package that requires a uid.

Comments are closed.