Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can you create a Ramdisk in OSX?

Just wondering if there's a way for OSX to create a Ramdisk on startup so I can manually copy a frequently-used app to it. Since the app swaps constantly (and I have more than enough memory to spare; 16GB) why not?

8-Core Mac Pro, Mac OS X (10.6.4)

Posted on Oct 16, 2010 3:43 AM

Reply
13 replies

Oct 18, 2010 11:28 AM in response to R. Yannetta

Actually turns out, let the OS do what it can, otherwise the cat is just going to chase its tail and inefficient.

If you want something that works, get an SSD system drive.

As for memory, OS X uses it as much as possible and then some to cache frequently accessed files, apps, even directory index.

Not sure how having an app swap constantly means or how a RAM disk would help. Leave it open and let OS X fix its pages to memory. Forcing something to be always memory resident is used at times in databases and could assign a virtual volume.

Leopard Cache Cleaner use to have a RAM disk feature, not sure if it is still there.

Oct 18, 2010 5:46 PM in response to Chris CA

Actually, I found a way. For example, if I wanted to create a 4GB ramdisk in OS X 10.6, I'd type

diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://8192000`

Include the tilde as shown. Actually, just copy/paste it to try, it works well for me. You notice that the last number (the 8192000) is double the size of drive in GB that I want.

Oct 19, 2010 3:07 AM in response to R. Yannetta

Here is are two scripts I wrote for those who want
an easy way to create ramdisks for OS X.

http://azlist.info/kj/mac/utilities/ramdrive2.0.zip

+ramdrive readme:+
ramdrive and ramdrive2 create an OS X HFS drive from Ram.

ramdrive lets you set size of ramdisk

ramdrive2 lets you set size of ramdisk and set name of ramdisk.

rename scripts as needed.

"chmod +x" script before using (set executable).

place in directory of your choosing, /usr/bin directory is a good spot,
as it puts it in the user path.

type name of script without options for built-in help.

enjoy.

Oct 19, 2010 1:23 PM in response to The hatter

"My experience in the past with RAM disk in OS X was that it would still write changes to disk"

It guess data could still be written to the page file, if there wasn't enough ram available for both the
system and the ram disk. Of course, the ram drive gets priority, which could aggravate ram
availability to applications if ram resources were becoming depleted.

" - and was basically hindered performance."

Increased page file activity and/or limited ram resources could definitely hinder performance.

I was just using a 2GB ram drive earlier today (SL 10.6.4). According to activity monitor, no page
outs were being employed. actual ram usage was less than 2GB total. I was only working with
300mb size files in the ram drive though. I guess SL only allocates the memory as needed for the
ram drive when it is needed. According to activity monitor, it only showed increase in used memory
when I began filling up the ram drive with files. As soon as I deleted (ejected) the ram drive,
the memory availability returned.

I use the ram drive for many things, but mostly for a temporary place to store data I am using
for encryption and the making of encryption keys. Once done, I can delete the drive and no traces
of its contents are left. SL also allows encryption of its page file, so if some data escapes into the
pagefile, it is at least the escaped data is encrypted.

Kj

Oct 19, 2010 2:51 PM in response to KJK555

A. I have not tried RAM disk in 3-4 yrs
B. OS X has improved
C. Any changes though made to the RAM disk were being written to disk as well - immediately - so maybe poor implementation of RAM disk; of OS X.
D. 6GB at the time seemed like 'plenty' but obviously not huge amount, I wanted to do what I use to - force a browser to use for disk cache, use to do that with IE5 and OS 9 and 10MB RAM disk.

Oct 19, 2010 7:13 PM in response to baltwo

hi baltwo:
With the advent of faster hard drives and improved cacheing, ram disks don't give much of an edge
any more in speed except in a few circumstances. I use them mostly for security, in the deployment
of making keys and stuff. Leaves no tracks when you delete the scratch disk.

My scripts allow for instantly creating ram disks with custom sizes (in mb's) and names. Names with spaces are supported as well by enclosing disk name in quotes. Any size within Ram limits is
supported, I have made them as large as 6gb. Deleting them is as easy as simply ejecting them.
The scripts invoke hdid and hdiutil to create the ram disks, using the same method as described
on the page that you linked to.

Can you create a Ramdisk in OSX?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.