| tags:linux categories:computing

ブラウザーのプロファイルをRAMディスクへ

ブラウザーのプロファイルをRAMディスクに移しアクセスを高速化、かつSSDを延命化すると一石二鳥なスクリプトを導入します。

パッケージがあるのでAPTでインストール、設定をします。 .config/psd/psd.confを開きブラウザーを指定、オーバーレイを有効にします。 ほとんどのブラウザーに対応してます。 複数追加するにはスペースで間をあけて加えていきます。(例:”firefox vivaldi brave”)

jin@debian:~$ sudo apt install profile-sync-daemon
jin@debian:~$ psd
 First time running psd so please edit /home/jin/.config/psd/psd.conf to your liking and run again.
jin@debian:~$ vi .config/psd/psd.conf

USE_OVERLAYFS="yes"
BROWSERS="firefox”

そしてオーバーレイを使うための設定も行います。コマンドに権限を与えます。

jin@debian:~$ sudo modprobe overlay
jin@debian:~$ sudo visudo

jin ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper

しかしながら、modinfoにアクセスできないとエラーが出る。。インストールはされているのだけど、、

jin@debian:~$ psd p
 I require modinfo but it's not installed. Aborting!

/sbinへパスが通ってないのが問題の様だったので、とりあえず.profile にPATHを追加します。

jin@debian:~$ vi .profile

PATH="/usr/sbin:/sbin"

でもう一度。

jin@debian:~$ psd p
Profile-sync-daemon v6.31 on Debian GNU/Linux 10 (buster)

 Systemd service is currently inactive.
 Systemd resync-timer is currently inactive.
 Overlayfs v23 is currently active.

Psd will manage the following per /home/jin/.config/psd/psd.conf:

 browser/psname:  firefox/firefox
 owner/group id:  jin/1000
 sync target:     /home/jin/.mozilla/firefox/25pb77js.default
 tmpfs dir:       /run/user/1000/jin-firefox-25pb77js.default
 profile size:    4.0K
 overlayfs size:
 recovery dirs:   none

 browser/psname:  firefox/firefox
 owner/group id:  jin/1000
 sync target:     /home/jin/.mozilla/firefox/6uxssp9i.default-esr
 tmpfs dir:       /run/user/1000/jin-firefox-6uxssp9i.default-esr
 profile size:    51M
 overlayfs size:
 recovery dirs:   none

なぜかファイヤーフォックスのプロファイルが二つありますが動きました。
そして仕上げに起動時にユーザーモードで動作させるため systemctl --user enable psd で登録します。

jin@debian:~$ systemctl --user start psd
jin@debian:~$ systemctl --user status psd
● psd.service - Profile-sync-daemon
   Loaded: loaded (/usr/lib/systemd/user/psd.service; disabled; vendor preset: enabled)
   Active: active (exited) since Fri 2020-01-17 20:16:49 +07; 10min ago
     Docs: man:psd(1)
           man:profile-sync-daemon(1)
           https://wiki.archlinux.org/index.php/Profile-sync-daemon
  Process: 3305 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 3305 (code=exited, status=0/SUCCESS)

Jan 17 20:16:49 debian systemd[1059]: Starting Profile-sync-daemon...
Jan 17 20:16:49 debian systemd[1059]: Started Profile-sync-daemon.
jin@debian:~$ systemctl --user enable psd
Created symlink /home/jin/.config/systemd/user/default.target.wants/psd.service → /usr/lib/systemd/user/psd.service.

ちょっと使ってみましたが、スピードに関してはそんなに違いは感じられませんねぇ。 ただSSDへの読み書きは軽減されるのでそちらの恩恵はあるのではないかと思ってます。

参照:https://wiki.archlinux.jp/index.php/Profile-sync-daemon

See Also

🏝 tipping

🌷 sat ⚡️ goozenlab@getalby.com
🌻 bitcoin : bc1qnjhnsxgqah050995dkdveav4y3t3d7uxyme4ud

If you do send a tip, Please email me so that I can say thank you.