Skip to content

Instantly share code, notes, and snippets.

@nevali
Created June 20, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevali/2962444 to your computer and use it in GitHub Desktop.
Save nevali/2962444 to your computer and use it in GitHub Desktop.
#! /bin/sh
if `mount | grep " on /opt/cache" >/dev/null` ; then
echo "$0: Already mounted" >&2
exit 0
fi
SIZE=582715
if ! disk=`hdiutil attach -nomount ram://$SIZE` ; then
exit 1
fi
# Trim trailing spaces
disk=`echo $disk`
echo "New RAMdisk is $disk" >&2
diskUtil partitionDisk $disk 1 GPTFormat "hfsx" "%noformat%" "100%"
newfs_hfs -v 'Cache' -U 0 -G 0 -M 0777 ${disk}s1
sudo /sbin/mount -t hfs -o nobrowse ${disk}s1 /opt/cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment