Skip to content

K0-Z0/firefox-profiles-to-ram

 
 

Repository files navigation

Firefox Profile(s) to and from RAM Utils

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.

Features

  • 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 rsync for reliable synchronization preserving permissions and attributes.
    • Includes rollback mechanisms during initialization.
    • Checks for existence of data before overwriting.
  • Systemd Integration: Runs as a user service (systemd --user), requiring no root privileges.
  • Smart Profile Detection: Automatically detects profiles from profiles.ini.

Prerequisites

  • OS: Linux (Debian 13 / Mint / Ubuntu etc.)
  • Shell: Bash 5.0+
  • Init System: Systemd
  • Browser: Firefox (installed in standard location ~/.mozilla/firefox)

Installation

  1. Clone or Download this repository.
  2. Run the Installer:
    ./install.sh
    This will:
    • 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).

Initialization (Important!)

After installation, you must manually initialize your profiles. The service will not touch your profiles until you do this.

  1. Close Firefox.
  2. Run the initialization command:
    browser-to-ram-utils init
    This command will:
    • Backup your current profiles to *.bak folders.
    • Move the active profiles to RAM (/dev/shm/$USER/browser-profiles).
    • Create symlinks from the original location to the RAM location.

Usage

Automatic

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.

Manual

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 store

Uninstallation

To revert changes and restore your profiles to standard disk storage:

  1. Run the Uninstaller:
    ./uninstall.sh
    This will:
    • 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 .bak backups.
    • Remove the installed script.

Logs & Troubleshooting

The script logs to both the console (stderr) and the systemd journal.

To view logs:

journalctl --user -t browser-to-ram

To check the status of the service:

systemctl --user status browser-to-ram-utils.service

Configuration

The 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.

About

Debian 13 / LMDE7 convenience scripts to load firefox profiles to ram and to store them back to disk with systemd integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%