![]()
|
CONTENTS of BigAdmin Wiki
|
Talking about /tmp and RAM disks in the Solaris OS in general In Solaris /tmp is by default a memory based file system mounted on swap: # df -k /tmp Filesystem kbytes used avail capacity Mounted on swap 1961928 504 1961424 1% /tmp This has some advantages:
On the other hand there are some things to take care of if using /tmp: One very important point: To avoid this situation you should mount /tmp with an upper limit for the size, e.g in /etc/vfstab change the line swap - /tmp tmpfs - yes - to swap - /tmp tmpfs - yes size=1g (replace 1g with an approbiate value for the machine)
# lockfs /tmp
/tmp: Inappropriate ioctl for device
# mount -o remount,size=512m swap /tmp
mount: Operation not supported
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, e.g. [Mon Mar 17 21:53:19 root@sol9 /] # mkdir /mytmp [Mon Mar 17 22:05:44 root@sol9 /] # mount -o size=100m -F tmpfs swap /mytmp [Mon Mar 17 22:06:04 root@sol9 /] # df -k /mytmp Filesystem kbytes used avail capacity Mounted on swap 102400 0 102400 0% /mytmp To create this new filesystem every time the machine boots up simply add another line to the /etc/vfstab: swap - /mytmp tmpfs - yes size=1g 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) version 9. ramdiskadm can be used to create real ramdisk devices which can be used like any other disk device, e.g: # 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 /] 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 For more detailed information about ramdiskadm please consult the man page of ramdiskadm(1m) and ramdisk(7d); The man page of ramdiskadm also 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 But that's a story for another wiki entry. |
Most Popular CollectionsAll Collections
View Related Links |
