0

I would like do real-time monitoring, discussing one part of it here about counting quickly. No packages about it in homebrew.

How can you have RAM-based filesystem in OSX?

  • 1
    Reading between the lines, I assume you'd like a RAM-backed filesystem (the equivalent of a "RAM disk")? – mjturner Jul 1 '15 at 8:56
  • @mjturner Yes. I want a RAM-backed filesystem. Any idea how in OSX? – Léo Léopold Hertz 준영 Jul 6 '15 at 8:41
1

Mac OS includes support for RAM-based filesystems via ramfs. Everything is RAM backed so it's incredibly fast with near zero latency, but the contents are lost upon reboot.

To create one and mount it under /tmp/mymount, create a script with the following contents and run it:

!#/bin/sh
NUMSECTORS=128000       # a sector is 512 bytes
mydev=`hdiutil attach -nomount ram://$NUMSECTORS`
newfs_hfs $mydev
mkdir /tmp/mymount
mount -t hfs $mydev /tmp/mymount

The above was adapted from the hdiutil manual page.

You can also do it in a one-liner (adapted from here):

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://XXXXX`

Where XXXXX is the size in 2048 byte blocks. There is also a useful script in this post on Superuser.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .