Apple Wiki
Advertisement
Apple Wiki

A RAM drive (or RAM disk) is a program which uses computer memory to mimic a storage volume, such as a hard disk drive.

Description[]

The program sets aside a user-definable block of RAM to be used as a drive, which can store and access files at far greater speeds than mechanical storage media. Unlike a real drive, a RAM drive would lose such stored data when most computers are turned off.[1] In some cases, it is possible for the data to survive a restart which does not interrupt power to the computer's memory. Improved performance of solid-state drives have decreased the usefulness of RAM drives in newer systems.[2]

RAM disks on Macs[]

Classic Mac OS used to support RAM disks by means of the Memory control panel. Mac OS X only supported RAM disks from command-line tools. Because Mac OS X handled RAM disks through the operating system instead of firmware, restarts would not preserve the contents in memory.

Data volatility issues[]

Data, when copied to a RAM disk, is subject to volatility -- as it is in memory instead of written to disk, some users fear that a crash would cause such data to vanish. A few Macintosh models, such as the Macintosh Portable and PowerBook 100, use static or low power RAM that are capable of retaining their contents while shut down, as long as the battery retains some power. On other classic Mac models, data in the RAM disk can survive restarts and sleep, and is lost only when the Mac is completely shut down. Portables reported 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`
fi
"

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 will take effect.

RAM disk issues[]

References[]

External links[]

Advertisement