Skip to content

Instantly share code, notes, and snippets.

@gzagatti
Last active November 21, 2020 17:20
Show Gist options
  • Save gzagatti/e0958e20d6ee2c3410f5 to your computer and use it in GitHub Desktop.
Save gzagatti/e0958e20d6ee2c3410f5 to your computer and use it in GitHub Desktop.
Set up time machine with sparse bundles on NAS drivers

Time Machine Backup w/ Sparse Bundles

  1. create a sparse image: hdiutil create -size 600g -type SPARSEBUNDLE -fs "HFS+J" NAME_XXXXXXX.sparsebundle -volname 'untitled' -encryption
  • ideally the sparse bundle should have about twice the size of your Mac's storage
  1. copy sparse bundle to the network and then mount it: rsync -aE NAME_XXXXXXXXXXXX.sparsebundle /Volumes/DRIVE/.

  2. remove the sparse bundle from machine: rm -rf NAME_XXXXXXXXXXXX.sparsebundle

  3. tell time machine to backup your mounted drive: sudo tmutil setdestination /Volumes/TimeMachine

  4. head to System preferences, then open Time Machine settings; you should see your virtual drive as the default backup destination

  5. mount your bundle at boot:

    try
        mount volume "smb://readyshare/MacBackup"
    end try
    
    do shell script "hdiutil attach -mountpoint /Volumes/MacBackup/ /Volumes/MacBackup/TimeMachine.sparsebundle"
    

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment