tmpfs all of the things, with anything-sync-daemon

A little while ago, I made a post on profile-sync-daemon. It’s a useful tool for reducing disk I/O with respect to a web browser profile. With that said, there’s other development tools I use as that could benefit from moving the I/O into memory. (eg. default location of local maven repository, $HOME/.m2)

There’s some pretty good documentation and upstream sources , but I don’t think this is packaged in Fedora, and haven’t found an RPM of it anywhere. Luckily it’s actually not that different from profile-sync-daemon, so I was able to use the profile-sync-daemon specfile with some very minor modifications to build it.

To set which directories should be handled by anything-sync-daemon, just modify the /etc/asd.conf file and set the WHATTOSYNC list accordingly . You can parse your config file as well much like profile-sync-daemon to ensure the configuration is correct.

From there, it’s just a matter of starting the service :

$ systemctl start asd.service

In the profile-sync-daemon post I mentioned that it might be nice to put the $HOME/.eclipse under a tmpfs, but this location has fairly predictable file access, and content is rarely written out (mainly during non-RPM/external plugin updates). As a result, this isn’t a great candidate for use with anything-sync-daemon.

One issue that came up was {profile,anything}-sync-daemon’s rsync call attempts to preserve SELinux file contexts (-X) during transfer to/from the tmpfs. SELinux policy will not permit the relabeling but luckily there’s a  nice explanation of this along with some workarounds. I went with changing /usr/bin/rsync from rsync_exec_t to bin_t and the issue seems to have gone away.

Reducing disk I/O with profile-sync-daemon

A little while ago, I finally got a new laptop! After 8 years with a Dell Inspiron 6400 (that has served admirably), I decided on a Dell XPS 13 9333. Fedora 20 worked without any major tweaking. I basically just needed nomodeset on the livecd to get the display working properly, but after a full update, even that wasn’t necessary. Did I mention the touch screen works as well ?

With 8 GB of memory and a 256 GB SSD, it’s already a pretty fast machine, but I’m still trying to optimize performance, and improve battery life, making compromises where necessary. Aside from tuning some kernel parameters, and filesystem options, I’ve come across profile-sync-daemon . It’s a nice tool specifically designed to reduce the disk I/O on a web browser’s profile by ensuring all changes are mainly done in memory (tmpfs) and written back to disk at a later time. It’s also quite easy to set up.

$ yum -y install profile-sync-daemon

Next, simply edit ‘/etc/psd.conf’ and set USERS to contain the list of users the daemon should act upon, along with the list of BROWSERS to manage.

You can even parse the configuration to confirm you’ve set it correctly :

$ profile-sync-daemon parse
Profile-sync-daemon v5.45.1 on Fedora release 20 (Heisenbug).

 Systemd service is currently inactive.
 Systemd resync service is currently inactive.

Psd will manage the following per /etc/psd.conf settings:

 browser/psname:  firefox/firefox
 owner/group id:  user/1000
 sync target:     /home/user/.mozilla/firefox/w74lprxm.default-1408456117113
 tmpfs dir:       /tmp/user-firefox-w74lprxm.default-1408456117113
 profile size:    22M

Now just make sure you’ve temporarily closed any browsers that will be affected by the daemon in order to call :

$ systemctl start psd.service
$ systemctl enable psd.service

and you’re good to go.

As it turns out profile-sync-daemon mainly exists to handle some special cases that are specific to browser profiles. However there’s also anything-sync-daemon that may be used for .. everything else. I have Eclipse open quite often so having things like the $HOME/.eclipse folder or even certain workspace metadata locations (workspace/.metadata/.mylyn) moved into tmpfs might prove useful.

No bug left unassigned

There’s something really satisfying about resolving and (especially) closing a ~2.5 year old bug. In this case it wasn’t a new feature or bug, but just better compliance with packaging guidelines regarding bundled libraries. Thanks to all those that helped out!


Get every new post delivered to your Inbox.