[systemd-devel] making persistent tmpfs folders with systemd

Reindl Harald h.reindl at thelounge.net
Mon Nov 16 10:19:07 PST 2015


Am 16.11.2015 um 18:50 schrieb bobafetthotmail:
> I have a script that allows me to |mount| a folder to |tmpfs|, while
> bind-mounting the same folder to another location, so I can sync the
> contents (on startup, shutdown, and when needed) between the |tmpfs| and
> the original folder on system drive.
>
> I use it for folders that see many writes, but whose data should be
> preserved after a reboot.
>
> Mostly to use a USB flash drive or SD card as system drive, while
> running programs that aggressively write round-robin databases or
> similar small-size-high-write files.
>
> Sooo..... I was wondering if systemd allows me to do something like that
> natively.
>
> I did look at the tmpfs modules of systemd, but from what I understood
> it does deal with making non-persistent tmpfs on the fly, clean
> temporary files from a folder and so on.
>
> Is there a persistency option I did miss perhaps?

what do yu need from systemd in that context?

/etc/fstab:
tmpfs  /var/lib/spamass-milter/.spamassassin          tmpfs 
defaults,noexec,nosuid,noatime,size=1024m,uid=189,gid=188,mode=0700

/etc/systemd/system/bayes.service:
[Unit]
Description=Bayes RAM-Disk Manager
Before=spamassassin.service

[Service]
Type=oneshot
RemainAfterExit=yes
User=sa-milt
Group=sa-milt
ExecStart=/usr/bin/rsync --quiet --recursive --times 
/var/lib/bayes-persistent/ /var/lib/spamass-milter/.spamassassin/
ExecStop=/usr/bin/rsync --quiet --recursive --times 
/var/lib/spamass-milter/.spamassassin/ /var/lib/bayes-persistent/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151116/44fe4d2b/attachment.sig>


More information about the systemd-devel mailing list