我正在尝试移动caches
and index
从 IntelliJ IDEA 配置目录到 RAM 挂载点的目录/tmp
使用符号链接。
我已经添加:tmpfs /tmp/ramdisk tmpfs defaults,size=1024M,x-gvfs-show,mode=1777 0 0
to /etc/fstab
,并替换为caches
and index
intellij config 目录中的目录,其中包含指向 ram 挂载点的符号链接:
$ 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.
我还需要重新创建缓存和索引目录,否则符号链接将无法工作
有一个更好的方法吗?
只是为了回答这个问题,以防其他人偶然发现这个问题并想要答案。
我最终使用了tmp文件.d http://0pointer.de/public/systemd-man/tmpfiles.d.html。为我的目的创建了一个新的配置文件/usr/lib/tmpfiles.d/
包含以下内容:
#Type Path Mode UID GID Age Argument
d /tmp/ramdisk/intellij/caches 0777 root root - -
d /tmp/ramdisk/intellij/index 0777 root root - -
现在我需要的目录会在每次启动时重新创建。
我仍然会重新考虑是否需要这个,因为根据第一篇文章中的评论,它在 Linux 操作系统上不会产生太大的影响。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)