Creating Ramdisk on Solaris

Creating RAMdisk is a way to create a temporary file cache for fast access.
I found the following information from Sun’s BigAdmin site:

# create the ramdisk
#
[Mon Mar 17 22:15:03 root@sol9 /]
# ramdiskadm -a mydisk 40m
/dev/ramdisk/mydisk

# check the result
#
[Mon Mar 17 22:15:21 root@sol9 /]
# ls -l /dev/ramdisk/mydisk
lrwxrwxrwx 1 root root 40 Mar 17 22:15 /dev/ramdisk/mydisk -> ../../devices/pseudo/ramdisk@1024:mydisk

[Mon Mar 17 22:16:04 root@sol9 /]
# ls -l /dev/rramdisk/mydisk
lrwxrwxrwx 1 root root 44 Mar 17 22:15 /dev/rramdisk/mydisk -> ../../devices/pseudo/ramdisk@1024:mydisk,raw

# check the fstype
#
[Mon Mar 17 22:16:07 root@sol9 /]
# fstyp /dev/rramdisk/mydisk
unknown_fstyp (no matches)

# create a filesystem on the ramdisk
#
[Mon Mar 17 22:16:22 root@sol9 /]
# newfs /dev/rramdisk/mydisk
/dev/rramdisk/mydisk: Unable to find Media type. Proceeding with system determined parameters.
newfs: construct a new file system /dev/rramdisk/mydisk: (y/n)? y
/dev/rramdisk/mydisk: 81872 sectors in 136 cylinders of 1 tracks, 602 sectors
40.0MB in 9 cyl groups (16 c/g, 4.70MB/g, 2240 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 9664, 19296, 28928, 38560, 48192, 57824, 67456, 77088,

# mount the ramdisk
#
[Mon Mar 17 22:16:44 root@sol9 /]
# mkdir /myramdisk

[Mon Mar 17 22:16:51 root@sol9 /]
# mount /dev/ramdisk/mydisk /myramdisk

[Mon Mar 17 22:17:01 root@sol9 /]
# df -k /myramdisk
Filesystem kbytes used avail capacity Mounted on
/dev/ramdisk/mydisk 38255 1041 33389 4% /myramdisk

[Mon Mar 17 22:17:06 root@sol9 /]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.