Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am running an SSD boot drive and a HDD drive on my Macbook Pro 5,5 and I obviously cannot have Time Machine filling up my SSD. I was wondering if there was anyway to have time machine create local backups of the users on my SSD, but store it on my HDD and be able to use the typical features of time machine local backups, because otherwise it would be unnecessary. If this question has been asked, I would appreciate a link, because I searched and could not find anything. Otherwise, thank you very much any help you can offer.

share|improve this question
    
I was wondering whether you managed to move the local Time Machine backups as described in my answer and comment below. If that's the case I'd appreciate if you could mark your question as answered. Thanks! –  jaume Mar 6 '13 at 7:46
    
I just logged on and noticed this. Really sorry it took me so long to mark it as answered. Thanks for the great walkthrough! –  JeffM Mar 25 '13 at 22:08
    
No problem, thanks for your feedback, I'm glad I could help! –  jaume Mar 25 '13 at 22:21

3 Answers 3

up vote 3 down vote accepted

I couldn't find any way of modifying the path /.MobileBackups, but you can create a folder on your HDD and then symlink it to /.MobileBackups:

  1. Open Applications>Utilities>Terminal.

    Now you will have to type several commands. Press return after every command for it to execute. When asked, type your password.

  2. The snapshots folder has complex permissions. The simplest way to preserve them is to copy the existing folder to the new location on your HDD:

    sudo rsync -ahvHE /.MobileBackups /Volumes/HDD/

    (replace /Volumes/HDD with the path to your HDD.)

    rsync options are:

    • -a: archive mode (recursive; copy symlinks as symlinks; preserve permissions, times, owner, group, device files, sockets and fifos)
    • -h: output result in human-readable format
    • -v: verbose, that is, show what the command is doing
    • -H: preserve hardlinks
    • -E: copy extended attributes like resource forks and ACLs
  3. Disable local snapshots (this will delete /.MobileBackups and its contents):

    sudo tmutil disablelocal

  4. Create symlink:

    sudo ln -s /Volumes/HDD/.MobileBackups /.MobileBackups

    (replace /Volumes/HDD with the path to your HDD.)

  5. Enable local snapshots:

    sudo tmutil enablelocal

  6. Create a local snapshot:

    sudo tmutil snapshot

  7. If you see a new snapshot dated "now":

    ls -l /Volumes/HDD/.MobileBackups/Computer/
    (...)
    drwxr-xr-x@ 3 root  wheel  102 Jan 28 09:05 2013-01-28-090534
    

    you're done!

If something went wrong or is not working as expected, revert to the original configuration:

  1. Disable local snapshots:

    sudo tmutil disablelocal

    This will delete the symlink /.MobileBackups. Should that not be the case, delete it with:

    sudo rm /.MobileBackups

  2. Enable local snapshots:

    sudo tmutil enablelocal

  3. Delete alternative snapshot folder on your HDD:

    sudo rm -rf /Volumes/HDD/.MobileBackups

    (rm -rf is a dangerous command that won't ask for confirmation before deleting the folder. Make sure the path is correct!)

share|improve this answer
    
Thanks! That looks great and well-written. I have a small problem that when I disable the local backup, the ./MobileBackup disk image is unmounted and rsync throws an error: building file list ... rsync: link_stat "/.MobileBackups" failed: No such file or directory (2) done sent 29 bytes received 20 bytes 98.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9] Thanks for your help so far, it would be great to get this working, so how did you get rsync to work? Thanks again. –  JeffM Jan 29 '13 at 1:20
    
I overlooked that tmutil disable immediately wipes out /.MobileBackups, that's why rsync complains and exits with an error, sorry for that. I've edited my answer, please try it out (don't forget to enable snapshots with sudo tmutil enable first). –  jaume Jan 29 '13 at 10:14
1  
Jaume- this was extremely helpful. On OSX 10.8.2, this allows me to write the time machine local snapshots, but for some reason I cannot read the contents of the folders in time machine. I'm sure it is some sort of permissions issue, but I can't figure it out. Any ideas? If I copy the folder off the second drive, and change permissions for access, the backups are there and complete. If I enter time machine, it has folders corrsponding to the dates the snapshots were made, but cannot find any contents. I do notice that the permissions are a bit different on the drive i rsynced to- it is not roo –  Benjamin Migliori Mar 5 '13 at 23:18
    
I'm glad it was helpful. As for your question: if you mean the backups are in /.MobileBackups but you don't see them when you enter Time Machine it could be a permission issue. /.MobileBackups is not meant to be accessed directly, and its internal structure, including permissions, is undocumented. You may peek inside (use sudo ls /.MobileBackups/Computer/<date>) or even copy files out of it, but don't change permissions. I'd recommend that you recreate /.MobileBackups from scratch as explained in my answer and test whether it works. If that's the case, it was a permissions issue. –  jaume Mar 8 '13 at 9:10

I know this is a someway old question/answer, but I'm re-doing this right now in Yosemite and I added a little fancy detail to this configuration: since I'm on Yosemite I've been forced to apply Benjamin's "root instead of sudo" way, it's currently working as expected, but I didn't like having an icon for the snapshot volume, something that you shouldn't need to see and access while doing normal stuff as a user, so I choose to hide the snapshot volume icon using the SetFile command (that, afaik, is installed via xcode)

using paths from previous examples, it would be:

SetFile -a V /Volumes/HDD/

and pouf, the volume icon is gone: local snapshots are totally invisible again, as usual, but still mounted (you can browse and even open directories via terminal, as with any other invisible directory in your filesystem)

I even made a little shellscript (not tested, because i already did it manually, so PAY ATTENTION BEFORE RUNNING IT, since it needs to be run as root as Benjamin explained in his comment/reply )

Final note, just fyi: for what i can see now, the snapshot volume can normally be encrypted

Thanks for your work, here is the bash script, clearly based on your replies:

#!/bin/sh

# description:
# move /.MobileBackups to a different volume, to avoid wearing your SSD
# this script must me run as root, not via sudo. 
# based on http://apple.stackexchange.com/questions/80183/any-way-to-change-the-location-of-time-machine-local-backups-mobilebackups-t

################################################################################

# safety measure to avoid kids running this script with no clue and blaming me.
# comment it
echo "always check what you run before running it" && exit


# syntax/help
if [ -z "${1}" ] ; then
    echo "\nusage:\t`basename ${0}` /Volumes/SnapshotVolume\n"
    echo "*** Please note that this script MUST be run as root, not via sudo ***"
    echo "*** just run \"sudo su\", insert your password and THEN run this script ***"
    echo
    exit    
fi 

# checks that this script is run being root, not via sudo
homeDir=`echo ~`
if [ "${homeDir}" != "/var/root"  ] ; then
    echo
    echo "*** Please note that this script MUST be run as root, not via sudo ***"
    echo "*** just run \"sudo su\", insert your password and THEN run this script ***"
    echo
    exit    
fi 


# get dest volume path
snapVolume="${1}"

# create a "Backups" directory inside the snapshot volume root directory
# please note that this is a safety measure: if the snapshot volume is not
# excluded from time machine backups, you'll find an already existing directory
# at /Volumes/SnapshotVolume/.MobileBackups (each volume has his own directory)
# so, to avoid any mess, I prefer to make a Backups directory and put the actual
# .MobileBackups inside it, at a non volume-root level
mkdir ${snapVolume}/Backups

# duplicate the existing .MobileBackups to the destination path
rsync -ahvHE /.MobileBackups ${snapVolume}/Backups/

# this double command will remove the existing /.MobileBackups directory and,
# if and only if the rm command exits with no errors, symlink the new directory
# cloned in the 2nd hard drive to the main drive /.MobileBackups path
rm -rf /.MobileBackups && ln -s ${snapVolume}/Backups/.MobileBackups /.MobileBackups

# makes the snapshot volume invisible in finder
SetFile -a V ${snapVolume}

# a final test, just because..
tmutil snapshot
share|improve this answer

If you are running OSX 10.8 or higher, something happens when you disable local snapshots such that the existing snapshots are no longer accessible via TM. To resolve this problem, use sudo -s to log in as the root user and execute the following code to modify Jaume's excellent tutorial:

cd /
tmutil disablelocal

rm -rf /Volumes/HDD/.MobileBackups/

tmutil enablelocal
tmutil snapshot
tmutil snapshot

rsync -ahvHE /.MobileBackups /Volumes/HDD/
rm -rf .MobileBackups
ln -s /Volumes/HDD/.MobileBackups /.MobileBackups

tmutil snapshot
tmutil snapshot

That seems to work so far.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.