SUMM: Relocating tmp directory

From: Guy Dallaire <dallaire_at_total.net>
Date: Tue, 20 Aug 1996 13:58:24 -0400

First, thanks to all of you who replied. You know who you are, thank you again.
A lot of people wanted me to summarize, so maybe my original post was no so
stupid after all...

Now, here is my original post:

---------Begin---------------

Recently, the development team here got into some problems when the /tmp
directory got full. It's in the root partition which is only 64Mb. Why is is
so small by the way ?

To remedy the problem, I placed a symlink from /tmp to /u01/tmp which is on
a bigger partition. Is this a viable solution ? Is there a more standard
mechanism to move the teporary directory ?

Also, what are the use of /usr/tmp and /var/tmp directories ?

I would also like to know which mechanism decides the location for the
temporary directory to use when a users logs in ? Is there an environment
variable or a setting for this ?

----------END----------------

1) It's NOT a good idea to put a symbolic link from /tmp to another
directory on a different partition. The problem is that if that _other_
partition is not mounted when the system tries to get/put something in /tmp,
you can get into trouble. Most notably when the system is in single user
mode, in that case, the other filesystems are not generally mounted and the
system could need the /tmp directory, which at this time point to _nothing_.
Someone told me thay had a lot of problems upgrading DU because such a link
existed.

2) The general advice is to mount a filesystem under /tmp at boot time
instead. For example, you could have a disk partition of, say, 128 or 256Mb
that you mount under /tmp. To do this, you use the /etc/fstab file. The size
of your temporary partition is dictated by your system size and usage.

For example, you /etc/fstab could read like this:

        #
        # file_spec mnt_pt fs_type mnt_opts backup fsck
        #
        /dev/rz0a / ufs rw 1 1
        /proc /proc procfs rw 0 0
        [... text deleted ...]
        /dev/rz3g /tmp ufs rw 1 2
        [... text deleted ...]

In this manner, the /tmp directory is ALWAYS available, no matter what run
level you're in. In Single user, it is the directory under root, in
multi-user it's mounted under /tmp.

Alternatly, you could use advfs and create a temporary "domain" and add
space (filesets) to it as needed.

3) As for the use of /tmp, /usr/tmp and the environement variable stuff:

Some programs use /usr/tmp instead of /tmp. On most systems /usr/tmp is
generally a link to /var/tmp. Here is a good discussion about it:

"/usr/tmp should be a symbolic link to var/tmp. All the read-write
files that are part of the system disk should be in var, making
/usr read-only. The default installation allows var to be put
under /usr as a plain directory or on its own file system. All
the traditional /usr directories that contained read-write files
are symbolic links to var.

Well behaved applications will honor the environment variable
TMPDIR as the convention for where to put temporary files.
Reasonable programs will use /usr/tmp (or /var/tmp if modern),
but some still use /tmp. Components that are expected to run
while the system is single user will /tmp because that is
all that may be available. That's the advantage of using a
separate file system; /tmp is still a directory no matter
what. If is a symbolic link programs that use /tmp while
running single will fail, if the target file system isn't
mounted."

4) The root partition is small because:

...Typically you don't want to write anything to it, and you don't want
to wait long for a UFS fsck on reboot.

                                Hope this make things clearer
Received on Tue Aug 20 1996 - 20:30:46 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT