COHERENT manpages
This page displays the COHERENT manpage for ram [Driver for manipulating RAM].
List of available manpages
Index
ram -- Device Driver Driver for manipulating RAM The COHERENT ram devices let you allocate and use the random-access memory (RAM) of the computer system directly. A typical use is for a RAM disk, which is a COHERENT file system kept in memory rather than on a floppy disk or hard disk. The COHERENT RAM device driver has major number 8. You can access it either as a block-special device or as a character-special device. The high-order bit of the minor number gives the RAM device number (0 or 1); as you can see, you can have no more than two RAM devices in memory at any one time. The low-order seven bits give the device's size in 64-kilobyte chunks. The first call to open() on a RAM device with nonzero size (1 to 127) allocates memory for the device; open() fails if sufficient memory is not available. Accessing a RAM device with a minor number that specifies size zero frees the allocated memory, provided all earlier open() calls have been closed. Initially, COHERENT includes two block-special devices for RAM disks: the 512-kilobyte device /dev/ram0 (8, 8) and the 192-kilobyte device /dev/ram1 (8, 131). It also includes the devices /dev/ram0close (8, 0) and /dev/ram1close (8, 128). You should resize the RAM devices to suit the amount of memory available on your system. Examples The following example formats and mounts a 512-kilobyte RAM disk on directory /fast. mkdir /fast /etc/mkfs /dev/ram0 1024 /etc/mount /dev/ram0 /fast When the RAM disk is no longer needed, its allocated memory can be freed as follows: /etc/umount /dev/ram0 cat /dev/null >/dev/rram0close The next example replaces the default /dev/ram0 with a one-megabyte device that contains a COHERENT file system. The minor number 16 specifies RAM device 0 and a size of one megabyte (i.e., 16 chunks of 64 kilobytes each). The new RAM device contains 2,048 blocks of 512 bytes each. rm /dev/ram0 /etc/mknod /dev/ram0 b 8 16 /etc/mknod /dev/rram0 c 8 16 /etc/mkfs /dev/ram0 2048 chmod ugo=rw /dev/ram0 chmod ugo=rw /dev/rram0 The command chmod is necessary to make the new RAM drive accessible. Files /dev/ram* See Also compress, device drivers, fsck, mkfs, mount, ramdisk, umount, uncompress, zcat Notes Moving frequently used commands or files to a RAM disk can improve system performance substantially. However, the contents of a RAM device are lost if the system loses power, reboots, or crashes. Therefore, you should frequently back up files from the RAM disk to a more permanent medium. If a RAM device uses most but not all available system memory, its open() call will succeed but subsequent commands may fail because insufficient memory remains for the system. The COHERENT installation program /etc/build uses RAM device /dev/ram1 as a RAM disk during installation. Commands compress, uncompress, zcat, and fsck sometimes use /dev/ram1 as a temporary storage device. Users should avoid using /dev/ram1 as a RAM disk because of these programs. In addition, users of compress, uncompress, and zcat may have to change the size of /dev/ram1 from the default size of 192 to 512 kilobytes, to handle files compressed to 16 bits. The following script makes this change; note that it must be run by the superuser root: cat /dev/null >/dev/rram1close rm /dev/ram1 /dev/rram1 mknod /dev/ram1 b 8 136 mknod /dev/rram1 c 8 136