Print

Print


Arthur Sherman wrote:
>> Applications that are /dev/shm-aware usually take care of it 
>> automagically,
>> there's nothing to configure.  However, you can get better 
>> performance out
>> of some applications by also mounting /tmp as a tmpfs filesystem.
>>     
>
> However, MailScanner, which appears to be shm-aware, wasn't so as a default.
> I had to mount it to shm:
>
> [root@ns1 ~]# df -h
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/md1              6.0G  1.1G  4.6G  20% /
> /dev/md6               99M   12M   83M  12% /boot
> none                  1.5G     0  1.5G   0% /dev/shm
> /dev/md4              135G  2.5G  126G   2% /home
> /dev/md2             1012M   40M  921M   5% /tmp
> /dev/md3              4.0G  302M  3.5G   8% /var
> none                  1.5G   32K  1.5G   1% /var/spool/MailScanner/incoming
> [root@ns1 ~]# cat /etc/fstab
> # This file is edited by fstab-sync - see 'man fstab-sync' for details
> /dev/md1                /                       ext3    defaults        1 1
> /dev/md6                /boot                   ext3    defaults        1 2
> none                    /dev/pts                devpts  gid=5,mode=620  0 0
> none                    /dev/shm                tmpfs   noexec,nosuid,rw
> 0 0
> /dev/md4                /home                   ext3
> defaults,usrquota,grpquota        1 2
> none                    /proc                   proc    defaults        0 0
> none                    /sys                    sysfs   defaults        0 0
> /dev/md2                /tmp                    ext3    defaults        1 2
> /dev/md3                /var                    ext3    defaults        1 2
> /dev/md5                swap                    swap    defaults        0 0
> # this is from MailScanner.info MAQ:
> http://www.mailscanner.info/serve/cache/120.html
> none /var/spool/MailScanner/incoming tmpfs defaults 0 0
> /dev/hdb                /media/cdrom            auto
> pamconsole,exec,noauto,managed 0 0
>
> BTW, it appears I was hasty to say I have /tmp mounted as tmpfs.
> Now, I recall someone told me off, arguing it will break things, such as yum
> etc.
>   
If yum is broken by /tmp being a tmpfs then it is truly a worse
application then I ever imaged it is...

In reality, no application should break since a tmpfs is just a fake
filesystem which never writes anything to disk.

Common configurations are similiar to:

none                    /dev/shm        tmpfs          
nodev,nosuid,noexec     0 0
none                    /tmp            tmpfs          
noatime,size=128M       0 0

Sometimes you will see /tmp implemented as:

none                    /tmp            tmpfs          
noatime,nosuid,nodev,size=128M   0 0

But it's all a security thing at that point.



> How serious is it?
> I'd really like to make as much apps work from tmpfs as possible, for
> obvious performance advantage
>
>
> Best,
>
> --
> Arthur Sherman
>
> +972-52-4878851
> http://www.cpt.co.il/ 
>
>