A robust Bash 5 utility for managing Firefox profiles in RAM (/dev/shm) for improved performance and reduced disk wear, with automatic synchronization via Systemd user services.
- Performance: Moves Firefox profiles to RAM (tmpfs) for faster browsing and reduced disk I/O.
- Automatic Sync:
- Load: Automatically loads profiles from disk to RAM on user login.
- Store: Automatically saves profiles from RAM to disk on user logout or system shutdown.
- Safety:
- Maintains a backup on disk (
*.bak). - Uses
rsyncfor reliable synchronization preserving permissions and attributes. - Includes rollback mechanisms during initialization.
- Checks for existence of data before overwriting.
- Maintains a backup on disk (
- Systemd Integration: Runs as a user service (
systemd --user), requiring no root privileges. - Smart Profile Detection: Automatically detects profiles from
profiles.ini.
- OS: Linux (Debian 13 / Mint / Ubuntu etc.)
- Shell: Bash 5.0+
- Init System: Systemd
- Browser: Firefox (installed in standard location
~/.mozilla/firefox)
- Clone or Download this repository.
- Run the Installer:
This will:
./install.sh
- Install the script to
~/.local/bin/browser-to-ram-utils. - Install the systemd service to
~/.config/systemd/user/browser-to-ram-utils.service. - Enable the service (so it starts on next login).
- Install the script to
After installation, you must manually initialize your profiles. The service will not touch your profiles until you do this.
- Close Firefox.
- Run the initialization command:
This command will:
browser-to-ram-utils init
- Backup your current profiles to
*.bakfolders. - Move the active profiles to RAM (
/dev/shm/$USER/browser-profiles). - Create symlinks from the original location to the RAM location.
- Backup your current profiles to
Once initialized, the system works automatically:
- Login: The service starts and ensures profiles are loaded into RAM.
- Logout/Shutdown: The service stops and syncs changes back to disk.
You can manually control the synchronization if needed:
# Load profiles from disk backup to RAM (safe to run if already loaded)
browser-to-ram-utils load
# Store profiles from RAM to disk backup (overwrites backup with current RAM state)
browser-to-ram-utils storeTo revert changes and restore your profiles to standard disk storage:
- Run the Uninstaller:
This will:
./uninstall.sh
- Stop the service (triggering a final sync to disk).
- Disable and remove the systemd service.
- Remove the symlinks and restore the original profile folders from the
.bakbackups. - Remove the installed script.
The script logs to both the console (stderr) and the systemd journal.
To view logs:
journalctl --user -t browser-to-ramTo check the status of the service:
systemctl --user status browser-to-ram-utils.serviceThe script uses the following default locations:
- Profiles Source:
~/.mozilla/firefox - RAM Destination:
/dev/shm/$USER/browser-profiles
To change these, edit the variables at the top of ~/.local/bin/browser-to-ram-utils.