Moving Chromium Cache from SSD to RAM using psd on OpenRC

4 min

language: ja bn en es hi pt ru zh-cn zh-tw

Hello, I'm Munou.

I happened to be browsing the Arch Wiki and found something interesting.

Improving performance - ArchWiki

It seemed to make sense, so I decided to give it a try.

After writing this, I realized the Japanese in the title was a bit off, but...

In short, various information such as caches for Chromium and other browsers per user...

...is placed under ~/.config/chromium. By default, this is placed on persistent disks like HDD/SSD, but it would be faster if placed on RAM ( tmpfs ), right? Since it's RAM, will it volatilize? Then, I'll just periodically copy it to the persistent disk while it's running. That's the idea.

A while ago, there were many similar things that treated spare RAM areas like persistent disks. Is this a survivor of that era?

Installation

sudo pacman -S profile-sync-daemon

Configuration

Since nothing is enabled by default, edit ~/.config/psd/psd.conf.

In my case, I use this setting because my laptop often goes into suspend mode.

$ cat ~/.config/psd/psd.conf | grep -v \# 

USE_SUSPSYNC="yes"

BROWSERS=(chromium firefox vivaldi)

USE_OVERLAYFS="yes"

To run on OpenRC

Add under /etc/local.d

/etc/local.d - Gentoo wiki

$ cat /etc/local.d/psd.start 
#!/bin/sh
/usr/bin/psd sync
$ cat /etc/local.d/psd.stop 
#!/bin/sh
/usr/bin/psd resync
/usr/bin/psd unsync
$ chmod +x /etc/local.d/psd*

Restart the local service after stopping all processes you want to manage, including chromium.

sudo rc-service local restart

Confirm that the symbolic link points to the tmpfs directory.

$ ls -la ~/.config/chromium
lrwxrwxrwx 1 haturatu haturatu 36  4月 19 08:38 /home/haturatu/.config/chromium -> /run/user/1000/psd/haturatu-chromium

Conclusion

I did it, but...

imageI feel like I should have cleaned up properly before moving things to RAM... ^^;

*Update

In the case of OpenRC, it needs to be executed in user space, and since it's designed for systemd, data might be lost if used as is. So I don't recommend it, but I'll add a workaround later.

I created a daemon for OpenRC

yay -S profile-sync-daemon-openrc-git

Related Posts