Skip to content

Instantly share code, notes, and snippets.

@nigelr
Last active December 10, 2015 17:18
Show Gist options
  • Save nigelr/4466477 to your computer and use it in GitHub Desktop.
Save nigelr/4466477 to your computer and use it in GitHub Desktop.
Resizes TimeMachine sparesbundle maximum size and then locks the file
#!/bin/bash
# This script resizes a sparsebundle and locks the Info.plist to prevent timemachine resizing it.
# Usage
# resize.sh MacBook.sparsebundle 100g
# which resizes the sparse bundle to 100GB
echo "unlocking Info.plist"
SetFile -a l "${1%/}/Info.plist"
echo "Resizing '$1' to '$2'"
hdiutil resize -size $2 -shrinkonly "$1"
echo "locking Info.plist"
SetFile -a L "${1%/}/Info.plist"
echo "Complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment