Using /dev/shm with Librewolf Fri, 19 Dec 2025 07:26:23 +0100 +-----------------------------------------------------------------+ I recently upgraded my laptop to 16Gb RAM which is pretty much overkill but I wanted to use it for tmpfs which will make my SSD happy as less write cycles when writing to /tmp. Since kernel 2.6 there's another advantage: /dev/shm which acts like a ram disk. One of the most ressource heavy applications I have is my GUI browser, Librewolf. It turns out I can put Librefox's profile into /dev/shm as long as I remember to backup when shutting down, and restore it when booting up. My SSD is so happy with this as again it cuts down the write cycles, and RAM is around 1000 times faster than the SSD. Notes ------ ** Both /dev/shm and tmpfs are used for temporary file storage, but /dev/shm is specific to Linux and is typically used for shared memory, while tmpfs can be used more generally for temporary files. ** In FreeBSD unlike Linux /dev/shm is used for special purposes. If /tmp is mounted as tmpfs you can use this instead. ** Librewolf doesn't use a disk cache by default. Check about:cache?storage=disk if you are using another Firefox variant and either disable or set it to use /dev/shm too, unless you have massive cache requirements that depass available RAM space. ----- /Notes In Librewolf I checked about:support to see my profile directory. I copied this profile in ~/.librewolf to /dev/shm: mkdir /dev/shm/librewolf-profile cp -R ~/.librewolf/XXXXXXXX.default-release \ ~/librewolf/XXXXXXXX.default-release_BACKUP cp -R ~/.librewolf/XXXXXXXX.default-release \ /dev/shm/librewolf-profile/XXXXXXXX.default-release rm -r ~/.librewolf/XXXXXXXX.default-release ln -s /dev/shm/librewolf-profile/XXXXXXXX.default-release \ ~/.librewolf/XXXXXXXX.default-release all well and good, but RAM is volatile, the profile will dissapear between reboots. so I have two scripts to backup and restore: #!/usr/bin/env bash #lw-backup rsync -a --delete /dev/shm/firefox-profile/ \ /home/philip/.librewolf/XXXXXXXX.default-release_BACKUP/ #!/use/bin/env bash #lw-restore mkdir -p /dev/shm/librewolf-profile rsync -a /home/philip/.librewolf/XXXXXXXX.default-release_BACKUP/ \ /dev/shm/librewolf-profile/ Both scripts must be in my PATH, for example .local/bin I use Artix Linux with dinit and the DWM windowmanager. Login is managed with XDM. So I can add lf-restore to my .xinitrc Dinit doesn't manage shutdown scripts, but I have a dmenu panel that calls a script for logout, suspend, hibernate, lock and poweroff. So I added lf-backup to this script. #!/usr/bin/env bash # save librewolf ram profile to disk $HOME/.local/bin/lf-save.sh case $1 in shutdown) loginctl poweroff ;; reboot) loginctl reboot ;; logout) pkill -u $USER ;; lock) slock ;; suspend) loginctl suspend ;; hibernate) loginctl hibernate ;; *) echo "unknown command" ;; esac Voila. ␌