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 85000 items and 1.5 GB of used space. Here is the result;
1st run
2539.48 real 121.97 user 290.78 sys
Following run
452.98 real 47.29 user 39.38 sys
Note screensaver was on with some other background programs. I used this program happily with my PowerBook G4 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 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 is also vulnerable to file names that are longer than 31 bytes.
Most NFS servers do not have this problem so if you backup MacOS X boot volume onto remote server, use NFS or disk image.
In theory the backup also works on WebDAV and SAMBA but they remain untested.
DISCLAIMER
The author of this utility will be held no responsibility for possible damages and losses of data and/or files caused by the use thereof. Use me at your own risk.
AUTHOR
Dan Kogai <dankogai@dan.co.jp>
SEE ALSO
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.