I'm trying to move caches
and index
directories from the IntelliJ IDEA config dir to RAM mount point in /tmp
using symbolic links.
I've added: tmpfs /tmp/ramdisk tmpfs defaults,size=1024M,x-gvfs-show,mode=1777 0 0
to /etc/fstab
, and replaced caches
and index
directories in the intellij config directory with symbolic links pointing to the ram mount point with:
$ mkdir /tmp/ramdisk/intellij/caches
$ mkdir /tmp/ramdisk/intellij/index
$ ln -s /tmp/ramdisk/intellij/caches caches #inside intellij config/system dir
$ ln -s /tmp/ramdisk/intellij/index index #inside intellij config/system dir
The problem is, on every reboot the mount directories will be deleted from /tmp
and before mounting I will need to re-create them, otherwise I will get an error mount: /tmp/ramdisk: mount point does not exist.
I will also need to re-create caches and index directories or the symbolic links won't work
Is there a better way to do this?
Just for the sake of answering the question and in case anyone else will stumble on this and will want an answer.
I've ended up using tmpfiles.d. Created a new config file for my purposes under
/usr/lib/tmpfiles.d/
with the following contents:And now the directories I need are re-created on each boot.
I will still re-think if I need this at all, since as per comments in the first post it won't make much of a difference on a linux os.