SUMMARY: RAM disk (long)

From: Luke W. Mentzer, AT&T - GBCS Labs, Denver (
Date: Tue Sep 20 1994 - 13:07:07 CDT

Sorry for the long delay in posting this summary.
Thanks to all who responded. The best way to do this seems
to be to use tmpfs.

Responses are included below:

Craig.Warner@Ceram.COM (craigw)

         1) What is a RAM disk?
The most common variety is a SCSI device which emulates a hard drive,
but uses DRAM for its storage mechanism. Logical ram disks can also
be configured by using a portion of main memory.

         2) How to use a RAM disk?
It can generally be used anywhere a hard drive is, but applications
are normally limited to situations where hard drive latency is a
bottleneck. Ram disks are 30 - 100 times more expensive than hard
drives per MB.

         3) How to setup a RAM disk?
SCSI ram disks are set up with the the same format, newfs, and mount
commands used on a regular disk. In memory or other (SBUS) may require
specific setup SW.

         4) Any associated overhead, if any, that occurs with a RAM disk
A SCSI ram disk should have no additional overhead to the OS. Other
types of "ram disks", ie. in memory or SBUS based usually have additional
OS overhead.

         5) How to measure the performance improvement gained by a RAM
The best way is by looking at overall system performance - and wall
clock time on the applications and or operations you are interested
in speeding up. If you isolate certain operations (i.e. random
4K reads), the ram disk will show dramatic improvement over hard drives.
These number rarely translate into application speedup, however.

Ram disks rarely provide significant improvement for sequential
transfers (unless you have very old disk drive). The best cases
are when you need to do random read and
write operations on a dataset that is significantly larger than
main memory.
Ian MacPhedran <>

         1) What is a RAM disk?
A RAM disk is a virtual device which presents a filesystem which is
resident in the computer's physical memory.
         2) How to use a RAM disk?
Same as any other filesystem.
         3) How to setup a RAM disk?
mount -t tmp swap /ramdisk

Note: on Solaris 2.x systems, /tmp _IS_ a "RAM disk" already, by default.

         4) Any associated overhead, if any, that occurs with a RAM disk
Your memory gets gobbled up by the files on the "disk", so that you will
run out of memory when the filesystem fills (and vice versa). This is not
a pleasant prospect.
         5) How to measure the performance improvement gained by a RAM
Check out the man page for tmpfs. It seems your customer may be coming
from a microcomputer environment. tmpfs is somewhat different from what
the customer may expect, and you may want to familiarize yourself with
tmpfs is, and what the user actually wants. (I.e. get a good description
from your customer what is expected of the "RAM disk".)
cristian@licanantay.Corp.Sun.COM (Christian Candia White - Technical
Manager Latin America)

        1) What is a RAM disk?
It's a pseudo disk which can be accessed using file system operations,
so you can create directory, files, etc.. The advantage is that all
files are in real memory, so the access times are the memory ones, and
the seek time is 0. You'll also loose the files if the machine is
rebooted, or power off.

        2) How to use a RAM disk?
        3) How to setup a RAM disk?
In SunOS the RAM disk doen not come in the OS. The close thing is the
tmpfs psuedo file system. It's possible to write a device driver to do
it. Acctually the example on how to do it is in the Appendix D of the
writing devide drivers book for Solaris 2.2.

        4) Any associated overhead, if any, that occurs with a RAM disk
Some of your real memory will be used by the RAM disk.

        5) How to measure the performance improvement gained by a RAM
You will get a lot of increase of performance in disk bound
applications. If you application does not use disk, no gain at all.
Dave Fetrow <>

 It's been awhile but:

         1) What is a RAM disk?
 An usually large block of RAM with an interface that makes it looks like
a disk to the operating system. It may, or may not, go through the SCSI
to do this. The only one I remember seeing for a Sun looked like a disk
was installed like a disk and connected like a disk.

         2) How to use a RAM disk?
 Typically as a swap partition or for highspeed access to a database.
Note that it only makes sense in a traditional and well-tuned Unix system
if you have pretty much maxed out system RAM...which acts as a disk cache
not busy (SunOS is tuned badly in some ways...see
the utterly amazing "UNIX-HATERS HANDBOOK" for a particuarly grevious
example of something you want to change if you have a lot of system RAM).

         3) How to setup a RAM disk?
 Either a special driver is added to the kernel or you pretend it is a
disk. If the later; it probably has a SCSI cable.

         4) Any associated overhead, if any, that occurs with a RAM disk
 The RAM is usually much slower & cheaper than system RAM and you are
through the overhead of filesystem calls. Think of it as a fast SCSI disk
0 access time and you won't be far off. Note also that SCSI can't push
bytes through as fast as the system memory bus.

         5) How to measure the performance improvement gained by a RAM
 You take it out and replace it with a regular disk.
Gregory Bond <>

RAMdisk is something that is popular with PCs - using a chunk of memory
as a
"disk drive". This makes sense in a PC environment, but is much less
in a Unix environment where memory can be efficiently used for a whole
jobs, including as a disk cache.

You might look into tmpfs (see tmpfs(4)), which is a filesystem created
the swap partition. Is faster than a normal disk drive, but you lose the
if the machine crashes.
Todd Kover <kovert@cs.UMD.EDU>

uhh, this is kind of a silly idea to do on a workstation. A RAM disk is
essentially something that looks like a disk to the user, but is really
something that lives solely in RAM. As for how to use it, you'd just cd
to it like any other mounted filesystem. As for setting one up and
well, that I'm not really sure about how to do that exactly.

As for why it's silly -- the workstations use disk space as virtual
when regular RAM gets filled up, so it seems kind of foolish to allocate
RAM as a disk when you're using disk space as RAM at a different point.

This is the case for a "pure" RAM disk, anyway.

Another option offered on the Suns, anyway, is tmpfs. This is often
used for /tmp, but you can really mount it anywhere. Essentially what
happens is memory is used as a temporary file system and as the actual
that is needed, part of it swaps out to disk. (essentially the file
is invading part of the Virtual Memory). The downside to this is that if
fill up the filesystem you could run out of memory.. This may-or-may-not
be a concern. Do a "man tmpfs" for more information on how to accomplish
this one.
bern@penthesilea.Uni-Trier.DE (Jochen Bern)
         1) What is a RAM disk?

a) A Disk (Emulation) in RAM. I.e., you access a "File System" as you
   normally do, but the Stuff actually resides in your Host's Main
b) A Unit with its own RAM and an Interface which actually lets the Host
   *really* think it's a Disk. Apart from that, the same.

         2) How to use a RAM disk?

Like any other Disk.

         3) How to setup a RAM disk?

ad a) To my best Knowledge, the "real McCoy" is only available on PCs.
      The best Approximation you can get on a SUN is to use TMPFS.
ad b) Buy it and follow the Instructions.

         4) Any associated overhead, if any, that occurs with a RAM disk

ad a) Occupied Main Memory
ad b) Additional Power Consumption and costs real $$$
Other than that, no Overhead but a big Gain of Speed.

         5) How to measure the performance improvement gained by a RAM

There's no real real Improvement you can read up somewhere. People
might guesstimate your Improvement once they know the Software you're
running, but the only reliable Figures will come from a Test Run.
-------------------------------------------------------------------------- (Iain Massey)

RAM disk is a PC idea. You grab the interrupts to make what seems like
a disk drive (R: or whatever) but is actually a slab of memory. Even
in the PC world, it's probably better to use a good cacheing controller
than mess about with RAM disk.

Since Unix does quite good disk cacheing anyway, I can't see any use
for such an idea on a Sun.
-------------------------------------------------------------------------- (Eckhard Rueggeberg)

> One of my customers wants to set up a system that uses RAM disk.

Probabely he hasn't got his Workstation for long, has he ? Is he
a PC fugitive ?
The concept of a DOS RAMdisk is not valid in a virtual memory OS
with disk caching. But you can install him /tmp as a tmpfs, which
comes close to a RAM disk concept, as it is a file system created
in virtual memory, i.e. in RAM if you have enough, or on the swap
space else. Or, if he wants to spend money, you can buy him a
CERAM (?) RAM boead which you can SCSI-mount and use for /tmp. To
measure the speed of any file system, use iozone (ask archie where
to find it).
-------------------------------------------------------------------------- (Raymond Trzaska)

1) RAM disk is a memory based disk - you can either buy an external disk,
        which looks like a disk but is in fact memory chips, or
        you can use your systems memory and swap as a disk

        look up the man pages for tmpfs - which gives a nice description
        of setting it up.

2) use it just like disk - except, if you are using tmpfs then the files
are lost
        in a reboot, as they exist only in memory.

3) for the external ram-disk - just switch on, newfs? and go.

   for the tmpfs version - read the man page on tmpfs. e.g.:

        mkdir /ramdisk
        mount -t tmp swap /ramdisk

        your system configuration must include the option for tmpfs ( i
think it
        is enabled by default ).

4) the overhead is it shares memory/swap with your swap file system
- by more

5) how do you measure performance anyway ?:-)
Dear Luke,
        there is something called tmpfs in both SunOS 4 and SunOS 5 which
does something like a ram disk. It is used as the default config. for
sunos 5 machines, so perhaps your user already has it. I say 'something
like a ram disk' because tmpfs is based on the virtual memory of the
which is made up of RAM and a swap disk. We find it flexible and
-------------------------------------------------------------------------- (Steve_Kilbane)

In article <>, you write:
> 1) What is a RAM disk?

a file system that resides in memory, rather than on a disk.

> 2) How to use a RAM disk?

like any other directory tree. the difference is that the contents are
lost when you reboot the machine. note that on sunos 4.1.x, there are
bugs which mean named pipes (FIFOs) tend not to work on a tmpfs (see

> 3) How to setup a RAM disk?

mount a tmpfs file system. See the manual page for mount. Note that you
can only mount one tmpfs on a machine, and you may already be using it

> 4) Any associated overhead, if any, that occurs with a RAM disk

well, it eats into your swap space. with a normal disk, the system can
flush cached information onto the disk if it needs to, but this isn't an
option with a tmpfs.

> 5) How to measure the performance improvement gained by a RAM
> disk?

try doing the same set of operations with a normal disk and with tmpfs.
you should read and write *lots* of data (many megabytes), otherwise,
you'll hardly see any difference at all, because the system will cache
the normal fs's info, too.

also, try creating and deleting lots of files and directories. This
be much faster on a tmpfs, because the system always flushes directory
updates to the disk (for consistency).
-------------------------------------------------------------------------- (Peter Allan)

In June 1994 I posted a question, the guts of which (with one reply)
appear below.

A RAM disk is a RAM gizmo that pretends to be a disk.
A description is in
    "The PC Configuration Handbook; 2nd Ed, by John Woram".
    It is my only PC book, honest !

Your users can probably not distinguish it from a true disk (apart from
the speed).
Setting up ....... ask someone who's used one.

> From: bmiller@ceram.Corp.Ceram.COM ( (Bill Miller))
> To:
> Subject: RE: slow performance - much disk access (fwd) LEAD
> Peter,
> You could try a RAM disk. CERAM has an SBus RAM disk that
> might do the trick for you. You can configure the capacity up to
> 960MB. You can get more information by mailing to
> > We have one user with a persistent performance problem.
> > (Yes, but they're not all like this one.)
> >
> > He has a program (written in Fortran) which does very many
> > small writes to disk. It is disk-bound most dramatically, with
> > ps -v showing 0% CPU, and the disk performance meter
> > remaining steady at about 50% for the whole run time.
> > The sun is a Sparc 2 OS4.1.1 with 32MB RAM and 200MB swap.
> > The disk is local, sd1a and is nearly 1GB.
> >
> > I have suggested tmpfs and the buffer option in Fortran.
> > We find these do not cure it separately or together.
> >
> > Your suggestions please ?
> > Thanks
> >
> > PeterAllan
> >
> >
brobbins@Newbridge.COM (Bert Robbins)

Do a "man tmpfs" this is a RAM disk, actually it uses swap space and
improves performance tremendously. The one drawback is that if the
system crashes all data is lost.

a ram disk (also called a solid state disk) can be a SCSI device that
looks to the OS as "just another disk drive". But actually it is a
device that consists of RAM for normal operations, a small battery
incase of power failure, and a disk drive to back up the RAM
before the battery looses power.

It goes about 100 times as fast as a disk drive and can be very useful
when you have a disk "hot spot" that is the bottleneck in system
performance (especially for databases).

A company called DES (Disk Emulation Systems) of Santa Clara, CA
makes them (I'm sure there are also many others). Their phone
number is (408) 727-5497
-------------------------------------------------------------------------- (Brian Utterback)

A RAM disk is simply a logical disk device that is implemented via the
computer's main core memory, rather than through magnetic media. The
is that RAM has much higher access speeds. The disadvantage is that the
used by the RAM disk can no longer be used for its regular function by
computer. And the second disadvantage is that the RAM disk is volatile,
is to say that the contents are wiped clean by system reboots and

A RAM disk is created under SunOS via the tmpfs file system type. There
are a
couple things to note however: One, RAM is used when available, but
written to the TMPFS filesystem are subject to swapping to disk, just as
memory resident files are. If you run out of RAM, you may start
However, even in this case the RAM disk should be faster than a regular
because the control info associated with it is never swapped. Two, file
record locking is not supported on a RAM disk.

You can make a TMPFS filesystem by issuing the command:

        mount -t tmp swap /tmp

You can put the file system wherever you want, but /tmp is common.

You can cause the tmpfs system to be mounted at boot time by adding the

        swap /tmp tmp rw 0 0

to /etc/fstab.
Ken Teh <>

A RAM disk is exactly what it says. Part of the computer's main memory
is set aside to be used as a disk. RAM disks were popular when a
computer usually a PC had only a floppy for storage since floppies are
extremely slow. With present day speeds on hard disks, there is no real
advantage to having RAM disks unless an application writes many (and I
mean many) small files as it runs. And if the application is
interactive, the user will not notice any performance gains. Besides
you forfeit part of your RAM. One big disadvantage with RAM disks is
you lose your files when the system goes down. Bottom line: RAM disks
are archaic. Their only real use is in specialized instances and unless
your customer has real grounds for using it, I would discourage it.

Look at tmpfs(4) for a description on how to set up a memory-based
-------------------------------------------------------------------------- (Frank Greco)
         1) What is a RAM disk?

A logical disk that really resides in RAM. Since it uses RAM instead
of physical disk IO, it should be faster. Since SunOS uses modern
VM paging, the need for a RAM disk is not that high as for PC's. When
using a RAM disk, remember that the files are transient. When the power
goes off, the files go away.

         2) How to use a RAM disk?
No different than any ordinary file.

         3) How to setup a RAM disk?
See tmpfs(4S) or contact one of the vendors (hmmmm... BoxHill comes to
that sell solid-state disks. The Sun Catalyst catalog should help you

         4) Any associated overhead, if any, that occurs with a RAM disk
More administration overhead than actual machine overhead.

         5) How to measure the performance improvement gained by a RAM
Just like you would for any other potential performance improvement
(i.e., new
algorithm, installing a faster SCSI disk, better version of the
See prof(1), gprof(1), vmstat(1), etc...etc...
-------------------------------------------------------------------------- (Donald McLachlan)

He could be thinking of 2 things ...

If the user comes from the PC world, s/he is probably thinking of
reserving some
system memory and putting a file system on it. In Unix systems this is
not much
of a gain. For more info see the "Writing Device Drivers" manual which
an example of this.

The user may also be talking about a physical deviece which has the same
as a normal disk, but is really just LOADS of RAM (optionally battery
backed up)
sitting behind a SCSI interface. One uses these exactly like a normal
but they are really zippy.
Linn Stanton <>

           1) What is a RAM disk?
It is an sbus card consisting of a bunch of dRAM chips, but with an
interface that looks like a disk to the bus

           2) How to use a RAM disk?
As it is volatile but fast, it works best used as swap, or /tmp

           3) How to setup a RAM disk?
It varies a bit depending on make, but tends to be minimal

           4) Any associated overhead, if any, that occurs with a RAM disk
None that I am aware of

           5) How to measure the performance improvement gained by a RAM
Can't really say without knowing more about the setup and the application
-------------------------------------------------------------------------- (Anthony (Tony) Reeves)

1) a RAM disk is just what it sounds like, a part of memory in RAM that
used to simulate a disk. That is you can read to it, write to it, and
so forth...

2) Since you asked in a sun-manager area, I'll assume you mean how to
a sun to do it.. Starting with version 4.1, the command tmpfs is used.
read the man page on tmpfs. In the example they use, tmpfs is used
to give /tmp more speed and size by using it as ram disk..

3) read about tmpfs...

4) Yes, since sunOS is based on BSD unix, if the process need more
they will lower the size of the tmpfs dynamicly; thus is you have low
you start to see your ram disk page and swap.. once this happens, its no
than a standard disk..

5) iostat is good and vmstat...
-------------------------------------------------------------------------- (John Louie)

        I'll let others instruct you on RAM disks. Let me just say that
UNIX automatically buffers as much of the file system into RAM as the
memory size will allow. Further, on Suns, you can set up a tmpfs-type
file system that will buffer into memory even faster. I have a SPARC
with 96 Mb of memory; when I copy a working directory into my tmpfs-type
folder, I can run complicated shell scripts that invoke scientific
programs at speeds that are close to vectorized code on a Convex C-2
supercomputer. Having the files buffered into RAM, like in a RAM disk,
this possible.
        So the best solution is to buy a UNIX machine with fast memory
and lots of RAM, and put what you want in a tmpfs file system. An
portable RAM disk.
         1) What is a RAM disk?
RAM that appears to the user as a disk.

         2) How to use a RAM disk?
It looks just like a file system.

         3) How to setup a RAM disk?
Under SunOS: create an fstab(5) entry that is of type "tmp", and
make sure your kernel is appropriately configured (options TMPFS).

         4) Any associated overhead, if any, that occurs with a RAM disk
TMPFS uses memory on demand from the swap allocation. Thus the more
storage used by the RAM disk, the less is available for applications.
Note SunOS does have protections in place that will prevent the
RAM disk from using all the swap allocation. I think it's something
like 30% reserve - check the docs.

         5) How to measure the performance improvement gained by a RAM
It looks like a disk, the usual disk measurement utilities will

What to expect? Hard disk (burst) transfer rates are c. 4MB/sec,
compared to c. 20MB/sec for RAM. Hard disk seek times are
c. 10ms compared to c. 1ms for RAM disk.
-------------------------------------------------------------------------- (Glenn Satchell - Uniq Professional Services)

A RAM disk is a filesystem implemented in memory as opposed to physical
disk. The benefits are that it should be heaps faster. Well Sun has had
a RAM disk since 4.0 with the tmpfs filesystem, normally used for /tmp.
For the technical details do `man tmpfs'. (Russ Poffenberger)

The closest thing is what Sun calls TMPFS. There is plenty of information
the man pages.
-------------------------------------------------------------------------- (Birger A. Wathne)

try 'man tmpfs'.

Luke W. Mentzer
  ( |
  (303) 538-3572
  AT&T GBCS Laboratories
  11900 N. Pecos St.  Room 1D34
  Denver, Colorado  80234

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:10 CDT