As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

rsync, keeping two folders in sync

Shazkar ShadowstormShazkar Shadowstorm Registered User regular
edited April 2010 in Help / Advice Forum
hi

simple question

i run os x

i have a folder on one external hard drive
i would like it to be sync'd to another external hard drive, so in case one dies it survives

what is the easiest way to do this? how does rsync work?

poo
Shazkar Shadowstorm on

Posts

  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2010
    You'll want to setup a cron job or other automation of a shell script. The basic command is just rsync <folder a> <folder b> but you'll probably want to do -raz --delete (recursive, duh; archive, which copies permissions and such; compress, which reduces the transfer size; and --delete makes sure that any files you delete in the source are deleted in the destination.

    admanb on
  • LewishamLewisham Registered User regular
    edited April 2010
    Any reason why you can't use Time Machine for the job? That way it'll have the folder versioned too.

    Lewisham on
  • EchoEcho ski-bap ba-dapModerator mod
    edited April 2010
    Can Time Machine do individual folders then? I've only ever seen entire volume versioning.

    Anyway, you want Folder Actions. Right click folder -> More -> Folder Actions. You'll probably have to make the script yourself though, or find one somewhere.

    It'll run automatically when the folder changes, no need to wait for cron to kick in and run rsync.

    edit: on some further googling, it appears that Folder Actions only trigger when files are created/deleted, not modified.

    Echo on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2010
    Time Machine just does exclusions, so it's designed to be a complete system backup (minus anything you don't particularly care for) that you can restore to.

    Annoyed me when I realized I wouldn't be able to use it to keep my docs and stuff backed up to my external HD. 'course, that died months ago and I can't afford to replace it, so I suppose it worked out.

    admanb on
  • EchoEcho ski-bap ba-dapModerator mod
    edited April 2010
    It's not really what the OP asked for, but I keep the important stuff in Dropbox (disclaimer: that's a referral link, but you get both me and yourself an extra 250 megs of storage through it), which syncs it on two different computers as well as online, with built-in versioning.

    Echo on
  • Shazkar ShadowstormShazkar Shadowstorm Registered User regular
    edited April 2010
    yeah, i use time machine for my computer's hard drive, this is between two external hard drives, none of this data is on my actual computer, i just want it to be redundant (lotta music and stuff i care about)

    sorry for my ignorance, any tutorial or something about writing a cron script? im mildly familiar with shell scripting but not a ton

    edit:
    Echo wrote: »
    It's not really what the OP asked for, but I keep the important stuff in Dropbox (disclaimer: that's a referral link, but you get both me and yourself an extra 250 megs of storage through it), which syncs it on two different computers as well as online, with built-in versioning.

    yeah, i have dropbox dude, but this is a 90 GB folder i'm talking about anywho

    Shazkar Shadowstorm on
    poo
  • EchoEcho ski-bap ba-dapModerator mod
    edited April 2010
    Assuming standard Unix structure: poke at /etc/crontab.

    */5 * * * * /home/user/foo.pl

    That's the format. This runs every 5 minutes. Here's the syntax. Very easy.

    Echo on
  • Shazkar ShadowstormShazkar Shadowstorm Registered User regular
    edited April 2010
    how do i get the path for my folder anyway? the location is /Volumes/External Drive/folder name

    and then the other one would be /Volumes/External Drive 2/folder name

    err i am sorry i am so noob

    Shazkar Shadowstorm on
    poo
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2010
    What do you mean? The main thing you have to do is backslash-escape the spaces. So the first one would become

    /Volumes/External\ Drive/folder\ name

    admanb on
  • Shazkar ShadowstormShazkar Shadowstorm Registered User regular
    edited April 2010
    but what i mean is how do you get to the very root, because ~ would just get me to
    /Users/myusername/

    and i need something in

    /Volumes

    Shazkar Shadowstorm on
    poo
  • LewishamLewisham Registered User regular
    edited April 2010
    No-one has told you to use a tilde, just specify the paths as you have been writing them out.

    You are being very confusing :)

    Lewisham on
  • admanbadmanb unionize your workplace Seattle, WARegistered User regular
    edited April 2010
    but what i mean is how do you get to the very root, because ~ would just get me to
    /Users/myusername/

    and i need something in

    /Volumes

    ~/ is just an alias for /Users/<your user>

    / is root.

    admanb on
  • Shazkar ShadowstormShazkar Shadowstorm Registered User regular
    edited April 2010
    ah got it

    Shazkar Shadowstorm on
    poo
Sign In or Register to comment.