Skip to content

Commit 1269f96

Browse files
committed
Util to create a RAMDisk on a Mac
Signed-off-by: Pedro Melo <[email protected]>
1 parent c0e8406 commit 1269f96

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bin/x-mac-ramdisk

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
#
3+
# Creates a RAM disk in Mac OS X
4+
#
5+
# Copied from http://pastie.textmate.org/private/igcxuzqqvlmlbavxooj2uw
6+
# by @antirez
7+
8+
ramfs_size_mb=1024
9+
mount_point=~/volatile
10+
11+
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
12+
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
13+
newfs_hfs -v 'Volatile' ${ramdisk_dev}
14+
mkdir -p ${mount_point}
15+
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
16+
echo "remove with:"
17+
echo "umount ${mount_point}"
18+
echo "diskutil eject ${ramdisk_dev}"

0 commit comments

Comments
 (0)