A RAM disk is an odd application of memory: it is, in essence, memory (RAM) applied in usage as a hard drive. In other words, part of the RAM storage is actually used as a volume, as a kind of second hard drive.

A block of memory is set aside and is used as a disk in a setting involving a RAM disk. The result is a drive with "memory speed". Because memory is faster than the typical hard drive (instantaneous and electronical instead of slow and mechanically pokey), access to the RAM disk is very quick, and operations on documents on the RAM disk is lightening.

Mac OS X and RAM disks

The Classic Mac OS used to support RAM disks by means of the Memory control panel. Mac OS X only supports ram disks from command-line tools. Because on Mac OS X ram disks are handled by the operating system instead of the firmware, when the operating system restarts, the ram disks are lost.

Data volatility issues

Data, when copied to a RAM disk, may appear to be volatile -- as it is in memory instead of in disk, many people fear that the slightest crash will render the data obsolete; a 500 KB document may suddenly vanish should the system come to grief.

On a Macintosh running a RAM disk, this is impossible. It is particularly impossible for the PowerBook 100, it being the only Mac laptop that preserves the contents of the RAM disk even when shut down. On other machines, data on the RAM disk survives through resets and through sleep time, and is lost only when the Mac is switched off in an ordinary manner. Portables report a higher rate of data survival on RAM disks than desktops.

Creating a RAM disk

On a System 7 or later Mac, proceed to the Memory control panel, and activate the RAM disk option. Select your desired size (not too big!), and restart.

On Mac OS X a ram disk can be created using the shell. The following command creates the largest ram disk possible on Tiger, 2.2 GB.

diskutil erasevolume HFS+ "ram disk" `hdiutil attach -nomount ram://4629672`

Since after each restart the ram disk is lost, the following AppleScript application can be used as a login item to make a new one.

do shell script "
if ! test -e /Volumes/\"ram disk\" ;  then
diskutil erasevolume HFS+ \"ram disk\" `hdiutil attach -nomount ram://4629672`

Resizing a RAM disk

The contents of the RAM disk must be copied and saved back on to the hard drive, and the RAM disk must be completely empty, before the Mac will allow you to resize the RAM disk.

Removing a RAM disk from use

A RAM disk can be deleted only when all contents have been moved onto a hard drive or other device, leaving the RAM disk completely empty. On a System 7 or later Mac, proceed to the Memory control panel, and turn RAM disk off. After a restart, the settings kick into effect.

RAM disk issues

Community content is available under CC-BY-SA unless otherwise noted.