/var/cache to TMPFS. Advice needed

Ubuntu 22.04.5 LTS. home laptop. 16 gb ram.

I wanna put /var/cache in tmpfs to avoid SSD wear off and speed up my operation (as RAM so much faster than SSD). is this safe to do so? Anyone here did so? How much space should I dedicate? What caveats I can get?

1 Like

Interesting question - would it save much time?

Most of the content of my /var/cache is used by apt on my Debian system. Maybe I should clear it, as it uses up quite a lot of my boot drive:

I’m not sure if it would save much time or be inadvisable, but at least I discovered it(s contents) may perhaps be safely removed, according to this thread.

1 Like

sudo micro /etc/fstab

+ tmpfs /var/cache tmpfs nosuid,nodev,noatime 0 0

or use COW filesystem consider more efficient for ssds.

1 Like

Welcome to the forums @owon :handshake:t3:

You don’t really need to move /var/cache to tmpfs anymore. Most modern distros (including Ubuntu 22.04 LTS) already use tmpfs for things like /tmp and rely on zram/zswap to cut down SSD writes.

Putting the whole /var/cache in RAM just means you’ll lose useful caches every reboot and force extra downloads/rebuilds, which usually slows things down instead of speeding them up.

If you’re interested in the broader topic of reducing SSD wear, I wrote up some notes here that might help:

1 Like