Change /tmp directory

Hi,

It is understood that the contents of /tmp directory will be deleted at reboot.

Is there any way to configure such that /tmp contents wont be deleted at reboot?

OR

Can I make another directory, say temp as the default temporary directory?

Please have your valuable reply.

Ashraf

[325 byte] By [ashrafkt] at [2007-11-26 10:22:25]
# 1

There is a separate /var/tmp directory which is intended to be the alternate /tmp for stuff that needs to hang around across reboots.

The simplest solution is to simply modify your application to use that.

If you really need to make /tmp persistent then you need to edit /etc/vfstab and make /tmp

something other than a tmpfs filesystem.

If you just comment out the line, /tmp will end being a directory on /.

But if you need more space than that, then you can mount a separate filesystem there.

robertcohen at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...
# 2
Thanks for ur reply Robert.cohen, butCommenting out the line of /tmp did n't make any +ve result. Contents are still getting deleted.When I changed the file system to ufs and rebooted, the system is not coming up. So I reverted.Any other way?Ashraf.
ashrafkt at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...
# 3

I just tried it commenting it out and while /tmp was no longer a tmpfs file system, it still didnt work.

There must be a startup script deleting everything in that directory.

I found /etc/rc2.d/S05RMTMPFILES on solaris 9.

Presumably theres a svcadm job that does the same thing on solaris 10.

You'd have to disable those.

If you want to change it to ufs, you can't just change tmpfs to ufs.

Since thats trying to use swap as the disk space.

You need to change it to look more like the / line.

But with whatever disk you want to use instead of whatever / is using.

robertcohen at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...
# 4

Halo,

OS is Solaris 10

Though I changed /tmp line in vfstab just as that of / , system goes to maintanence mode.

I want the contents of /tmp retained as long as a big application installation finishes even if the system reboots. Once the installation is over, I dont want to retain the /tmp contents.

Ashraf.

ashrafkt at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...
# 5
For the easy version, try just commenting out the /tmp line in /etc/vfstabrun the commandsvcadm disable rmtmpfilesand reboot (shutdown -y -g0 -i6).Ive just tried this and a file in /tmp survives reboot.
robertcohen at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...
# 6
Thanks robert.cohen This works fine.
ashrafkt at 2007-7-7 2:22:43 > top of Java-index,General,Sys Admin Best Practices...