Scripting rsync against a filesystem with a quota

William Hunter william at macolytes.co.uk
Wed Aug 11 09:07:00 MDT 2010


Hello,


I have a couple of questions about using rsync scriptographically. I've looked around and can't find anything. I must be missing something obvious.


I'm trying to write a script that will synchronise various local folders on a Mac OS X Workstation to an SMB mounted Windows (2003, mostly) Server where the user I'm copying as has a quota applied. I want to compare the available space I have, which I can find with:


df /Volumes/$USER | grep % | awk -F'[ ] ' '{ print $4 }'


Against the amount of data that rsync thinks it is going to copy.


What I'm after is the most efficient way of finding out how much data rsync wants to copy, dying (relatively) gracefully should it be within X of the quota (say, 10MB or so).


At the moment I can use the same rsync command I'd run to do the copy but with the -n option:


rsync -a -u -z -E -r -l -n --progress /path/to/src /Volumes/path/to/dest/ | grep "total size is" | awk -F'[ ]' '{ print $4 }'


to do a dry-run to grep and cut a number from rsync's output.


The only thing is that this might take a while if there are very many files and potentially there are hundreds of thousands. I'd then have to go and run the same command all over again should the data fit, this time without the -n option. I also feel that my units may be rather disparate (i.e. df's output isn't the same unit sizes as rsync's).


I'm sure there must be a better way than running rsync twice.


On another note I'm getting an error:


copyfile(.._..v6AxMh,./., COPYFILE_UNPACK) failed:13


When trying to run with -E. The consensus seems to be that it's a permissions issue (which I'll investigate later). Thoughts?


Many thanks,
~W


***IMPORTANT NOTE***
As of the 1st March 2010 we have incorporated our Mac Support Services within Amsys PLC.

Amsys PLC.
Byron House,
Lower Road,
Kenley,
Surrey,
CR8 5NB

(T)  +44 (0)20 8660 7750
(F)  +44 (0)20 8763 0924
(W) www.amsys.co.uk
(E) info at macolytes.co.uk

- Apple Authorised Service Provider (AASP) -

DISCLAIMER NOTICE
The information contained within this e-mail is confidential and is intended solely for the addressee. 
Access to this e-mail by any other party is unauthorised. Any views or opinions presented are solely 
those of the author and do not necessarily represent those of Amsys PLC. Internet 
communications are not secure and Amsys PLC. does not accept any responsibility 
for the contents of this message or changes made to this message after it was sent.

Please consider the environment before printing this e-mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20100811/e4f95ca8/attachment.html>


More information about the rsync mailing list