Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving IntelliJ IDEA caches/index directories to RAM

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?

like image 285
SergioLeone Avatar asked Oct 19 '25 11:10

SergioLeone


1 Answers

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:

#Type Path                          Mode UID  GID   Age Argument
d     /tmp/ramdisk/intellij/caches  0777 root root  -   -
d     /tmp/ramdisk/intellij/index   0777 root root  -   -

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.

like image 125
SergioLeone Avatar answered Oct 21 '25 15:10

SergioLeone