Home BASH How To Sync Browser Profile Into Tmpfs (RAM) In Linux

How To Sync Browser Profile Into Tmpfs (RAM) In Linux

By sk
Published: Updated: 8.4K views

This tutorial explains how to sync browser profile into Tmpfs (RAM) to improve browser speed in Linux. We can sync the profile(s) manually or using some tools. In this guide, we are going to do it using one such tool named Profile-sync-daemon (shortly psd). The Profile-sync-daemon tool is nothing but a BASH script designed to manage browser's profile(s) in tmpfs and synchronize them periodically with the help of Rsync to the HDDs and/or SSDs. As you may already know, Tmpfs is a temporary filesystem that resides in Memory or Swap partitions. So moving browser's profile will effectively increase overall performance of your browser.

Moving your browser's profile to RAM offers two significant benefits:

  • Reduces hard disk read/write, especially improves the I/O operations in SSDs.
  • Improves your web browser's speed and responsiveness.

One caveat to this approach is that it will slow down login, because your browser's profiles are copied to RAM while logging in.

Supported browsers

Profile-sync-daemon scripts allows us to manage profiles of almost all web browsers including the following:

  • Aurora
  • Chromium
  • Conkeror
  • Epiphany
  • Firefox
  • Firefox-trunk
  • Google Chrome
  • Icecat
  • Iceweasel
  • Inox
  • Luakit
  • Midori
  • Opera, Opera-Beta, Opera-Developer, and Opera-Legacy
  • Otter-browser
  • Palemoon
  • QupZilla
  • Qutebrowser
  • Rekonq
  • Seamonkey
  • Surf
  • Vivaldi-browser and Vivaldi-browser-snapshot

Install Profile-sync-daemon On Linux

Since Profile-sync-daemon is just Bash script, it can be installed on many Linux distributions. Good thing is it is available in the official repositories of some Linux distributions.

On Arch Linux and its variants like Manjaro Linux, install Psd using Pacman like below.

$ sudo pacman -S profile-sync-daemon

On Debian Sid/10/ 9, Ubuntu 19.10/18.04:

$ sudo apt install profile-sync-daemon

On Fedora 31/30, CentOS 8 and other distributions that have DNF installed:

$ sudo dnf copr enable szasza/Profile-sync-daemon
$ sudo dnf install profile-sync-daemon

On other distributions, make sure you have the following dependencies installed:

  • bash >=4.0
  • coreutils
  • findutils
  • kmod
  • rsync
  • systemd

And then download the Profile-sync-daemon latest version from the releases page and install it manually. Refer the INSTALL text document included in the installation file to know how to install it. Installing from source usually like below:

$ make
$ sudo make install

Backup browser profiles

Before start using Psd in the first time, it is highly recommended to backup your browser's profile. For instance, if you're using Mozilla Firefox, all your bookmarks, saved passwords, extensions and plugins are stored in a special folder called Profile. It is usually stored in a separate location other than your Firefox installation directory. So if Firefox is crashed or something went wrong, you can easily restore the profile folder.

In Linux desktops, Firefox profile folder will usually be stored in ~/.mozilla location.

$ ls ~/.mozilla
extensions firefox systemextensionsdev

Go to this location and backup the entire firefox folder and keep it a safe a location.

Also, the refer Firefox's official documentation page to backup and restore profiles.

For other browsers, refer their official documentation.

Sync Browser Profile Into Tmpfs (RAM) In Linux Using Profile-sync-daemon

First, create Psd configuration file by running command:

$ psd

This will create psd.conf file in /home/$USER/.config/psd/ directory.

First time running psd so please edit /home/sk/.config/psd/psd.conf to your liking and run again.

Now edit the psd configuration file:

$ nano /home/sk/.config/psd/psd.conf

Replace /home/sk/ with your own.

Find the BROWSERS line, uncomment it by removing the # symbol and add your browsers separated by spaces.

BROWSERS="chromium firefox"
Edit psd configuration file

Configure Profile-sync-daemon

You can add as many as browsers you wanted by mentioning them space-separated. If there are no browsers defined, Psd will sync all supported browsers. Save and close the file.

Please note that any changes made to the psd.conf file will be applied only after psd service has been started and/or restarted.

Enable and start psd service:

$ systemctl --user enable psd
$ systemctl --user start psd

Verify if psd service has been started or not:

$ systemctl --user status psd
● psd.service - Profile-sync-daemon
   Loaded: loaded (/usr/lib/systemd/user/psd.service; enabled; vendor preset: enabled)
   Active: active (exited) since Wed 2020-03-18 15:45:54 IST; 8s ago
     Docs: man:psd(1)
  Process: 11172 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 11172 (code=exited, status=0/SUCCESS)

Mar 18 15:45:54 ostechnix systemd[3824]: Starting Profile-sync-daemon...
Mar 18 15:45:54 ostechnix systemd[3824]: Started Profile-sync-daemon.

Psd service is enabled and started!

From now on, Profile-sync-daemon will copy your browser's profiles to tmpfs (RAM) at the start-up and will sync them between your HDD/SSD and RAM periodically. It also maintains backup of the profiles in your physical disk.

Preview the Profile-sync-daemon settings

You can preview what exactly Psd is doing by passing the option -p.

$ psd p

Sample output:

Profile-sync-daemon v6.31 on Ubuntu 18.04.4 LTS

 Systemd service is currently active.
 Systemd resync-timer is currently active.
 Overlayfs technology is currently inactive.

Psd will manage the following per /home/sk/.config/psd/psd.conf:

 browser/psname:  chromium/chromium
 owner/group id:  sk/1000
 sync target:     /home/sk/.config/chromium
 tmpfs dir:       /run/user/1000/sk-chromium
 profile size:    32M
 recovery dirs:   none

 browser/psname:  firefox/firefox
 owner/group id:  sk/1000
 sync target:     /home/sk/.mozilla/firefox/htoypxlg.default-1563118799416
 tmpfs dir:       /run/user/1000/sk-firefox-htoypxlg.default-1563118799416
 profile size:    245M
 recovery dirs:   none
preview psd settings

Preview the Profile-sync-daemon settings

As you can see, Psd running in my Ubuntu 18.04 desktop is managing two browser's profiles i.e. Chromium and Firefox. It also displays other useful details such as browser name, owner/group id, profile size, sync target and tmpfs directory path.

Verify if Profile-sync-daemon is working

To verify if Profile-sync-daemon is actually syncing the browser's profile, check your tmpfs directory path. In my case, it is /run/user/1000. You can find the path of tmpfs in the output of "psd p" command.

$ ls /run/user/1000

Sample output:

bus     gnome-shell  psd.pid                                    snapd-session-agent.socket
dbus-1  gnupg        pulse                                      systemd
dconf   gvfs         sk-chromium                                update-notifier.pid
gdm     keyring      sk-firefox-htoypxlg.default-1563118799416
tmpfs sync directory path

Verify if Profile-sync-daemon is working

View tmpfs sync directory from file manager:

tmpfs sync directory path from file manager

tmpfs sync directory path from file manager

Let us check size of the profile folder in tmpfs:

$ du -sh /run/user/1000/sk-firefox-htoypxlg.default-1563118799416/
236M /run/user/1000/sk-firefox-htoypxlg.default-1563118799416/

..and size of Firefox's default profile folder:

$ du -sh ~/.mozilla/firefox/htoypxlg.default-1563118799416
0 /home/sk/.mozilla/firefox/htoypxlg.default-1563118799416
Firefox Profile folder size

Check Firefox Profile folder size

As you see, the profile folder's size in tmpfs is 236M, but default profile folder's size is zero. Because, it is just a Symlink that points to another directory in tmpfs i.e. /run/user/1000/sk-firefox-htoypxlg.default-1563118799416/.

You can verify it using command:

$ readlink ~/.mozilla/firefox/htoypxlg.default-1563118799416

So, Firefox browser's profile is loaded in the tmpfs (i.e. RAM).

When you reboot the system, the profiles will be synced to the physical disk and then copied back to the RAM when you login again.

Suggested read:

Change sync intervals

By default, Profile-sync-daemon runs every one hour. You can, however, change it as per your wish by setting up a cron job for psd.

$ crontab -e

Set the time when you want to run Psd:

*/15 * * * *     /usr/bin/profile-sync-daemon sync &> /dev/null

The above job will run Psd at every quarter hour (i.e every 15th minute). For more examples, please refer our Cron jobs manual.

Clean recovery snapshots

To delete all recovery snapshots, run:

$ psd c

Please do it only if you don't need the snapshots anymore.

For more details, refer the official resources given below.


Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like


Jalal March 19, 2020 - 1:16 pm

Thanks a lot…

fak3r March 24, 2020 - 10:37 pm

This is fantastic, thanks for the post, I’ve set this up on my old (10+ years) iMac running Elementary OS Linux, and it’s working great!

Lou Rizzo June 23, 2020 - 12:15 am

On Ubuntu 20.04LTS this doesn’t work. Using Synaptic I installed PSD, then I edited the PSD.conf file. However, “systemctl” is not installed, by default, in 20.04 so I can’t start PSD. If I try to install “systemctl” from Synaptic I see a message that a whole bunch of important programs will be removed. So, how to I start PSD now?

Lou Rizzo June 23, 2020 - 7:47 pm

My bad about previous comment above. Problem solved. When pasting and copying above commands make sure you don’t accidentally (as I did) include the “$” it’s not part of the commands. Also, after starting and enabling PSD I didn’t see either of the “sk” Firefox or Chromium browser file/folders listed in /run/user/1000 until I rebooted the computer. Otherwise, everything works as far as I can tell, although I don’t really notice any worthwhile speed improvement in either browser. I did notice a slight 2-3 second delay in boot up time.

sk June 23, 2020 - 8:08 pm

Glad you sorted out the problem yourself. I am using 5400 RPM hdd. After moving the browser profiles to tmpfs, I noticed significant changes in browser loading time and responsiveness. The pages are loading faster than before. If you are using SSD, you probably don’t need it.

Oliver R. September 28, 2020 - 7:10 pm

The crontab-entry had the following error on my Ubuntu 18.04:

ERROR: Cannot find XDG_RUNTIME_DIR which should be set by systemd.

So I added ‘XDG_RUNTIME_DIR=”/run/user/1000″‘ before all crontab-commands, no it works.

Foo January 16, 2021 - 1:36 pm

You can use systemd timer instead of crontab


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More