Apple - Using rsync to backup
For Maximum Safety, Copy Everything
The safest option is to copy everything, including invisible meta-data files.
Files tend to exist for a reason and as software changes, so will the existence, purpose, and contents of these meta-data files. Copying everything will reduce the maintenance burden and offer ease of mind that nothing is being lost.
The log file created by rsync
will be technically involved by the very nature of rsync
being a command line tool. Consider presenting a tidied up, meta-data filtered, and maybe even coloured coded output for the user to check. You could do this with a wide range of scripting tools and languages. Please ask more questions here on Ask Different and on StackOverflow if you need help with this approach.
Delete Last & Copy OS X Resources
Regarding the rsync
flags, take a look at the question Fastest and safest way to copy massive data from one external drive to another. In this question, a few additional flags are used and explained:
sudo rsync -vaE --progress --delete-after /Volumes/SourceName /Volumes/DestinationName
In this situation, the E
will ensure resource forks and other Mac specific properties are copied.
You may want to consider --delete-after
to avoid deleting until the copy has completed; please note that this approach will potentially require a destination drive twice the size of the source.
Possible Exclusions
An answer to a related question, How can I omit FCPX Render Files from a Time Machine backup?, provided a useful link of OS X files and folders that can be excluded from most back-ups. This link provides a practical list of file patterns, folders, and paths that you could exclude.
Include dot Files
There are good reasons to back up files beginning with dots, .*
matching files.
Some software keeps preferences, settings, and other information of value in folders at the top of the user's folder in invisible dot prefixed folders. Running ls -la ~/
will reveal these folders and files.
If any user uses or has software that in turn uses version control software, be sure to back-up dot files. Software like subversion and git both store critical information within their dot folders. These hidden folders can be scattered across your file system, where ever a project is checked out.
Spotlight and Disk Access
Spotlight is OS X's search service. Spotlight uses the mdworker
process to index and update the search catalogue. If you are concerned about possible disk corruption or slow copies, disabling mdworker
while running rsync
may help. Personally, I leave Spotlight running while running large rsync
transfers.
If you're using rsync
version 3.0.6 as per Carbon Copy Cloner or 3.1.2 as per Homebrew, you can take a cue from Carbon Copy Cloner arguments:
rsync -A -X -H -p --fileflags --force-change -l -N -rtx --protect-decmpfs --numeric-ids -go --delete-during --backup --backup-dir=</PATH/TO/STICK/BACKUP_when_using_delete> --protect-args <SRC>/ <DEST>
I'd advise against pruning meta-data during a backup, particularly the dot-files e.g. ._$filename
, however if you really want to exclude the dot-files from your rsync
command add --exclude '.*'
to it.
rsync -av --exclude '.*' --progress --delete /Volumes/A/ /Volumes/B