Sponsored Content
Operating Systems OS X (Apple) Rsync for back up, external HD Post 302829925 by marek on Sunday 7th of July 2013 05:44:20 AM
Old 07-07-2013
Hello all!

rsync version: 3.0.9
MacOSX: 10.8.4
Subject: make an exact copy of HD to an external HD with rsync


After long tests I put up my rsync script like follows:

First a long exclude file, which is read in by rsync with the switch
Code:
--exclude-from=path/to/exclude/file.txt

in this file are some legacy files from old MacOSes. So this exclude file should also work for older Macs. But probably not with an older rsync version ...

The following exclude file is from: Some files and folders are automatically excluded from a backup task / Backup and archiving settings / Knowledge Base - Bombich Software Support


Code:
.HFS+ Private Directory Data*
/.journal
/.journal_info_block
.AppleDouble
/lost+found
.metadata_never_index
/.com.apple.timemachine.donotpresent
.VolumeIcon.icns
/TheVolumeSettingsFolder
Saved Application State
.DocumentRevisions-V100
.Spotlight-V100
/.fseventsd
/.hotfiles.btree
/private/var/db/dyld/dyld_*
/System/Library/Caches/com.apple.bootstamps/*
/System/Library/Caches/com.apple.corestorage/*
/System/Library/Caches/com.apple.kext.caches/*
/.com.apple.NetBootX
/Volumes/*
/dev/*
/automount
/Network
/.vol/*
/net
/private/var/folders/*
/private/var/vm/*
/private/tmp/*
/cores
.Trash
.Trashes
/Backups.backupdb
/.MobileBackups
/private/tmp/kacta.txt
/private/tmp/kactd.txt
/PGPWDE01
/PGPWDE02
/.bzvol
/Library/Application Support/Comodo/AntiVirus/Quarantine
.DS_Store

Contrary to Slicehost Articles: rsync - exclude files and folders I found, that spaces and wild cards "*" don't need to escaped with "[ ]" (for spaces) or surrounded by quotes like "file*" for wild cards. And "/" means root folder - as expected -, not the folder from were the script was started.

Here the rules for this exclude files: every excluded file or folder has to be separated by a line.

Suppose, we have following folders, with some contents:

dev
#dev
dev#


dev # backups the folders "#dev" and "dev#", but not "dev"
*dev/ # backups the folder "dev#" and nothing else!
dev/ # backups the folders "#dev" and "dev#"
dev/* # backups the folders "#dev" and "dev#" with its contents and the folder "dev" without
*dev/* # backups an empty "#dev" and "dev" and "dev#" with contents.
dev*/ # backups "#dev" with contents.
*dev*/ # nothing ...
*dev*/* # empty folders: "dev", "#dev", "dev#"


And now the backup script, which you start with, being in the folder where you saved this script:

Code:
sudo ./rsync.sh

Code:
#!/bin/sh

EXCLUDES=$HOME/Documents/programming/backup_script/rsync_exclude.txt

OPTS="-tavu --exclude-from=$EXCLUDES --delete"

EXTERN="backup_2013"
USBDisk="/Volumes/$EXTERN/"

if ls /Volumes/ | grep -q $EXTERN; then
	echo "$EXTERN is mounted! Starting backup ...\n"
else
	echo "Please mount the external HD \"$EXTERN\" before running this script!"
	exit
fi


rsync $OPTS / $USBDisk

Hope this helps some people out there ...


marek
 

8 More Discussions You Might Find Interesting

1. Solaris

External USB

Is it possible to install Solaris 10 on an external USB drive? I'd like to dual boot Linux and Solaris 10. Thanks! (2 Replies)
Discussion started by: otterit
2 Replies

2. UNIX for Dummies Questions & Answers

rsync back?

Hi, I am in the process of developing backup script using rsync, my code is bellow: EXCLUDE_DIR="/home/kannanpg/mscdr/src/ex1" rsync -az -e ssh -v --exclude $EXCLUDE_DIR --delete $HOSTTOBACKUP:$SOURCE $DR_BACKUP_DIR/daily.0 >$tempfile 2>&1 even my exclude dir is coping.. what is wrong in... (1 Reply)
Discussion started by: redlotus72
1 Replies

3. AIX

back to back printing in UNIX

Hi , Can you suggest me how to back to back printing in UNIX? Is there any way? Kindly advise. Regards Vijaya Amirtha Raj (3 Replies)
Discussion started by: amirthraj_12
3 Replies

4. Shell Programming and Scripting

Rsync to an external list of URLs

I'm going to have a text file formatted something like this: some_name http://www.someurl.com/ another_name http://www.anotherurl.com/ third_name http://www.thirdurl.com/ I need to write a script that can rsync from a file path I'll set, to each URL in the list. Any ideas? (8 Replies)
Discussion started by: ibsen
8 Replies

5. IP Networking

Back-to-Back Connection using HBAs

Hi every body, Is it possible to connect two servers Back-to-Back (Point-to-Point) using HBA adapters & using Fiber. Note it is direct connection & there is no switches between the servers. I'm concern about using HBA adapters, it is possible or not. Thanks in advance. :) (3 Replies)
Discussion started by: aldowsary
3 Replies

6. Shell Programming and Scripting

Bash script to back up with rsync

I'm trying to write a script to back up with rsync, the script I am posting below: nomServer="shiva horus isis" dirshiva="/etc /faturamento" shivaListExc="/usr/local/bin/shivaListExclRsync" dumpDir="$dumpFile/Shiva" dateBkp=`date +%A` for nServer in ${nomServer} do ... (3 Replies)
Discussion started by: ajmoreti
3 Replies

7. UNIX for Dummies Questions & Answers

External HDD

I need to get an external HDD for a SUN server running Solaris 10. The Western Digital that I have will not recognize and when I went looking for drivers WD only has them for MAC and Windows. Is there a External HDD that is known to work with Unix? (24 Replies)
Discussion started by: SIFT3R
24 Replies

8. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies
All times are GMT -4. The time now is 08:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy