Search code examples
memorysolarismmapramdisk

solaris 10 (sparc64) ramdisk (like shmfs or tmpfs)


There is an ramdisk capability in Linux, which is achieved with mounting shmfs of tmpfs, like:

# mount -t shm shmfs -o size=20g /dev/shm

or

# mount –t tmpfs tmpfs /dev/shm

Also, some linuxes have ramfs, which is "ramfs is similar to shmfs, except that pages are not pageable or swappable"

# mount -t ramfs ramfs /dev/shm

I want to create ramdisk on solaris 10 (sparc64) with big size (tens of GB). How can I do this in solaris? How can I create not just a ramdisk in solaris, but nonswappable ramdisk?

Then I want to use big file from ramdisk to mmap memory into 32-bit process, so the solution should allow me to mmap small parts of files from ramdisk into 32bit application.


Solution

  • For a virtual memory based disk:

    # mount -F tmpfs -o size=20000m swap /mountpoint
    

    For a physical memory one:

    # a=$(ramdiskadm -a bigdisk 20g)
    # newfs $a
    # mount $a /mountpoint
    

    By the way, Solaris (more precisely SunOS) was the first Unix to implement tmpfs around 1987.