RAM Disks

ramdisk_banner.png

People that know me sometimes mistake me for someone who simply “likes Apple”. While I certainly do[1], it would be more correct to say that I love computers of all types, and happen to like the ones that Apple makes, for most uses.

So, if you’re like me and just enjoy nerding out about electrons moving around on silicon, you’ll love the RAM disk.

The idea is simple; your OS takes a chunk of system memory (RAM) and creates a file system on it and then mounts it for use like any other disk. Okay so you get the concept but why would you do it?

It’s fast. Very fast.

Are there downsides? Yeah. First is you probably don’t have that much RAM in your system compared to what you have in traditional disk storage. Second is when you lose power or reboot your RAM disk is gone.[2]

But, it’s really fast. I can think of two reasons you could use a RAM disk on a modern system. The obvious and useful one is to point software cache files at it. Many professional applications need to make temporary cache files and the faster it can the faster you can work. The second reason is just because it’s fun.

So, how do you make one? Being the Apple guy I am here’s how to do it on macOS:

  1. Download a copy of RAMDiskCreator by Florian Bogner.[3]
  2. Unzip the app and launch it.
  3. Enter a size and name and click Create RAM Disk.

The app is helpful and tells you how much space it sees as free memory. Don’t be surprised if it’s not a lot. Part of the job of the OS is to use as much RAM as it needs and it doesn’t always let go of RAM unless it needs new space, so even with what seems like few or no programs open, you may not have much ‘free’ RAM. Try it out on a small size first for kicks or head over to Terminal and run the command sudo purge and enter your admin password. That tells your OS to go through and release any RAM that isn’t actively being used. Then restart RAMDiskCreator and your amount of free RAM should have gone up.

Benchmarks

7200 RPM external drive connected via USB 3: 155 MB/s read, 155 MB/s write

Samsung 850 EVO SSD connected via USB 3: 344 MB/s read, 427 MB/s write

RAM disk: 2880 MB/s read, 3762 MB/s write

ramdisk_benchmarks.png

[All benchmarks were run using AJA System Test 2.1 at a Resolution of 1920x1080 HD–1080p, File Size 4 GB, Codec 10bit YUB]


  1. For the most part.  ↩

  2. If you’ve ever wondered why you lose your work when a program or computer crashes it’s because of this. The changes you had made only existed in RAM and hadn’t been saved to disk yet. When the app crashes it’s RAM is released back to the OS, and if the power goes out all the data in your RAM is zeroed out.  ↩

  3. Also on that post he explains how to do it in Terminal if command line is your jam.  ↩