Monday, September 29, 2008

rsyncd exclusions for using BackupPC on Vista

Edit: These exclusions have expanded/corrected and are further detailed in my BackupPC Install Guide for Windows XP/Vista Clients.

I've been working on getting BackupPC set up on my home network. To backup Windows clients, we've had to use cygwin+rsync+ssh. Because of problems with that combination on Windows, I used rsyncd instead of just rsync over ssh.

When I finally got that working, I ran into a lot of problems on my Vista machines where rsync would follow the junction points they added for backward compatability (see this site for more info). This caused extra-long filenames rsync couldn't handle. To find all junction points on your Vista machine use this command at the C: drive in the Command Prompt:
dir /a /l /s > c:\users\USERNAME\JunctionPoints.txt
So I had to add all of these to the exclude list for rsyncd. Here is my rsyncd.conf (with redacted data, of course):
gid = users
read only = true
use chroot = false
transfer logging = false
log file = /var/log/rsyncd.log
log format = %h %o %f %l %b
hosts allow = BACKUPPC_IP
hosts deny = 0.0.0.0/0
auth users = BACKUPPC_USERNAME
secrets file = /etc/rsyncd.secrets
strict modes = false
[c]
path = /cygdrive/c
exclude from = /etc/exclude-c.txt
The 'exclude from' line specifies the location of the exclude file. Below are the contents of exclude-c.txt for the junction points:
#Junction points
- /Users/All Users
- /Users/Users/Default User
- /Users/Users/All Users/Application Data
- /Users/Users/All Users/Desktop
- /Users/All Users/Documents
- /Users/All Users/Favorites
- /Users/All Users/Start Menu
- /Users/All Users/Templates
- /Users/Public/Documents/My Music
- /Users/Public/Documents/My Pictures
- /Users/Public/Documents/My Videos
#Excludes these junction points common to every user profile
- /Users/*/Application Data
- /Users/*/Cookies
- /Users/*/Local Settings
- /Users/*/My Documents
- /Users/*/NetHood
- /Users/*/PrintHood
- /Users/*/Recent
- /Users/*/SendTo
- /Users/*/Start Menu
- /Users/*/Templates
- /Users/*/AppData/Local/Application Data
- /Users/*/AppData/Local/History
- /Users/*/AppData/Local/Temporary Internet Files
- /Users/*/Documents/My Music
- /Users/*/Documents/My Pictures
- /Users/*/Documents/My Videos
The rules with asterisks in them will match the junction points that are in every user profile by default without having to code each user manually.

Then, to get rid of any temp data in the backups we use the following:
- /Users/*/AppData/Local/Microsoft/Windows/Temporary Internet Files
- /Users/*/AppData/Local/Temp
- /Users/*/NTUSER.DAT
- /Users/*/ntuser.dat.LOG1
- /Users/*/ntuser.dat.LOG2
- /Users/*/AppData/Local/Microsoft/Windows/UsrClass.dat
- /Users/*/AppData/Local/Microsoft/Windows/UsrClass.dat.LOG1
- /Users/*/AppData/Local/Microsoft/Windows/UsrClass.dat.LOG2
- /Users/*/AppData/Local/Microsoft/Windows Defender/FileTracker
- /Users/*/AppData/Local/Mozilla/Firefox/Profiles/*/Cache
- /Users/*/AppData/Roaming/Microsoft/Windows/Recent
- *.lock
Finally, any program or system installation files can be omitted. On Vista, only original installation data is stored in Program Files. Any data programs write to their installation folder goes to ProgramData automatically instead. The Windows folder shouldn't hold anything interesting, either. The rest of these rules are replaceable or unimportant data:
- /Program Files
- /Windows
- /$Recycle.Bin
- /MSOCache
- /System Volume Information
- /autoexec.bat
- /bootmgr
- /BOOTSECT.BAK
- /config.sys
- /hiberfil.sys
- /pagefile.sys
If you're only backing up the users folder, you can omit the last rules and remove the '/Users' prefix from the rest of the rules.

And viola! Finally we can get a full backup!

8 comments:

  1. Hi Cody,

    Need any weeds killed?

    Paul Koetz

    ReplyDelete
  2. Hey Paul! How are you? Do you have an email I could send to?

    ReplyDelete
  3. Great stuff Paul! I may need this in the future.....I'm working on my own list voor XP pcs. Cheers!

    WolfBoy (Danny)

    ReplyDelete
  4. Check out http://www.cs.umd.edu/~cdunne/projs/backuppc_guide.html#Vista for my updated list.

    ReplyDelete
  5. Hi - can you elaborate on "To backup Windows clients, we've had to use cygwin+rsync+ssh".

    Did you into a problem with smbclient? I have two problems with backuppc using smbclient on Vista (exclude list not obeyed, and occasional 100% CPU usage) and I'm wondering if I need to move to rsync.

    Thanks.

    ReplyDelete
  6. I chose rsync over smb because it does a better job detecting changes, transferring less data, and working over the internet. Check out my guide for more instructions for getting rsync over ssh working on Windows clients.
    http://www.cs.umd.edu/~cdunne/projs/backuppc_guide.html

    ReplyDelete
  7. Hi Cody,

    Please help my with a question, it is possible to backup from windows with rsyncd only .doc and .xls files ? If yes.. how? I'm adding *.xls and *.doc on the $Conf{BackupFilesOnly} parameter, but does not work. Best regards,

    ReplyDelete
  8. @RazaMetaL, I believe it is possible though I don't know the details. On the latest cygwin, backuppc, and windows versions you should probably use rsync+ssh rather than rsyncd. Since the updates it's switched back again. Try the backuppc mailing list or the rsyncd site.

    ReplyDelete