Created
October 8, 2015 15:05
-
-
Save ivanrad/abb4b00f9d8845245a5f to your computer and use it in GitHub Desktop.
maketmpfs (OS X)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
tmpfs_size=1024 | |
tmpfs_target=$HOME/tmpfs | |
tmpfs_size_sectors=$(($tmpfs_size * 1024 * 1024 / 512)) | |
tmpfs_dev=$(hdid -nomount ram://$tmpfs_size_sectors) | |
newfs_hfs -v "tmpfs" $tmpfs_dev | |
mkdir -p $tmpfs_target | |
mount -o noatime -t hfs $tmpfs_dev $tmpfs_target | |
echo "unmount with: umount $tmpfs_target && diskutil eject $tmpfs_dev" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment