Skip to content

Instantly share code, notes, and snippets.

@raggi
Created May 21, 2012 21:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raggi/2764761 to your computer and use it in GitHub Desktop.
Save raggi/2764761 to your computer and use it in GitHub Desktop.
#!/bin/bash
ramfs_size_mb=1024
mount_point=~/volatile
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'Volatile' ${ramdisk_dev}
mkdir -p ${mount_point}
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
echo "remove with:"
echo "umount ${mount_point}"
echo "diskutil eject ${ramdisk_dev}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment