<SOLVED> Putting /tmp on tmpfs

Message
Author
User avatar
dolphin_oracle
Developer
Posts: 20010
Joined: Sun Dec 16, 2007 1:17 pm

Re: <SOLVED> Putting /tmp on tmpfs

#11 Post by dolphin_oracle »

philotux wrote: Wed Jan 23, 2019 8:09 am Is putting ~/.cache on tmpfs any good or bad idea?
bad, because cache directories need to survive reboots.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.

philotux
Posts: 280
Joined: Sun Apr 22, 2018 12:57 pm

Re: <SOLVED> Putting /tmp on tmpfs

#12 Post by philotux »

dolphin_oracle wrote: Wed Jan 23, 2019 8:42 am
philotux wrote: Wed Jan 23, 2019 8:09 am Is putting ~/.cache on tmpfs any good or bad idea?
bad, because cache directories need to survive reboots.
Alright. Good to know. Thank you!

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

Re: <SOLVED> Putting /tmp on tmpfs

#13 Post by BitJam »

Wrong thread.
"The first principle is that you must not fool yourself -- and you are the easiest person to fool."

-- Richard Feynman

User avatar
Lupin
Posts: 37
Joined: Fri Jul 26, 2019 4:52 am

Re: <SOLVED> Putting /tmp on tmpfs

#14 Post by Lupin »

hey guys,

I've done the same things as philotux did, I also separated /var to another partiotion. now I have a question about whether my fstab entries are correctly set for these two or not :

Code: Select all

UUID=d0110d7a... /var ext4 defaults 0 2
tmpfs /tmp tmpfs defaults,nosuid,nodev,mode=1777 0 0
thanks.

TTwrs
Posts: 200
Joined: Fri Oct 12, 2018 5:32 pm

Re: <SOLVED> Putting /tmp on tmpfs

#15 Post by TTwrs »

In an effort to reduce wear and tear on flashdrives, I have .cache set as /tmpfs, along with several other directories shown below. This works for all of the programs I've been using so far, so it appears that they just recreate their cache as needed. There may be others that do, however, require certain things to remain cached through reboots, so backup first before trying.

This is a partial 'df -h' listing:
Filesystem Size Used Avail Use% Mounted on
tmpfs 12G 1.2M 12G 1% /tmp
tmpfs 7.8G 12M 7.8G 1% /home/demo/.cache
tmpfs 7.8G 136K 7.8G 1% /home/demo/.thumbnails
tmpfs 7.8G 0 7.8G 0% /home/demo/.local/share/gvfs-metadata
tmpfs 7.8G 0 7.8G 0% /home/demo/.local/share/Trash
tmpfs 7.8G 85M 7.8G 2% /var/cache/apt
tmpfs 7.8G 116M 7.7G 2% /var/lib/apt/lists
tmpfs 7.8G 3.7M 7.8G 1% /var/lib/mlocate

I accomplish that with the following in /etc/fstab (of course the username, demo, would need to be changed to yours):

Code: Select all

# temp files
# alternatively, set #RAMTMP=yes in /etc/default/tmpfs
tmpfs /tmp/ tmpfs defaults,size=75%,noatime,nodev,nosuid 0 0

# cache
tmpfs /home/demo/.cache/ tmpfs defaults,noatime 0 0
tmpfs /root/.cache/ tmpfs defaults,noatime 0 0

# Trash
tmpfs /home/demo/.local/share/Trash/ tmpfs defaults,noatime 0 0
tmpfs /root/.local/share/Trash/ tmpfs defaults,noatime 0 0

# thumbnails
tmpfs /root/.thumbnails/ tmpfs defaults,noatime 0 0
tmpfs /home/demo/.thumbnails/ tmpfs defaults,noatime 0 0 

# package lists
tmpfs /var/cache/apt/ tmpfs defaults,noatime 0 0
tmpfs /var/lib/apt/lists/ tmpfs defaults,noatime 0 0

# mlocate database
tmpfs /var/lib/mlocate/ tmpfs defaults,noatime 0 0

# gvfs metadata
tmpfs /home/demo/.local/share/gvfs-metadata/ tmpfs defaults,noatime 0 0

After setting /tmp to run as tmpfs, I then symlink several files to /tmp with the following:

Code: Select all

ln -sfT /tmp/dead.letter ~/dead.letter
ln -sfT /tmp/nohup.out ~/nohup.out
ln -sfT /tmp/artha.log ~/.config/artha.log
ln -sfT /tmp/psensor.log ~/.psensor/log
ln -sfT /tmp/.python_history ~/.python_history
ln -sfT /tmp/.bash_history_home ~/.bash_history
ln -sfT /tmp/.xfce4-session.verbose-log ~/.xfce4-session.verbose-log  # redo after installing a snapshot
ln -sfT /tmp/.xfce4-session.verbose-log.last ~/.xfce4-session.verbose-log.last  # redo after installing a snapshot
ln -sfT /tmp/qpdfview_database /home/demo/.local/share/qpdfview/qpdfview/database  # redo after installing a snapshot
ln -sfT /tmp/cookies.sqlite-wal ~/.mozilla/firefox/????????.default-release/cookies.sqlite-wal
ln -sfT /tmp/favicons.sqlite-wal ~/.mozilla/firefox/????????.default-release/favicons.sqlite-wal
ln -sfT /tmp/places.sqlite-wal ~/.mozilla/firefox/????????.default-release/places.sqlite-wal
ln -sfT /tmp/webappsstore.sqlite-wal ~/.mozilla/firefox/????????.default-release/webappsstore.sqlite-wal
ln -sfT /tmp/panacea.dat ~/Live-usb-storage/.thunderbird/????????.default/panacea.dat
ln -sfT /tmp/downloads.json ~/Live-usb-storage/.thunderbird/????????.default/downloads.json
ln -sfT /tmp/content-prefs.sqlite ~/Live-usb-storage/.thunderbird/????????.default/content-prefs.sqlite
ln -sfT /tmp/startupCache.8.little ~/Live-usb-storage/.thunderbird/????????.default/startupCache/startupCache.8.little

This one needs sudo:
sudo ln -sfT /tmp/.bash_history_root /root/.bash_history  # redo after installing a snapshot
I've been doing this with live distros on several systems since MX16, mostly on laptops with 8GB of RAM or more, so far without problems. I'd rather /tmp (RAM) gets the workout, than the flashdrives. ;-)

Post Reply

Return to “General”