Re: [SLUG] Can I do this move the tmp dir?

From: Ian C. Blenke (ian@blenke.com)
Date: Thu Feb 27 2003 - 09:52:53 EST


On Thu, Feb 27, 2003 at 06:58:10AM -0500, Mike Manchester wrote:
> I have a server that is having trouble importing a project into CVS. The
> problem is that /tmp is on a small drive. There is a 30Gig drive on this
> machine that has lots of room and I was wondering if I can move /tmp to
> the drive? If so how do I do that? I know I can do a symbolic link but
> what I'm have reservations about is the permissions. The /tmp file is
> drwxrwxrwt 7 root root 1024 Feb 27 05:54 tmp
> I can create a dir on the second drive ie.
> drwxrwxrwt 2 root root 1024 Feb 27 05:58 /tmp
> /data/tmp with the proper permissions by doing a chmod 777 /data/tmp and
> a chmod +t /data/tmp (I'm guessing the t means temp?) But I don't know
> how to duplicat the 7 between the permissions and the user. I can't seem
> to find anywhere where this is explained.And when I create the dir it
> places a 2 there. Does this make a difference for what I'm trying to do?

The "t" means "sticky". The "sticky bit" on a directory means that files
in that directory may be deleted or renamed only by the user that created
them. You get the same effect by using "chmod 1777 /tmp". Using the
octal numbers may be easier once you understand what each digit
represents.

That "7" that you're seeing is the number of directories contained in
that directory. Every directory by default has "." and "..", so they all
begin with "2" there when you create the directory. Each additional
subdirectory you add to that directory will increment that number.

Ideally, when you move your /tmp filesystem like that, you need to be
careful to replicate the current contents and restart anything that
might still have a filehandle open. You may use "fuser -avm" or "lsof"
to look for open files on /tmp:

        # fuser -avm /tmp
or
        # lsof -n /tmp

Anything with an open file in /tmp MUST be killed before you can unmount
the /tmp filesystem. Moreover, simply copying these files to your new
/data/tmp WILL NOT REMOVE THESE OPEN REFERENCES. The processes will
continue to read/write from the old /tmp files that are being held open
- your only choice is to stop these processes, unmount the old /tmp,
replace it with a new filesystem or symlink, and restart the processes.

If you want to be safest, boot your machine into single user before
attempting to replace or move your /tmp filesystem. Be sure to edit your
/etc/fstab appropriately before returning to a multi-user runlevel.

Have fun.

- Ian

-- 
Tum podex carmen extulit horridulum



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:54:16 EDT