by Bernd Schemmer, last update: December 2008
In Solaris /tmp is by default a memory based file system mounted
This has some advantages:
On the other hand there are some things to take care of if using
Because /tmp is mounted on swap you should not use it for files which should survive a reboot - use the disk based directory for temporary files, /var/tmp, instead for these files.
One very important point:
Every user can write to /tmp. And in the default configuration /tmp is mounted without a size limitation. This fact results in the possibility that every user can use the whole virtual memory of the machine (that is physical memory and swap) by simply filling up /tmp with garbage.
To avoid this situation you should mount /tmp with an upper limit
for the size, e.g in /etc/vfstab change the line
(replace 1024m with an approbiate value for the machine)
Unfortunately you can not change the size for /tmp while Solaris is running:
Therefore you must reboot the machine to activate the change.
Because of the fact that tmpfs is a "normal" filesystem in
Solaris you can always add additional memory based file systems,
to create another tmpfs on the fly use:
To create this new filesystem every time the machine boots up simply add another line to the /etc/vfstab:
There are some restrictions for tmpfs Filesystems:
But because Solaris is a real Operating system there is a solution for this problem also:
Instead of using tmpfs to create a memory based file system, use
ramdiskadm. ramdiskadm is part of the Solaris OS since (at least)
ramdiskadm is part of the SUNWcsu package and therefore should be installed on every Solaris machine (x86 and SPARC, of course).
ramdiskadm can be used to create real ramdisk devices which can be used like any other disk device, e.g:
Be aware that these ramdisks are also gone after a reboot. If you need them permanent you should create an init script or an SMF service to recreate them while booting the machine.
For more detailed information about ramdiskadm please consult the man page of ramdiskadm(1m) and ramdisk(7d); The man page of ramdiskadm also describes how to give users other than root access to create and delete ramdisks and the man page for ramdisk explains how much memory can be used for ramdisks.
And, for the records, you can use a ramdisk created with
ramdiskadm also for an SVM mirror . This can be useful if an
application is mostly reading from
the disk; in this case you can change the read policy for the mirror to first read from the ramdisk..
But that's a story for another page .
A script to start and stop ramdisks in the Solaris OS can be find in this article:
A script to start and stop ramdisks in the Solaris OS
There's an interesting blog entry about ramdisks and swap:
Are Solaris RAM Disks swappable?
entry deleted by Oracle