wiki:TimeMachine
Last modified 6 years ago Last modified on 05/16/11 16:49:41

Back to MacInstall

Apple's Time Machine automatic backup software works very well using an external hard drive directly connected to a Mac. Things get complicated when using it on the network, though.

Security of Time Machine over the Network

Note that everyone with access to the network share will have full access to all your files unless you encrypt with something like FileVault.

Insufficiently Scary Time Machine Error

THIS MEANS YOUR DATA MAY BE GONE: "Time Machine completed a verification of your backups. To improve reliability, Time Machine must create a new backup for you." http://trac.biostr.washington.edu/trac/attachment/wiki/TimeMachine/tm-verification-new-backups.png?format=raw

If there is a network sync of your backup sparsebundle, contact Joshua immediately to see if yesterday's were not corrupted.

Restoring from Time Machine

Note: some operations are painfully slow over the network. It is faster to restore from a locally attached disk when possible.

Time Machine Restore

With a sparsebundle

  1. Mount the sparsebundle (in Finder, go to backup drive and double-click the file with a name like "mymac_12597abcde1.sparsebundle"). It will appear on the left under "Devices".
  1. You can manually browse into the backups via a path something similar to this:
    /Volumes/Time\ Machine/Backups.backupdb/joshuadfmac/2011-05-16-120448/Macintosh\ HD/Users/joshuadf/Documents/
    

Or you can use Time Machine.app, make sure Time Machine is in the Dock, then right-click it and choose "Browse Other Time Machine Disks..." and choose your disk.

http://trac.biostr.washington.edu/trac/attachment/wiki/TimeMachine/tm-choose-other.png?format=raw

You should see your backup in Migration Assistant too.

With a network mount of a drive with Backups.backupdb

mkdir /Volumes/TimeMachine
mount -t afp -o -i afp://uwsig@sigmacback.biostr.washington.edu/tmbackups3t /Volumes/TimeMachine

It will show up as an alternate disk in the Time Machine application, but not in Migration Assistant. (from MacOSXHints 10.5 Restore from network share Time Machine backups)

Backing up Time Machine over the Network

The only supported network device is Time Capsule, but it is possible to run time Machine on unsupported shares such as Samba. The most detailed instructions are Making Time Machine work with the ReadyNAS, but they apply to most any system. You can also store a sparsebundle on a external drive directly attached to your Mac which makes it easy to duplicate the entire volume.

The makeImage.sh script from InsanelyMac automates the process of creating the sparsebundle disk image with com.apple.TimeMachine.MachineID.plist. To use it, open Terminal and create a image at least at big as your disk:

curl -O http://mikestaszel.com/files/tonido/makeImage.sh
chmod 755 makeImage.sh 
df -hl; ./makeImage.sh 
# Filesystem     Size   Used  Avail Capacity  Mounted on
# /dev/disk0s2  233Gi  119Gi  114Gi    51%    /
# 
# makeImage.sh
# 	usage: makeImage.sh [size] [directory]
# 	Create a disk image with a max storage size of <size> gigabytes and copy it
# 	to your backup volume (if specified)
./makeImage.sh 240 /Volumes/myTimeMachineDisk
# required depending on your setup
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 

Log out and back in, mount your sparsebundle, and it should appear as a drive in System Preferences->Time Machine (for a local disk, just choose the parent disk and Time Machine will automatically use the sparsebundle). You may get this message stating "The identity of the backup disk has changed":

http://trac.biostr.washington.edu/trac/attachment/wiki/TimeMachine/tm-backup-identity.png?format=raw

Warning: This can unfortunately lead to a problem situation where your sparsebundles try to fill more space than your drive has.

Checking your Time Machine sparsebundle

To verify the latest time your sparsebundle was written, you can:

cd /Volumes/My Backups/jdfbook_314159e2718.sparsebundle/
ls -ltr bands/ | tail 

It should look something like this:

-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 15f
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 10
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 f
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 e
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 3
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 25
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 2
-rw-r--r-- 2 joshuadf staff  92836352 2010-07-08 14:50 1c
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 11
-rw-r--r-- 2 joshuadf staff 134217728 2010-07-08 14:50 1

Alternatively, you can mount the sparsebundle and look inside the Backups.backupdb directory.

Full Restore from Time Machine Network Share

  1. Boot from the installer DVD. Choose “Options…” to get the Utilities menu
  2. Utilities > Disk Utility to partition the disk the way you like it
  3. Utilities > Restore System from Backup… If your Time Machine backup set appears, then restore away. While there’s a button here to connect to a remote disk, that option wasn’t clickable for me. So we’ll have to mount our network volume manually.
  1. Utilities > Terminal Run this command to mount your backup volume manually (substitute your username, password, and so forth):
    mount -t afp afp://username:password@hostname/ShareName /Volumes
    hdiutil attach /Volumes/ShareName/foobar.sparsebundle
    
  2. Utilities > Restore System from Backup… and you should now be able to choose your Time Machine backups.

(from Full Disk Restore from Time Machine Backups - Over the Network)

Time Machine Server

To make a locally connected external disk drive available as a network backup drive, the drive needs to be mounted at boot. If it isn't, it won't be visible over the net until someone logs in.

In other words, local drives aren't mounted until someone logs in, and that's a bad thing if you need to use the drive for backups. Unless...

On the server, launch Terminal and enter the command:

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

to force the server Mac to mount its external disk at boot. Then it's visible without anyone needing to be logged in.

On the client side, automount can mount a network drive at boot, but Time Machine wants a drive on the Desktop; a drive mounted by automount does not mount on the Desktop.

Here's the work around. First, mount the network drive by hand via Finder->Go->Connect To Server. Use the server address afp://hostname/volumename. The host name can be a FQDN, IP address, or short name (if the host is in /etc/hosts). The volumename is the name the server uses when it mounts the drive locally.

After the drive is mounted on the Desktop, you can make it mount automatically to the Desktop at login via Apple Menu->System Preferences->Accounts; Click on User; Unlock; Select the Login Items tab, and drag the backup disk from the Desktop to the Login Items. Afterwards, the network drive will be mounted when you login, and Time Machine will be happy.

(wrb: 20080425)

remote backup access

You can make a backup copy of a sparsebundle via rsync -E ("extended-attributes").

First on the remote mac, enable the root account:

sudo su -
passwd
chsh -s /bin/bash

From Mac Backup machine:

rsync -Eaz ~/.ssh mynewmac:
# type your passwd
SOURCE="mynewmac:'/Volumes/Time Machine Backups/mynewmac_0beef3504c88.sparsebundle'"
DEST=/Volumes/tmbackups3t/rsync-from-elsewhere/
rsync -Eaz "$SOURCE" "$DEST"

If your remote Mac changes IP address, you may need to add "StrictHostKeyChecking no" to ~.ssh/config

Attachments