View previous topic :: View next topic |
Author |
Message |
Steffen Apprentice
Joined: 14 Jul 2002 Posts: 159
|
Posted: Sat Dec 13, 2003 9:04 pm Post subject: Using tmpfs on /tmp to speed up system? |
|
|
I've just read this blog entry by Sterling Hughes (a PHP coder), who suggests using tmpfs on your /tmp directory to speed up your system. Has anybody here already tried to do this?
I think I'll try it soon, but due to school exams I won't have time before wednesday. |
|
Back to top |
|
|
Oopsz Guru
Joined: 08 Oct 2002 Posts: 340
|
|
Back to top |
|
|
Promit Guru
Joined: 15 Nov 2003 Posts: 344
|
Posted: Sat Dec 13, 2003 11:16 pm Post subject: |
|
|
Interesting...can I put this in /etc/fstab to always have it? _________________ Windows, Linux, whatever. |
|
Back to top |
|
|
Promit Guru
Joined: 15 Nov 2003 Posts: 344
|
Posted: Sat Dec 13, 2003 11:18 pm Post subject: |
|
|
P.S. this had a rather...odd result that looks very weird to me:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda7 7.3G 4.3G 2.7G 62% /
/dev/hda1 9.8G 7.8G 2.0G 80% /mnt/windows
/dev/hda5 9.8G 7.5G 2.4G 77% /mnt/extra
/dev/hdc1 1.3G 958M 316M 76% /mnt/aux
none 252M 0 252M 0% /dev/shm
/tmp 7.3G 4.3G 2.7G 62% /tmp
Notice the sizes for /tmp. They all appear to be completely wrong...(/tmp is 86M according to du -sh) _________________ Windows, Linux, whatever. |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Sun Dec 14, 2003 12:09 am Post subject: |
|
|
Make sure your /etc/fstab is right. The bits of my /tmp look like this:
Code: | # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
# use almost no memory if not populated with files)
# Adding the following line to /etc/fstab should take care of this:
none /dev/shm tmpfs defaults 0 0
none /tmp tmpfs defaults 0 0
|
HTH
Edit: had tmp instead of /tmp cheers rmbalfa _________________ Search | Read | Answer | Report | Strip
Last edited by tomk on Tue Dec 23, 2003 11:24 pm; edited 1 time in total |
|
Back to top |
|
|
Jazz Guru
Joined: 16 Nov 2003 Posts: 543 Location: Melbourne, Australia
|
Posted: Sun Dec 14, 2003 12:56 am Post subject: |
|
|
Hey, thats a neat trick.. had done that with my XP, but culdnt find a way to do that with Gentoo...
Anyways, the blog gave some directions to enhance Firebird.. does anyone know how to optimise Opera for that ?? or in general KDE to take advantage of the tmpfs ?
Bye,
Jassi |
|
Back to top |
|
|
rmbalfa Apprentice
Joined: 15 Dec 2003 Posts: 200 Location: Illinois State University/Chicago
|
Posted: Mon Dec 15, 2003 8:06 am Post subject: |
|
|
I am having trouble understanding this. Sometime I have seen:
none /dev/shm tmpfs defaults 0 0
none tmp tmpfs defaults 0 0
and sometime I have seen
tmpfs /dev/shm tmpfs defaults 0 0
tmpfs tmp tmpfs defaults 0 0
What is none?
In the end all I really want is to mount /var/lib/setiathome with tmpfs to improve my times. |
|
Back to top |
|
|
Sedated n00b
Joined: 25 Feb 2003 Posts: 32 Location: Edmonton, Alberta, Canada
|
Posted: Sat Jan 31, 2004 11:34 pm Post subject: |
|
|
I had something like this set up in slackware long ago, and i still have the fstab entries and whatnot, but i don't really remember why i did it this way...
fstab: Code: | tmpfs /dev/shm tmpfs defaults,size=512m 0 0
/dev/shm/tmp /tmp tmpfs defaults,noauto,bind 0 0 |
and a few small lines in the rc.local boot script: Code: | /etc/rc.d/rc.devfs start
if [ -z `mkdir /dev/shm/tmp; chmod 1777 /dev/shm/tmp` ]; then
/sbin/mount /tmp
fi |
The way you guys are doing it, you actually get two tmpfs filesystems. This way, there's just one shared tmpfs between /dev/shm and /tmp. The only question is... how to implement this in Gentoo? You wouldn't want to directly bind or symlink /dev/shm to /tmp because there could be files in /dev/shm you don't want to appear in /tmp, but you can't have /tmp mounted automatically in fstab because the /dev/shm/tmp directory would have to be created and chmod'd first. As you can see, the lines in my old rc.local take care of this, but what Gentoo startup script would be best for this? If i added a line in the script to clean out the initial /tmp directory first, would putting the lines in /etc/conf.d/local.start be run early enough to not have files in /tmp that are currently in use from other startup scripts or programs?
I think that last paragraph may have been a bit longwinded... _________________ Sedated Quote: | sedated@therapy:tty3:~$ fortune
"If you lend someone twenty dollars, and never see that person again, it was probably worth it." |
|
|
Back to top |
|
|
ajaxx n00b
Joined: 12 Oct 2003 Posts: 12
|
Posted: Sun Feb 01, 2004 3:40 am Post subject: |
|
|
rmbalfa wrote: | I am having trouble understanding this. Sometime I have seen:
none /dev/shm tmpfs defaults 0 0
none tmp tmpfs defaults 0 0
and sometime I have seen
tmpfs /dev/shm tmpfs defaults 0 0
tmpfs tmp tmpfs defaults 0 0
What is none?
In the end all I really want is to mount /var/lib/setiathome with tmpfs to improve my times. |
The first column specifies the device name. Strictly speaking there is no device associated with tmpfs (or devfs or procfs or...), so you can put whatever you want there.
However. It's good style to give the name of the filesystem as the device name, as in the second example. The reason is due to the behavior of umount(. When it can't unmount a filesystem (say, because you have files open on it, or another fs mounted below it), it tells you the name of the device causing the problem, and the error message "Failed to umount /proc: none busy" is a little confusing.
So either one is correct, but the second is more correct than the first. |
|
Back to top |
|
|
|