Mount /tmp as tmpfs

Message
Author
dr-kart
Posts: 150
Joined: Sun Oct 22, 2017 8:12 pm

Mount /tmp as tmpfs

#1 Post by dr-kart »

:confused: couldn't find anything fresh on this over recent forum posts.
...looking at https://wiki.debian.org/SSDOptimization ... ia_RAMDISK

So does it make sense (if any) to add to fstab

Code: Select all

tmpfs /tmp tmpfs noatime,nosuid 0 0
and (or) do we get some unwanted side effects here? Since mx wiki/help keeps silence on this.
In general this is the question to find reasonable optimal way to boost RAM usage via fstab or /etc/default/tmpfs or else.
arch-ers have it by default afaik

freefreeno
Posts: 34
Joined: Mon Nov 05, 2018 11:55 am

Re: Mount /tmp as tmpfs

#2 Post by freefreeno »

I also would like to know what MX says about this because like you I can find it all over the web but I haven't seen anything on MX forums about it. I do mine this way in arch but I am not for sure on here.
tmpfs /tmp tmpfs noexec,noatime 0 0
tmpfs /home/josh/.cache/google-chrome/Default tmpfs noexec,noatime 0 0

I have been doing it this way but if I am wrong or there is a better way let me know.

User avatar
dphn
Posts: 126
Joined: Sun Nov 25, 2018 6:26 am

Re: Mount /tmp as tmpfs

#3 Post by dphn »

You don't need it on MX. /tmp linked to /var/tmp and this loads to RAM. Good configuration on MX.
for those with an eye for the finer details...

User avatar
oops
Posts: 1891
Joined: Tue Apr 10, 2018 5:07 pm

Re: Mount /tmp as tmpfs

#4 Post by oops »

dphn wrote: Sat Dec 22, 2018 7:28 am You don't need it on MX. /tmp linked to /var/tmp and this loads to RAM. Good configuration on MX.
Yes , and to check:

Code: Select all

cat /proc/mounts | grep /tmp
#or
cat /proc/mounts | grep tmpfs
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19_x64 & antiX19_x32

User avatar
MAYBL8
MX Packager
Posts: 599
Joined: Thu Dec 31, 2009 1:48 pm

Re: Mount /tmp as tmpfs

#5 Post by MAYBL8 »

Mine shows this but I don't know what any of it means:
Is my SSD ok with this?

Code: Select all

dcihon@mx:~/.conky$ cat /proc/mounts | grep tmpfs
udev /dev devtmpfs rw,nosuid,relatime,size=8158164k,nr_inodes=2039541,mode=755 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636936k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=6629300k 0 0
cgroup /sys/fs/cgroup tmpfs rw,relatime,size=12k,mode=755 0 0
tmpfs /run/user/115 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=115,gid=126 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=1000,gid=1000 0 0

User avatar
fehlix
Developer
Posts: 12625
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#6 Post by fehlix »

dcihon wrote: Sat Dec 22, 2018 5:53 pm Mine shows this but I don't know what any of it means:
Is my SSD ok with this?
This means that neither /tmp nor ( symlinked to) /var/tmp is mounted into shared memory RAM (aka tmpfs)
but instead resides on the disk. If /tmp ( symlinked to /var/tmp) is desired to have as shared memory tmpfs
( and probably for SSD recommended if enough RAM is available)
this line within /etc/fstab is required:

Code: Select all

tmpfs      /tmp           tmpfs   defaults,mode=1777 0  0
:puppy:
EDIT: Corrected to have /tmp as tmpfs, as clarfied by BitJam here

User avatar
MAYBL8
MX Packager
Posts: 599
Joined: Thu Dec 31, 2009 1:48 pm

Re: Mount /tmp as tmpfs

#7 Post by MAYBL8 »

Ok now it shows this:

Code: Select all

dcihon@mx:~/.conky$ cat /proc/mounts | grep tmpfs
udev /dev devtmpfs rw,nosuid,relatime,size=8158164k,nr_inodes=2039541,mode=755 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636936k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=6629300k 0 0
tmpfs /var/tmp tmpfs rw,relatime 0 0
cgroup /sys/fs/cgroup tmpfs rw,relatime,size=12k,mode=755 0 0
tmpfs /run/user/115 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=115,gid=126 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=1000,gid=1000 0 0

User avatar
fehlix
Developer
Posts: 12625
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#8 Post by fehlix »

dcihon wrote: Sat Dec 22, 2018 6:24 pm Ok now it shows this:

Code: Select all

dcihon@mx:~/.conky$ cat /proc/mounts | grep tmpfs
udev /dev devtmpfs rw,nosuid,relatime,size=8158164k,nr_inodes=2039541,mode=755 0 0
tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=1636936k,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=6629300k 0 0
tmpfs /var/tmp tmpfs rw,relatime 0 0
cgroup /sys/fs/cgroup tmpfs rw,relatime,size=12k,mode=755 0 0
tmpfs /run/user/115 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=115,gid=126 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=1636932k,mode=700,uid=1000,gid=1000 0 0
nice , when you open /tmp in Thunar you see free space is related to your available ram.
I think default for tmpfs to have 50% RAM promised for tmpfs to be used, sure lot's of tweaking can be done here.
Only if enough RAM is available this is recommended - otherwise tmpfs would go swapped out into disk on swap-partition/file :eek:

User avatar
BitJam
Developer
Posts: 2303
Joined: Sat Aug 22, 2009 11:36 pm

Re: Mount /tmp as tmpfs

#9 Post by BitJam »

dphn wrote: Sat Dec 22, 2018 7:28 am You don't need it on MX. /tmp linked to /var/tmp and this loads to RAM. Good configuration on MX.
This configuration does not follow the Linux Filesystem Hierarchy Standard. It is okay for /tmp to be tmpfs because there is no guarantee that files under /tmp will survive a reboot. But the whole point of having a separate /var/tmp is so that files put there can survive a reboot.

From the Filesystem Hierarchy Standard:
/var/tmp : Temporary files preserved between system reboots

The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.

Files and directories located in /var/tmp must not be deleted when the system is booted. Although data stored in /var/tmp is typically deleted in a site-specific manner, it is recommended that deletions occur at a less frequent interval than /tmp.
"The first principle is that you must not fool yourself -- and you are the easiest person to fool."

-- Richard Feynman

User avatar
fehlix
Developer
Posts: 12625
Joined: Wed Apr 11, 2018 5:09 pm

Re: Mount /tmp as tmpfs

#10 Post by fehlix »

BitJam wrote: Sun Dec 23, 2018 1:49 am The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.
Thanks, for pointing that out.

Post Reply

Return to “General”