profile-sync-daemon(1)

NAME
Profile-sync-daemon - Symlinks and syncs browser profiles to RAM (tmpfs) thus reducing HDD/SSD calls and speeding up browsers.

DESCRIPTION
Profile-sync-daemon (psd) is a tiny pseudo-daemon designed to manage browser profile/profiles in tmpfs and to periodically sync back to the physical disk (HDD/SSD). This is accomplished by an innovative use of rsync to maintain synchronization between a tmpfs copy and media-bound backup of the browser profile/profiles. Additionally, psd features several crash-recovery features.

Design goals of psd:

    •   Completely transparent user experience.

    •   Speed.

Since the profile/profiles, browser cache*, etc. are relocated into tmpfs (RAM disk), the corresponding I/O associated with using the browser is also redirected from the physical disk to the RAM, thus improving browser responsiveness during read/writes to profiles.

*Note that some browsers such as Chrome/Chromium, Firefox, Midori, and Rekonq actually keep their cache directories separate from their browser profile directory. It is not within the scope of Profile-sync-daemon to modify this behavior; users wishing to relocate this directory, may refer to the following url for several work-arounds: https://wiki.archlinux.org/index.php/Chromium_Tips_and_Tweaks#Cache_in_tmpfs

SETUP
$XDG_CONFIG_HOME/psd/psd.conf (referred to hereafter as "the config file") contains all user managed settings.

NOTE: edits made to the config file while psd is active will be applied only after the service has been restarted.

    •   With the release of v7.00 of psd overlayfs mode is the only supported option. It improve sync speed and offers a smaller memory footprint.

    •   Optionally define which browsers are to be managed in the BROWSERS array. If none are defined, the default is all detected browsers.

    •   Optionally disable the use of crash-recovery snapshots (not recommended). Do this in the USE_BACKUPS variable.

    •   Optionally define the number of crash-recovery snapshots to keep. Do this in the BACKUP_LIMIT variable.

NOTE: occasionally, updates/changes are made to the default config file (/usr/share/psd/psd.conf) upstream. The user copy ($XDG_CONFIG_HOME/psd/psd.conf) will need to be diffed against it.

RUNNING PSD

  PREVIEW MODE
The preview option can be called to show users exactly what psd will do/is doing based on the entries in the config file. It will also provide useful information such as profile size, paths, and if any recovery snapshots have been created.

% Profile-sync-daemon v7.00

 systemd service: active
 resync-timer:    active
 Psd will manage the following per /home/facade/.config/psd/.psd.conf:
 browser/psname:  chromium/chromium
 owner/group id:  facade/100
 sync target:     /home/facade/.config/chromium
 tmpfs dir:       /run/user/1000/psd/facade-chromium
 profile size:    110M
 overlayfs size:  64M
 recovery dirs:   none
 browser/psname:  firefox/firefox
 owner/group id:  facade/100
 sync target:     /home/facade/.config/mozilla/firefox/z0pauair.default
 tmpfs dir:       /run/user/1000/psd/facade-firefox-z0pauair.default
 profile size:    4.0K
 overlayfs size:  0
 recovery dirs:   none
 browser/psname:  firefox/firefox
 owner/group id:  facade/100
 sync target:     /home/facade/.config/mozilla/firefox/kgtk05jp.default-release
 tmpfs dir:       /run/user/1000/psd/facade-firefox-kgtk05jp.default-release
 profile size:    20M
 overlayfs size:  19M
 recovery dirs:   none

  START AND STOP PSD
Psd ships with a systemd user service to start or stop it (psd.service).

Additionally, a provided resync-timer will run an hourly resync from tmpfs back to the disk. The resync-timer is started automatically with psd.service so there is no need to start the timer; only start psd.service.

Of course, the frequency of the resync can be adjusted with a systemd drop-in. For example, to trigger the resync every 15 minutes:

 % systemctl --user edit psd-resync.timer
 [Timer]
 OnCalendar=*:0/15
 % systemctl --user [option] psd.service

  CLEAN MODE
The clean mode will delete ALL recovery snapshots that have accumulated. Only run it when sure these are no longer needed.

 % psd c
 Profile-sync-daemon v7.00
 Deleting 2 crashrecovery dirs for profile /home/facade/.config/chromium
  /home/facade/.config/chromium-backup-crashrecovery-20260209_171359
  /home/facade/.config/chromium-backup-crashrecovery-20260209_112204

SUPPORTED BROWSERS

•   Chromium (stable, beta, and dev)

•   Conkeror

•   Epiphany

•   Falkon

•   Firefox (version 147 and above use freedesktop.org XDG base dir specs others use legacy ~/.mozilla)

•   Firefox-trunk (this is an Ubuntu-only browser: http://www.webupd8.org/2011/05/install-firefox-nightly-from-ubuntu-ppa.html)

•   Google Chrome (stable, beta, and dev)

•   Heftig's version of Aurora (Arch Linux: https://bbs.archlinux.org/viewtopic.php?id=117157)

•   Icecat

•   Iceweasel

•   Inox (https://bbs.archlinux.org/viewtopic.php?id=198763)

•   Luakit

•   Midori

•   Opera (legacy, stable, next, and developer)

•   Otter-browser

•   Palemoon

•   QupZilla

•   Qutebrowser

•   Rekonq

•   Seamonkey

•   Vivaldi

•   Vivaldi-snapshot

Psd's infrastructure can work in principal with any browser that uses a generic chrome or mozilla, etc. format. User supplied profiles are provided in /usr/share/psd/contrib/ and can be manually copied to /usr/share/psd/browsers/ if one wishes to sync that particular browser. Make a corresponding entry in the BROWSERS array within the config file. Support for these is unsupported.

NOTE ON SYMLINKED PROFILES
Currently, psd does not support symlinked profiles and will refuse to sync if one is detected. For example, your firefox profile is ~/.mozilla/firefox/f8cv8bfu.default but you have moved that directory to /foo/bar/f8cv8bfu.default and replaced it with symlink:

 % ls -l ~/.mozilla/firefox
 lrwxrwxrwx 1 facade users  26 Oct  1 17:02 f8cv8bfu.default -> /foo/bar/f8cv8bfu.default
Running psd in preview mode will end in an error informing you of this:

 % psd p
 Warning!
 /home/facade/.mozilla/firefox/f8cv8bfu.default appears to be a symlink but these are not supported.
 Please make the browser profile a live directory and try again. Exiting.
A proper work around for firefox is to simply edit ~/.mozilla/firefox/profiles.ini defining the canonical path there. One also needs to adjust the IsRelative flag like so:

 [Profile0]
 Name=default
 IsRelative=0
 Path=/foo/bar/f8cv8bfu.default
Other solutions may exist for other browsers but documenting them all here is out of scope.

SUPPORTED DISTROS
Since psd is just a bash script with a systemd service, it should run on any flavor of Linux running systemd. Several distros provide an official package or user-maintained option to install psd. One can also build psd from source. See the official website for available packages, dependencies, and installation instructions

FAQ
Q1: Why do I have another browser profile directory "foo-back-ovfs" when I enable overlayfs?

A1: The way overlayfs works is to mount a read-only base copy (so-called lower dir) of the profile, and manage the new data on top of that. In order to avoid resyncing to the read-only filesystem, a copy is used instead. So using overlayfs is a trade-off: faster initial sync times and less memory usage vs. disk space in the home dir.

Q2: I need more memory to accommodate my profile/profiles in /run/user/xxxx. How can I allocate more?

A2: The standard way of controlling the size of /run/user/ is the RuntimeDirectorySize directive in logind.conf (see the man page for logind.conf for more). By default, 10% of physical memory is used but one can increase it safely. Remember that tmpfs only consumes what is actually used; the number specified here is just a maximum allowed.

Q3: My system crashed for some reason and psd didn't sync back. What do I do?

A3: The "last good" backup of the browser profile/profiles should be the filesystem. Upon restarting psd (on a reboot for example), a check is performed to see if the symlink to the tmpfs copy of the profile is invalid. If it is invalid, psd will snapshot the "last good" backup before it rotates it back into place. This is more for a sanity check that psd did no harm and that any data loss was a function of something else.

Q4: Where can I find this snapshot?

A4: It depends on the browser. The snapshot will be located in the same directory as the browser profile and it will contain a date-time-stamp that corresponds to the time at which the recovery took place. For example, a chromium snapshot will be ~/.config/chromium-backup-crashrecovery-20130912_153310 -- of course, the date_time suffix will be different.

Q5: How can I restore the snapshot?

A5: Follow these steps:

    1.  Stop psd.

    2.  Move the "bad" copy of the profile to a backup (don't blindly delete anything).

    3.  Copy the snapshot directory to the name that browser expects.

    Example using chromium:

    1.  systemctl --user stop psd.service

    2.  mv ~/.config/chromium ~/.config/chromium-bad

    3.  cp -a ~/.config/chromium-backup-crashrecovery-20130912_153310 ~/.config/chromium

At this point, launch chromium which will use the backup snapshot just copied into place. If all is well, it is safe to delete ~/.config/chromium-bad and the snapshot. Remember, to start psd, no browsers must be open (or psd will refuse to start).

Q6: Can psd delete the snapshots automatically?

A6: Yes, run psd with the "clean" switch to delete snapshots.

CONTRIBUTE
Users wishing to contribute to this project, should fork it and send a pull request. Source is freely available on github.

BUGS
Discovered a bug? Please open an issue.

    •   Several cases of data loss have been reported when using eCryptFS and psd, therefore until this issue is flushed out, users of eCryptFS are encouraged not to use psd unless willing to help troubleshoot suspected browser corruption. See: https://github.com/graysky2/profile-sync-daemon/issues/158

ONLINE

•   Project page: https://github.com/graysky2/profile-sync-daemon

•   Wiki page: https://wiki.archlinux.org/index.php/Profile-sync-daemon

AUTHOR
graysky (therealgraysky AT proton DOT me)