An AppleScript trick turns any NAS device into a Time Machine drive
  • 3 Comments
by John Biggs on November 10, 2009

genius
You can turn any network attached storage device into a Time Machine back-up drive with one simple step.

Simply download this app package and drag your drive onto it. The script adds the drive as a Time Machine capable device and then you can simply add it under Time Machine System Preferences.

The full script is right here if you want to roll your own:

on open names
set volumeName to names as text
set macAddress to (do shell script "ifconfig en0 | grep ether | tr -d '\\011' | sed s/ether// | sed 's/ //g' | sed s/://g")
set hostName to (do shell script "hostname -fs")
tell application "Finder"
set theSize to round (((capacity of startup disk) / 1024 / 1024) / 1024)
end tell

do shell script "defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1" with administrator privileges

do shell script "sudo hdiutil create -size " & theSize & " -type SPARSEBUNDLE -nospotlight -volname \"Backup of " & hostName & "\" -fs \"Journaled HFS+\" ~/" & hostName & "_" & macAddress & ".sparsebundle" with administrator privileges
do shell script "mv ~/" & hostName & "_" & macAddress & ".sparsebundle /Volumes/" & volumeName & "/" with administrator privileges

tell application "Finder" to eject volumeName

tell application "System Preferences"
activate
end tell

tell application "System Events"
tell application process "System Preferences"
set frontmost to true
click menu item "Time Machine" of menu "View" of menu bar 1
end tell
end tell

end open

via MacOSXHints

Comments rss icon

  • I don’t get it … I can already use any volume that is mountable, or a portion of that volume as my Time Machine backup space.

    I do this with my office laptop — it connects to my office desktop’s giant secondary drive and has a disk image sitting there which it opens and proceeds to backup to via Time Machine.

    Guess I need to read more about this.

  • I don’t understand what was the problem at the first place… I bought last week a NAS (WD MyBook 1Tb). I plugged it on my network, and TimeMachine found it right away. Few hours later I had my first backup done.

    What makes a NAS a TimeMachine “Supported Network Volume” ? Maybe the WD MyBook supports a protocol than the LaCie does not…

    I would be curious to know exactly why this guy needed this script to add his NAS in TimeMachine.

Leave Comment

Commenting Options

Enter your personal information to the left, or sign in with your Facebook account by clicking the button below.

Alternatively, you can create an avatar that will appear whenever you leave a comment on a Gravatar-enabled blog.

Trackback URL
Short URL
bugbugbug