I run once a week a simple backup with rsync. For that purpose, I
wrote a service file (rsync) and a timer unit. They both work with no
issues.

 /etc/systemd/system/backup-external.service
----------------------------------------------------
[Unit]
Description=Backup system to external drive
Requires=mnt-backup.mount
After=mnt-backup.mount

[Service]
Type=oneshot
ExecStart=/usr/bin/rsync -av --delete --exclude-from
/etc/conf.d/exclude-hortensia / /mnt/backup/hortensia
ExecStartPost=/usr/bin/umount /mnt/backup
-----------------------------------------------------------------------------

I would like to mount/umount the backup partition only when the
service is triggered. Backup partition is on a USB external drive and
LVM group.
My first attempt was to add this line in my /etc/fstab:
-------------------------------------------------------
UUID=868560c1-ab69-423f-b76d-b8ea5af1b066     /mnt/backup
  ext2    
noauto,x-systemd.automount,x-systemd.device-timeout=5,x-systemd.idle-timeout=60
       0    2
-----------------------------------------------------------

$ ls /run/systemd/generator
.....
mnt-backup.automount
mnt-backup.mount
----------------------------------------

For unknown reasons, the partition did mount at boot and never umount.
The only way I found to achieve my goal is:
- remove the entry in /etc/fstab
- copy the .mount and .automonut files in /etc/systemd/system

I have the expected behavior this way.
My question: is this the standard way and advised to do it? Why my
ftsab entry did not work?

Thank you


-- 

google.com/+arnaudgabourygabx
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to