将IntelliJ IDEA缓存/索引目录移动到RAM [英] Moving IntelliJ IDEA caches/index directories to RAM
问题描述
我正在尝试使用符号链接将caches
和index
目录从IntelliJ IDEA配置目录移动到/tmp
中的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.
我在/etc/fstab
中添加了tmpfs /tmp/ramdisk tmpfs defaults,size=1024M,x-gvfs-show,mode=1777 0 0
,并用指向ram挂载点的符号链接将intellij config目录中的caches
和index
目录替换为:
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
问题是,每次重新启动时,安装目录将从/tmp
中删除,并且在安装之前,我需要重新创建它们,否则会出现错误mount: /tmp/ramdisk: mount point does not exist.
我还需要重新创建缓存和索引目录,否则符号链接将不起作用
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
有更好的方法吗?
推荐答案
只是为了回答问题,以防万一其他人偶然发现该问题并想要答案.
Just for the sake of answering the question and in case anyone else will stumble on this and will want an answer.
我最终使用了 tmpfiles.d .为我的目的在/usr/lib/tmpfiles.d/
下创建了一个新的配置文件,其内容如下:
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.
如果仍然需要,我仍然会重新考虑,因为根据第一篇文章中的评论,它在linux操作系统上不会有太大的不同.
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.
这篇关于将IntelliJ IDEA缓存/索引目录移动到RAM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!