Is it possible to create a RAM disk? Updated: 05/10/01


Yes, HP-UX 9.00 and later include a RAM disk driver. The driver is NOT
officially supported by HP for customer use. Comments in the header file
"/usr/conf/sio/ram.h" describe how to add RAM disk support to the kernel,
as well as how to create a RAM disk.

Here are several reasons why using RAM disks is RISKY business:

1. As stated above, RAM disks are unsupported by HP.
2. It is unclear (to me anyway) how "locking" down memory interacts with
normal memory management, including pageouts and memory pseudo-swap.
The comments in /usr/conf/sio/ram.h says say:
"Depending on the availability of memory, allocating large amounts
of memory for RAM disk volumes may cause system failures (panics
or hangs)."
3. RAM disks can waste memory space. The "usable" yield of disk space
from memory allocated may be less than 100%. (1 GB of real memory
may yield less than 1 GB on "disk space".)
4. RAM disks aren't saved over a reboot, and require special action to do
so.
5. You must write a C program to delete them from a running system.

Here are the basic steps make a 128 MB RAM disk on HP-UX 10.x/11.x:

1. Modify your kernel to include the RAM disk driver:

# cd /stand/build
# /usr/lbin/sysadm/system_prep -v -s system
# kmsystem -c y -S system ram
# mk_kernel -s system
# mv ../system ../system.prev
# cp ../vmunix ../vmunix.prev
# mv system ..
# mv vmunix_test ../vmunix
# cd /
# shutdown -r

Note: "ramdisc" is an alias for "ram" that is also recognized.

2. Set up the device files and mount the RAM disk filesystem:

# mknod /dev/rram1 c 9 0x008001
# mknod /dev/ram1 b 9 0x008001
# newfs -F hfs /dev/rram1
# mkdir -p /ramdisk
# mount /dev/ram1 /ramdisk

Another way
===========
There is a better, but not free, way to _simulate_ a RAM disk under HP-UX
10.20 or later...

You must first purchase and install the optional OnlineJFS product, the
advanced bundle for the VxFS file system. This enables a number of
extra mount options for VxFS filesystems.

To configure a VxFS filesystem so that most buffer cache flushes are
prevented, specify the following options when mounting the filesystem:

"tmplog,mincache=tmpcache,convosync=delay"

The first two options can be configured with sam, but the convosync
option must be edited into /etc/fstab by hand.

A description and pricing info for the OnlineJFS product is available at
<http://software.hp.com/> (just search for "onlinejfs").

A third way
===========
JTL Technical Services, LLC, sells a software product for HP-UX called
RamDisc. There are two versions - RamDisc plus and RamDisc classic. For
more information see their web site:

o <http://www.jtlltd.com/ramdsk.html>



UNIXguide.net
Suggest a Site