I'd like to keep some directories (e.g. /var/cache/apt
, /var/lib/apt/lists
, user browser caches or even Mozilla profiles) in RAM, but still backed by disk. The files should be copied to RAM when mounting and copied back to disk when umounting.
Short of writing a oneshot systemd unit (I've done this, but I don't like it), what options do I have? Adding a tmpfs entry to /etc/fstab is the simplest, but doesn't copy to/from disk.
Also, for user files (e.g. ~/.cache
) can I use a systemd --user
unit, so that it applies / can be configured to individual users independently?