.TH ramdisk "" "" "System Administration"
.PC "Script to create a RAM-disk"
.B /usr/bin/ramdisk
.PP
.B ramdisk
is a script that creates a 500-kilobyte RAM disk that is accessed via
device
.BR /dev/ram0 .
.PP
To use
.B ramdisk
to create a RAM disk for you at boot-time, do the following:
.IP \fB1.\fR 0.3i
Log in as the superuser
.BR root .
.IP \fB2.\fR
Type:
.DM
	touch /dev/ram0close
.DE
.sp \n(pDu
This closes the RAM disk and removes it from memory.
.IP \fB3.\fR
Remake the ram disk as a smaller size device.
As an example, we'll make one that is 64 kilobytes.
Type the command:
.DM
	/etc/mknod /dev/ram0 b 8 1
.DE
.IP
To break down this command:
.RS
.IP \fB/etc/mknod\fR
This is the command that creates a special file (e.g., a block-special
file) through which a device like a printer or RAM is accessed.
.IP \fB/dev/ram0\fR
The directory path and name of your RAM disk.
.IP \fBb\fR
This argument
tells
.B mknod
to build a block-special file.
Every device like a printer, floppy drive, COM port, or RAM drives,
are considered a ``block special file.''
.IP \fB8\fR
This is the major device number for a RAM drive.
All major-device numbers are listed in the Lexicon entry for ``device drivers.''
.IP \fB1\fR
This is the minor device number of your new
.BR ram0.
This shows that the
.B ram0
you are building will be 64 kilobytes in size.
If the minor device number would have been `2', then the size of
.B ram0
would have been two times 64, or 128 kilobytes.
Each increment in the
minor-device number is equal to an additional 64 kilobytes for
the RAM device.
A minor device of 16 multiplied by 64 kilobytes would
equal a one megabyte size RAM drive.
.RE
.IP \fB4.\fR
Next, make a file system in
.BR ram0 :
.DM
	/etc/mkfs /dev/ram0 128
.DE
.sp \n(pDu
The number ``128'' is exactly twice the memory size, in this case 64
kilobytes.
Whatever size memory you choose to allocate to a RAM device,
the block size you specify
in the
.B mkfs
command will be double.
A one-megabyte RAM device for example would have 2,048 blocks.
.IP \fB5.\fR
Your new RAM disk is now ready to be mounted.
Typically, you would mount ram0
in a directory named
.B fast
or some other unique name, so to mount, type;
.DM
	/etc/mkdir /fast
	/etc/mount /dev/ram0 /fast
.DE
.IP
If
.B /fast
already exists, do not create it.
.PP
Once you have created your RAM disk, you should load commonly used utilities
into it.
.PP
If you wish to create a RAM disk automatically whenever you boot \*(CO,
un-comment and edit the appropriate lines in file
.BR /etc/rc .
.SH "See Also"
.Xr "Administering COHERENT," administe
.Xr "ram," ram
.Xr "rc" rc
.SH Notes
This script only works in machines that have sufficient memory.
