How to make Time Machine backup FROM a network drive?

Discussion in 'macOS' started by haravikk, Jun 15, 2010.

  1. haravikk macrumors 65816

    May 1, 2005
    I've found plenty of articles on how to get Time Machine to backup TO a network drive, however I have the opposite problem; I have a Windows machine on my network, with some shared folders, and I'd like to back-up their contents using Time Machine on my Mac since it has plenty of space, without having to copy their contents somewhere first if possible.

    However, Time Machine only lets you choose what to exclude, it doesn't let you specify special sources to backup. I was thinking a symbolic link from /Volumes, but I've no idea where to point it to.

    A second relevant question as well would be; how do I get OS X to automatically connect to a Windows share when it's available? The Windows machine isn't always on when I start up my Mac, but I don't want to have to manually connect all the time.

  2. satcomer macrumors 603


    Feb 19, 2008
    The Finger Lakes Region
    Time Machine wasn't designed for something like that. You will need a third party solution.
  3. haravikk thread starter macrumors 65816

    May 1, 2005
    There must be some way around it though, as once the SMB share is connected it's basically just a folder following all the normal rules. I just need some way to make Time Machine see it as such, or trick it into thinking the SMB share is a drive no different from any other that it would normally back-up.
  4. haravikk thread starter macrumors 65816

    May 1, 2005
    Okay, well there must at least be some way to mount and copy files from an SMB share using command line, but it's a really difficult thing to search one.

    Does OS X come with SMB command line utilities? Don't suppose anyone knows of a simple shell or apple script command for connecting to a SMB share and either creating a link of some kind that Time Machine will follow, or then proceed to copy from the share to a folder somewhere (preferably with awareness of what's already been copied to avoid copying everything).
  5. OldMike macrumors 6502


    Mar 3, 2009
    Dallas, TX
    This was the same problem that I was trying to solve as well.

    As long as you don't mind having a live backup of your data, the best solution that I have found is to have an extra drive hooked up to your Mac.

    Use something like File Synchronization to keep a synchronize copy of the data locally. And then use Time Machine locally to back up that data.

    For my situation, at home, I was looking to backup drives from an Airport Express Base Station - and this was the best solution that I could find. Extra drives are real cheap to come by, and I definitely don't mind having an 'extra' copy of my data anyway.
  6. haravikk thread starter macrumors 65816

    May 1, 2005
    Here's the solution I found in the end:

    echo "#--- $(date)"
    		echo "$SMBNAME/$SMBPATH connected, copying file(s)..."
    		rsync -ru --delete "$MOUNT_PATH" "$RSYNC_TARGET"
    		umount "$MOUNT_PATH"
    		echo "Done."
    		echo "$SMBNAME/$SMBPATH was not found."
    • SMB Variables (because these are formed into a URL make sure not to include spaces or other special characters in any of these):
      • SMBUSER - should be the username to log-in as on the SMB share.
      • SMBPASS - the password to log-in with on the SMB share.
      • SMBNAME - the NET BIOS name, DNS address, or IP address of the machine with the SMB share.
      • SMBPATH - the name (and path if relevant) of the SMB share.
    • MOUNT_PATH - the path to use as a mount point, this can be anywhere just make sure to create a directory with the same name (or it'll complain that the mount point doesn't exist).
    • RSYNC_TARGET - the path to copy the files to.

    The script will simply try to connect to a SMB share, copy the files from it to another location using rsync (so only changed files are copied, with the --delete flag any files no longer in source will be removed from destination. The share is then unmounted automatically.

    The script is designed to be logged somewhere so make sure to tell it where, as I'm not sure how to redirect future output of a script to a file, so you'll need to invoke with something like:

    sh /Path/To/My/ > /Path/To/My/Log.txt
    Anyway, with this set up and running periodically you will keep a folder on your machine in sync with the SMB share, and if you make sure time machine can see the target folder then it will back-up with file-history.

Share This Page