A Guide to RAM Drives
The basic premise behind a RAM drive (or RAM disk) is to improve performance of a running application by copying the program from a disk into a pre-defined area of memory. Since accessing memory is so much faster than accessing sectors on a disk, performance improvements were notable. Of course, due to the nature of RAM being wiped when you switch off or reboot your PC, the data in the RAM drive would be cleared each time these events occurred, so it would be necessary to copy the program again to the RAM drive.
The size of a RAM drive is really only limited to the amount of memory your computer has.
The first RAM Disks were seen in the CP/M operating system in 1980, through the launch of the Silicon Disk Systems - a utility written by Jerry Karlin who later became part of Microcosm Research Ltd. On the DOS side, IBM introduced a device driver called VDISK.SYS (for "Virtual Disk") with IBM DOS 3.0 in 1984. This used Extended Memory (XMS) for the RAM drive. In 1986 Microsoft added RAM disk support to MS-DOS 3.2 through a new device driver called RAMDRIVE.SYS. This was better than IBM's driver in that it could also make use of Expanded Memory (EMS). DR-DOS had their own too, called VDISK.SYS.
When created, a RAM drive appears just the same as a normal hard disk. In DOS, drives A: and B: are both reserved for floppy drives. The first hard disk in your system will be given the C: drive letter, and any further logical drives will be given D:, E:, F: and so on. After this, each RAM drive will be assigned the next available drive letter, so if you have just one partition on your hard disk (C:), your first RAM drive will be D:.
How to Setup a RAM Drive in MS-DOS
MS-DOS has a device driver called RAMDRIVE.SYS which can be used by adding a row to your CONFIG.SYS file, as follows:
device=c:\dos\ramdrive.sys [disksize sectorsize [numentries]] [switches]
where disksize is the size of the formatted RAM drive in kilobytes (so 32767 would create a 32 MB RAM drive).
sectorsize defines the sector size in bytes. Valid values are 128, 256, or 512. Typically you should use 512.
numentries restricts the number of files and directories you can have in the root directory of the RAM drive. This can be from 2 to 1024. If this is not specified a maximum of 64 files and directories will be imposed.
Switch | Meaning |
---|---|
/E | By default, MS-DOS will use conventional memory (that between 0 and 640K) for its RAM drive. This switch tells it to create the RAM drive in Extended Memory (XMS) - this is the block of memory you have above the 1 MB mark. You need to ensure you're also loading an extended memory driver such as HIMEM.SYS for this to work. |
/A | Creates the RAM drive in Expanded Memory (EMS). Use a driver such as EMM386.SYS to allow this to work. |
You can load RAMDRIVE.SYS high by using "devicehigh=" instead of "device=". You can also create multiple RAM Drives by having multiple similar lines in your CONFIG.SYS.
Example 1
device=c:\dos\ramdrive.sys 2048 512 1024 /e
will use the device driver ramdrive.sys that is located in the directory C:\dos to create a 2 MB RAM drive using 512 byte sectors. You will be able to store a maximum of 1024 files or directories in the root directory of the RAM drive. It will be created in XMS (Extended Memory).
Example 2
devicehigh=c:\dos\ramdrive.sys 4096 /a
will use the device driver ramdrive.sys that is located in the directory C:\dos to create a 4 MB RAM drive. The device driver itself will be loaded in high memory (the space between 640K and 1 MB) in order to free up conventional memory. The RAM drive will be created in EMS (Expanded Memory).