Skip to content

Instantly share code, notes, and snippets.

@pawcik
Last active May 5, 2017 21:28
Show Gist options
  • Select an option

  • Save pawcik/6f2be2ac880757fcd992e0ce64508dbb to your computer and use it in GitHub Desktop.

Select an option

Save pawcik/6f2be2ac880757fcd992e0ce64508dbb to your computer and use it in GitHub Desktop.
Create sparsebundle timemachine image
# thanks to http://www.makeuseof.com/tag/turn-nas-windows-share-time-machine-backup/
#create sparce image size (prefer twice of mac local drive)
hdiutil create -size 1024g -type SPARSEBUNDLE -fs "HFS+J" TimeMachine.sparsebundle
#mount sparse bundle image
# how to make it persistent ?
hdiutil attach -mountpoint /Volumes/TimeMachine /Volumes/Data/TimeMachine.sparsebundle
# tell timemachine to use this image for backup
sudo tmutil setdestination /Volumes/TimeMachine
#@credentials https://dillieodigital.wordpress.com/2013/08/02/quick-tip-how-to-mount-a-timemachine-network-drive-at-login/
try
do shell script "mkdir -p /Volumes/Data" with administrator privileges
do shell script "mount -t afp 'afp://user:password@TIMEMACHINE_IP/Data' /Volumes/Data" with administrator privileges
do shell script "hdiutil attach -mountpoint /Volumes/TimeMachine /Volumes/Data/TimeMachine.sparsebundle" with administrator privileges
end try"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment