bor(1)

NAME
Browser-on-ram (bor) - Sync browser related directories to RAM for Linux

SYNOPSIS
bor [option] ...

DESCRIPTION
Browser-on-ram is a program that syncs browser related directories to RAM. The benefits of this includes:

    •   Speeds up browser

    •   Reduces disk writes

    •   Automatically backs up data

    •   Supports mounting data with an overlay filesystem for reduced memory usage

WARNING
RAM is not persistent! You may lose up to an hour of browsing usage data with the automatic resync timer if your system suddenly exits/crashes. Moreover, before using this program for the first time, make sure to backup your data! Additionally, make sure you have enough space in your runtime directory before running, depending on how big your browser directories are.

USAGE
The recommended way is to use the systemd service, you can enable it it via systemctl --user enable --now bor.service. This will also start the hourly resync timer bor-resync.timer. If you want to resync on sleep, then enable run systemctl enable bor-sleep@$(whoami).service and systemctl --user enable bor-sleep-resync.service. The executable name is bor. To see the current status, run bor --status. Use bor --help for additional info.

OPTIONS

-v, --version
    show version

-V, --verbose
    show debug logs

-h, --help
    show help message

-s, --sync
    synchronize all browsers to RAM

-u, --unsync
    unsynchronize all browsers to RAM

-r, --resync
    resynchronize all browsers to RAM

-c, --clean
    remove detected recovery directories (from previous sessions)

-x, --rm_cache
    clear cache directories

-p, --status
    show current configuration and state

CONFIG
Sample config file with defaults, in ini format (in $XDG_CACHE_HOME/bor/bor.conf):
    # <boolean> = true or false
    [config]
    # sync cache directories (if the browser has ones)
    enable_cache = false
    # resync them (will be resynced when unsynced however)
    resync_cache = true
    # enable overlay filesystem
    enable_overlay = false
    # when resyncing, remount the overlay in order to clear the upper directory
    # (where changes are stored on the tmpfs)
    reset_overlay = false
    # maximum number of log entries to store in log file
    # (0 to disable logging to a file and a negative number for infinite entries)
    max_log_entires = 10
    # default is no browser
    [browsers]
    mybrowser
    myotherbrowser
    # ...

SUPPORTED BROWSERS
List of supported browsers, with the config names in brackets:

    •   Firefox (firefox)

    •   Chromium (chromium)

    •   Google-chrome (google-chrome-stable, google-chrome-beta, google-chrome-unstable)

    •   Vivaldi (vivaldi, vivaldi-snapshot)

    •   Opera (opera)

    •   Brave (brave)

    •   Falkon (falkon)

OVERLAY
Browser-on-ram can mount your data on an overlay filesystem, which can significantly reduce memory usage, as only changed data needs to be stored on RAM. To do this, it uses Linux capabilities (specifically SYS_ADMIN_CAP and SYS_DAC_OVERRIDE). These capabilities are only raised to effective mode when mounting the overlay filesystem and deleting the root owned work directory needed by the overlay filesystem on unsync. If anything related to interacting with capabilties fails, the program immediately exits.

ADDING BROWSERS
Browser-on-ram uses shell scripts that output the information needed to sync them. You can use echo for this.
In short they are in the format of an ini file, parsed line by line:
    # browser-on-ram will automatically set XDG_CONFIG_HOME, XDG_CACHE_HOME, and
    # XDG_DATA_HOME environment variables when calling the script
    # process name of the browser
    procname = mybrowser
    # cache directories (usually in $HOME/.cache)
    cache = /home/user/.cache/mycache
    # profile directory (such as an individual profile or a single monolithic one)
    profile = /home/user/.config/mybrowser
    # ... <additional cache/profiles>
These should be placed in $XDG_CONFIG_HOME/bor/scripts, /usr/local/share/bor/scripts, /usr/share/bor/scripts with .sh extension.
The first one found in that order is used.

DESIGN
Browser-on-ram first parses the output from the shell script for each browser, and gets a list of directories to sync. It then copies each directory to the tmpfs, each prefixed with a SHA1 hash of the original path. Then, the directory is moved to the backup location and a symlink is created to the tmpfs.

AUTHOR
Written by Foxe Chen (64-bitman).

REPORTING BUGS
Please file an issue report at https://github.com/64-bitman/browser-on-ram/issues.

REPOSITORY
The source code repository is at https://github.com/64-bitman/browser-on-ram.