Create A High Speed RAM Disk For Your Mac 1

Tip

Share
Create A High Speed RAM Disk For Your Mac

Hey,

If you want a high speed Mac, you could buy the latest quad core iMac with plenty of RAM, you could speed it up even further with a SSD drive, this allows really fast read and write speeds, allowing a speed increase. However, these tend to be a bit expensive. The solution to this is build a RAM Disk. This is a temporary solution which allows you to use a part of your RAM as a virtual disk. Excellent if you have a program that takes ages to write to disk and you need to output right away. It isn’t a solution for every day use, and it does come with some problems, however if you briefly need the speed increase and your hard drive won’t cut it, its a great solution. Its also a fun to mess around with.

What Is A RAM Disk

A RAM disk is a method in which we use a portion of the available memory on our system as a virtual hard drive. In our case a disk image. We can then place data into this disk image, like a normal disk, except it is actually in RAM. RAM is very fast and if some apps use a lot of disk access we can then move it into RAM and get a speed increase. Good applications shouldn’t need to have this method, however if you have a problem where there is lots of disk access we can temporarily alleviate the problem.

There are problems with a RAM disk. The data disappears when you restart (and if you go to sleep, this can be a problem), it can’t be used as a permanent solution. We also have some problem with paging. Since this solution uses RAM, if your system begins to run out of RAM normally, it will take the RAM disk out of RAM and put it to the hard drive. This negates any speed savings.

The Terminal Method

The quickest method is to use Terminal. Open up Terminal in Applications > Utilities and type the following:

diskutil erasevolume HFS+ "Ram Disk" `hdiutil attach -nomount ram://2100000`

This will create a ~1GB RAM disk, called “Ram Disk” (which looks like a normal, eject able, disk image) about 1GB in size. The size is determined by the number (in this case 2100000) which is in terms of the block size. One block is about 5.3kb. Adjust the number until you get the size you want. If you go too big, it doesn’t matter as the disk only consumes RAM as you put stuff in it. You want to leave plenty of RAM free for normal system stuff, so don’t use more than half of you maximum RAM.

Finder showing the RAM disk. All contained in memory.

You can now put data into this disk image as normal, you can treat it like a normal hard drive. The RAM disk will use RAM as you put stuff into it. If you look in Activity Monitor is will come up as ‘diskimages-helper’.

To remove the disk image (and the data contained within), simply eject the drive.

Using An App

If this is a bit complicated, you can use an app. There is plenty out there on the Mac App Store, however there is a cool one from Boredzo. When you download and unpackage the app you can create a RAM disk using the interface. To get the options settings up, hold option when you double click on the app.  Here you can create a RAM disk of your choosing and change the RAM disk name. Its quick and simple.

Its quick and easy to create a RAM disk with this app.

The advantage of this app is that it creates a disk when you double click on the app. Plus if you put the app as one of your login items it will automatically create a RAM disk when you login. The results of creating a RAM disk with an app or command line is the same.

Speed Increase Results

So we have created this cool high speed disk. How fast does it actually go? We can use a tool such as Xbench (or any of you favourite bench mark testing app) to get a speed difference. If you set the app initally to use your hard drive, then repeat the test using the RAM disk you will notice a speed difference.

An XBench increase from 180 to 369 all from the RAM disk.

The speed increase is pretty much solely down to the RAM disk. The increase does from 50.36 to 2633.64 for the disk test, this translated into a global score of 369 from 180. Clearly a difference.

I would like to see some real world results, using an app that sends a lot of data from disk. I can imagine if you need to temporarily compile videos or images that something like this would come in useful.

Conclusion

To conclude, its pretty simple to make a RAM disk. You will see speed improvements if used in the right environment. This won’t work with every app, but between applications that may use the hard drive it might be a winner.

If you have any questions, comments or examples of this in action please leave a comment below. I have tested this in Snow Leopard and should work in Lion.

If you have enjoyed this article please +1 it on Google.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips