Re: swap and /tmp
On Thu, May 04, 2006 at 06:05:37PM +0100, Adam Hardy wrote:
> Digby Tarvin on 04/05/06 02:40, wrote:
> >On Wed, May 03, 2006 at 06:25:08PM -0700, Andrew Sackville-West wrote:
> >>On Thu, May 04, 2006 at 12:50:43AM +0100, Digby Tarvin wrote:
> >>>I have now adopted it for my Linux systems, and was pleasantly surprised
> >>>with the functionality provided. The 'on demand' allocation makes it much
> >>>more efficent that a statically allocated partition where any space not
> >>>used for temp files is unavailable for anything else. That, coupled with
> >>>the ability to set an upper limit to reserve a minimum amount of space
> >>>for stop leads me to believe there is no real disadvantage.
> >>
> >>so , can you please detail how you have done this? tmpfs size,
> >>mounting details etc? I'm intrigued by this proposition and would like
> >>more info. thanks
> >
> >Not much to it. Just add something like this to your /etc/fstab:
> > tmpfs /tmp tmpfs size=1g 0 0
> >
> >Merging my old /tmp partition with the original swap partition gave
> >me a 1.5GB swap, of which I have set a maximum /tmp size of 1GB,
> >leaving a minimum of 512MB for swap.
>
> I've also got the following lines in my mtab:
>
> tmpfs /dev/shm tmpfs rw 0 0
> tmpfs /dev tmpfs rw,size=10M,mode=0755 0 0
> I read that the first line is used for POSIX shared memory so that must
> have been in the original kernel config, and the second line looks like
> it is put there by usbfs.
Yes, they are the items for which tmpfs is normally used out of the
box, and has no effect on its use for /tmp - other than serving as
confirmation that ramfs is installed and available on your system.
No action is required in respect to these items when configuring
a tmpfs /tmp filesytem.
> So if you were to add the tmpfs handling for /tmp into /etc/fstab, what
> else would you have to do to make sure that /tmp is managed properly?
> Currently it's this:
>
> drwxrwxrwt 11 root root 4096 2006-05-04 17:54 tmp
>
> (e.g. do you delete /tmp?)
No - don't delete your old /tmp. The directory must exist as a mount
point. You can (and should) remove anything contained within though.
And yes, you should keep the ownership and attributes the same:
digbyt@fujitsu:~$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,size=1g)
digbyt@fujitsu:~$ ls -ld /tmp
drwxrwxrwt 6 root root 200 2006-05-04 19:18 /tmp
digbyt@fujitsu:~$ ls -la /tmp
total 13
drwxrwxrwt 6 root root 200 2006-05-04 19:18 .
drwxr-xr-x 24 root root 1024 2006-04-30 07:23 ..
drwxrwxrwt 2 root root 60 2006-05-04 19:18 .font-unix
srw-rw-rw- 1 root root 0 2006-05-04 19:18 .gdm_socket
drwxrwxrwt 2 root root 40 2006-05-04 19:17 .ICE-unix
drwxrwxrwt 2 root root 60 2006-05-04 19:18 .sockets
-r--r--r-- 1 root root 11 2006-05-04 19:18 .X0-lock
drwxrwxrwt 2 root root 100 2006-05-04 19:18 .X11-unix
-r--r--r-- 1 root root 11 2006-05-04 19:18 .X1-lock
-r--r--r-- 1 root root 11 2006-05-04 19:18 .X64-lock
digbyt@fujitsu:~$ df /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1048576 12 1048564 1% /tmp
Regards,
DigbyT
--
Digby R. S. Tarvin digbyt(at)digbyt.com
http://www.digbyt.com
Reply to: