Sol 8: Run "/tmp" in RAM (not swap, and not hdd)

Hey Gang,

Weird question.  This is in relation to a customer’s although there are probably far better ways of doing this...for the moment, I need to know how to do it this way.

I would like to set a Solaris 8 (02/02) system so the "/tmp” dir is mounted to RAM (I.E. as if it were mounted to a Windows ramdrive.)  It would be acceptable to mount it directly...OR have it mount to swap (like normal) but set swap to RAM only (no hard drive access at all.)

This can be done through configuration editing, scripts during/after boot...whatever.

Mike R.Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need the File System type "tmpfs"

See --> man tmpfs

You create and mount it using mount

See --> man mount

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike R.Author Commented:
OK...what was throwing me off was the fact that the examples for both tmpfs and mount -F tmpfs mention swap.  We don't want the /tmp dir to touch the hard drive...however, as Solaris can run without swap, I am assuming that if swap space on the drive is not designated at all (I.E. "swap -l" responds with no swap enabled) then the command "mount -F tmpfs swap /tmp" will result with the /tmp dir being held completely in RAM.

Is this correct?


   As my understanding, /tmp is "RAM+swap partition" on Solaris 8 by default (check /etc/vfstab, swap mount as tmpfs).
So if you don't have any swap partition, then /tmp should be RAM only.

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Mike R.Author Commented:
Great...thanks makes sense (you are right about the mounting in the vfstab.)  I will give this a shot Monday and see how we end up!

You can run a Solaris server without phsyical swap - but I wouldn't suggest it.  A tmpfs file system actually lives on top of what is known as anonymous memory which is part RAM (this is variable and changes constantly) and physical swap.

By default, /tmp is mounted on top of swap - sounds like the system your are talking about was setup with /tmp physically mounted on a partition.  This is fine but can cause performance issues for temporary files - hopefully /tmp is being used for temporary files.  Some folks setup /tmp on physical partitions cuz they didn't can /tmp to eat up all swap space - which by default it can.  This can easily be limited in /etc/vfstab.
Mike R.Author Commented:
I have not had a chance to really "test" the configuration...but so far, everything seems to be fine with /tmp mounted normally to a tmpfs, but having no physical swap.  I agree with Nukfror, that running without physical swap is not recommended-and can lead to issues-but, for this particular install, it was a requirement.

It looks like I am not really going to be able to run the system through it paces for a while (things have started to pile up) so I am going to assign points and will re-visit the issue as a new question if it becomes necessary.

Thanks for all the help and input!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.