Introduction
RAMDrive is a kernel driver that allows you to use physical memory as a high speed disk.

History and Due Credit
The source code for RAMDrive was copied from the November 26, 1997 Be Newsletter.  I have updated the code to work with R4 for Intel and PPC platforms, and added some icons. Thanks to Be, Inc. and Dmitriy Budko for providing the initial code.

The icons are copied from the VirtualMemory application (with a green and red disk light added).

Installation
- Start Terminal and cd  into the directory into which you downloaded RAMDrive.
- cd  into either the PPC or x86 directory.
- Type ./install

The installation script will copy the RAMDrive driver into /boot/home/config/add-ons/kernel/drivers/dev/ and add the following three lines to the end of UserBootscript

# RAMDrive
mkbfs /dev/disk/virtual/ram_drive RAMDrive
mountvolume RAMDrive

You could consider adding commands to automatically copy files into the RAM drive (see below for an example).

Configuration
You can change the size of the RAM drive by changing the #define RAM_DRIVE_SIZE line at the top of "driver.c". You will need to rebuild the project and re-install RAMDrive.

Currently, the size is set to 16MB.

Caveats
Some important considerations on using any RAM drive:

- Only use a RAM drive when you have a excess of physical memory. If the machine starts to use virtual memory, you'd be better off without the RAM drive. Consider getting extra memory specifically for your RAM drive.

- Only use a RAM drive for files you don't mind losing. Crashes, power failures, and  shutting down the machine will destroy the contents of the RAM drive. Copies of read-only files from a hard disk are the best candidates.

- Only use a RAM drive for files that you know are going to be used frequently. Header files, system libraries, shared code libraries, and the BeBook are good examples.

Sample Usage
With the above considerations in mind, I use a RAM drive to store my system header files and system libraries.

Specifically, I've added the following lines to my UserBootscript:

mkdir /RAMDrive/develop
mkdir /RAMDrive/develop/headers
mkdir /RAMDrive/develop/lib

mkdir /RAMDrive/beos
mkdir /RAMDrive/beos/system
mkdir /RAMDrive/beos/system/lib

cp -dpR /boot/develop/headers/* /RAMDrive/develop/headers
cp -dpR /boot/develop/lib/* /RAMDrive/develop/lib
cp -dpR /boot/beos/system/lib/* /RAMDrive/beos/system/lib

For long programming sessions, I  create a directory called "(Objects)" on the RAM drive and create a symbolic link to it in my current project directory. The result is decreased linking times. When I restart the machine, however, I must do a complete rebuild of the project.

Contact Info
Questions or comments?  Please e-mail me at <petersens@jps.net>.
