×
UNIX.COM Login
Username:
Password:  
Show Password






👤


OS X (Apple)

OS X is a line of Unix-based graphical operating systems developed, marketed, and sold by Apple.

Rsync for back up, external HD

Tags
backups, options, rsync

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #8  
Old 06-26-2013
marek marek is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 3 July 2017, 3:58 PM EDT
Posts: 26
Thanks: 6
Thanked 0 Times in 0 Posts
Thank you xbin!

I did not know the asr command! Interesting! I already did install the latest version of rsync, but did not succeeded to apply the patches. Will dip in again one more time. And thank you for the link!


marek
Sponsored Links
    #9  
Old 07-07-2013
marek marek is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 3 July 2017, 3:58 PM EDT
Posts: 26
Thanks: 6
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #10  
Old 07-08-2013
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 16 July 2018, 9:56 AM EDT
Location: Switzerland - GE
Posts: 6,550
Thanks: 311
Thanked 564 Times in 526 Posts
Thanks for your contribution
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash script to back up with rsync ajmoreti Shell Programming and Scripting 3 11-16-2009 05:36 AM
Back-to-Back Connection using HBAs aldowsary IP Networking 3 11-28-2008 09:21 PM
Rsync to an external list of URLs ibsen Shell Programming and Scripting 8 10-06-2008 07:33 PM
rsync back? redlotus72 UNIX for Dummies Questions & Answers 1 09-22-2005 03:43 PM



All times are GMT -4. The time now is 02:17 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.