Sign In/My Account | View Cart  

advertisement

AddThis Social Bookmark Button

Article:
  Automated Backups on Tiger Using rsync
Subject:   rsync to, e.g., Linux server with -E
Date:   2005-07-24 01:04:31
From:   iikka
The rsync with -E (--extended-attributes) does not work directly
with stock rsync included in most Linux distros. This is confirmed
by the rsync man pages for the rsync on Tiger, which state the
following:
-E, --extended-attributes
Apple specific option to copy extended attributes,
resource forks, and ACLs. Requires at least
Mac OS X 10.4 or suitably patched rsync.


So, in order to use rsync to make backup from Mac to Linux, the Linux-side
rsync must be patched to support the -E attribute. Here's how to do that
(all commands given on the Linux machine):


1. Get rsync source code

   curl -O http://samba.org/ftp/rsync/old-versions/rsync-2.6.3.tar.gz
(This is the version supplied with Mac OS 10.4, the patch may well
work on newer versions, but I haven't tried that.)


2. Get the required patch files from darwinsource:

   curl -O http://www.opensource.apple.com/darwinsource/10.4.1/rsync-20/patches/EA.diff

3. Unpach the rsync source
    tar -zxvf rsync-2.6.3.tar.gz

4. Move to the unpacked directory and apply the patch
    cd rsync-2.6.3 && patch <../EA.diff

5. Configure & compile
    ./configure && make

6. Install (as root to replace the current rsync installation)
    su
make install

All this takes less than 10 min. It requires, that you have root
access to the Linux box, though. I made an alias like the following:
    alias syncme  rsync -vaE --exclude=Trash --exclude=Library/Caches 
~/* my.backupserver.com:backupdir/


The command could also be easily added to a cron job.


Also, please note if rsync is used on Mac OS X from a mounted file
system to another, i.e. neither the source or destination path
contains a colon (as described on the original article), it works
regardless of the mounted filesystem type and location. That is,
backup to Linux would also be possible without the above steps by
mounting the target filesystem by, e.g., SMB or NFS, and following
the advice on the original article. The patch is only required,
when two copies of rsync are involved in the process (i.e. the local
and remote copy), in which case both need to support the -E flag.



Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • rsync to, e.g., Linux server with -E
    2005-07-29 20:09:26  mrkahuna [View]

    just an FYI, I had to change step 5 to:

    ./configure --enable-ea-support && make


    as the default appears to be to not enable
  • rsync to, e.g., Linux server with -E
    2005-07-24 11:29:23  Corvus [View]

    As you say, that would only be required if you want to sync to a remote machine, one not mounted as a local filesystem. The article only describes backing up to a locally-mounted filesystem. Backing up to a remote machine is quite an involved project, worthy of an article in itself.

    However, your post mentions one brilliant idea which I urge everyone to adopt. The --exclude=Library/Caches option will skip cache files, which are huge and do not require backing up. This can be incorporated into the original command as:

    rsync -aE --delete exclude=Library/Caches ~ /Volumes/FW200/Backups

    Would it not be better to use --exclude=Library/Caches/, with a trailing "/", to include the (admittedly, unlikely) case of a Library file named "Caches"?

    In any case, this simple change will save me hundreds of MB in backup space. Thanks iikka!
    • rsync to, e.g., Linux server with -E
      2005-07-24 12:12:54  Corvus [View]

      I mistakenly omitted the dashes in the example command, it should be:
      rsync -aE --delete --exclude=Library/Caches ~ /Volumes/FW200/Backups