NAME

psync -- update copy

SYNOPSIS

psync [-n][-q|-vI<n>] source_items ... target_directory

DESCRIPTION

psync does an update copy. It compares source directory and target directory at first, then erases items that are nonexistent on source directory if specified and finally copies everything on source directory. Items with the same modification date and (data fork) size remain untouched, saving time on operation.

Currently psync supports options below

-r

Remote backup/restore mode. Ownership and permissions are stored/retrieved via .psync.db

If the source directory contains a file .psync.db, psync turns into remote restore mode. It uses .psync.db on source directory to restore ownership and permissions.

If not, psync turns into remote backup mode. After the backup it stores ownership and permissions to .psync.db

As the name suggests, this option is imperative when the backup directory is on remote volume such as AFP, NFS, and Samba.

-dn

Delete nonexistent files before starting copy. If the number larger than 2 is specified, it also deletes ignored files.

CAVEAT: Prior to 0.50 this option was default.

-f

Force copy. Copy files even when the file remains unchanged.

-n

"Simulation mode". It prints what it would do on standard output but does nothing thus far.

-vn

Sets verbose level. Default verbose level is 1; It prints only items that are changed. Level 2 prints unchanged files also. Level 3 and above are practically debugging mode.

-q

Quiet mode. Sets verbose level to 0.

EXAMPLE

To backup everything in startup volume, all you have to say is

sudo psync -d / /Volumes/I<backup>

And the resulting backup volume is fully-bootable copy thereof. Note sudo or root privilege is necessary to restore file ownership.

PERFORMANCE

On PowerBook G3 (pismo) with G3/400, 384MB Memory, I tested with /usr/bin/time -l sudo psync -d / /Volumes/backup. The boot volume contains no more than vanilla OS X 10.1.2 and Developer kit. It had a little over 10000 items and 1.8 GB of used space. Here is the result;

HFS+ on Pismo's Expansion Bay
   2539.48 real       121.97 user       290.78 sys
    452.98 real        47.29 user        39.38 sys

UFS on Pismo's Expansion Bay
   9278.25 real       775.60 user       667.82 sys
   1086.35 real        69.19 user        53.68 sys

HFS+ Disk Image on AFP Volume
   3127.60 real       217.51 user       445.04 sys
   1059.37 real        69.80 user        52.00 sys

DVD-RAM formatted as HFS+
  12258.39 real       210.52 user       441.67 sys
    564.49 real        62.47 user        46.65 sys

NFS
  13227.76 real       429.44 user       583.40 sys
   2348.72 real        83.87 user        88.10 sys

Note screensaver was on with some other background programs. I used this program happily with my PowerBook G4 (Ti) while I am surfing the web and listening to iTunes at the same time letting SETI@Home search for cosmic programmers :) With MacOS X, background backup is no problem

FILES

.psync.db

Berkeley DB Hash file used to store ownership and permission information when -r option is set.

BUGS

Backing up to AFP volume may lose some files with Unicode names other than the language you specified when you mount the volume. That is, When you mount the volume with "Japanese" support, You may fail to backup files with Korean and Chinese names. AFP prior to MacOSX ( including Netatalk 1.5.x) is also vulnerable to file names that are longer than 31 bytes. Old AFP also suffers the problem of 2GB file size limit. This may stand in your way when you try to backup on disk image on AFP volume.

AFP on MacOS X (that is, AFP server is MacOS X) does not have this problem.

In theory the backup also works on WebDAV and SMB but they remain untested.

DISCLAIMER

The author of this utility will be held no responsibility for any damages and losses of data and/or files that may be caused by the use thereof.

Use me at your own risk!

AUTHOR

Dan Kogai <dankogai@dan.co.jp>

SEE ALSO

"1" in pcpmac

hfstar http://www.geocities.com/paulotex/tar/

hfspax http://homepage.mac.com/howardoakley/

The Finder and File Operations http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/Finder/The_Finder___Operations.html

COPYRIGHT

Copyright 2002 Dan Kogai <dankogai@dan.co.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.