You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 66aad2e
Browse filesBrowse the repository at this point in the historyBrowse files
Then, create ``/etc/backups/80-backup.rules`` with the following content (all on one line)::
37
-
38
-
ACTION=="add", SUBSYSTEM=="block", ENV{ID_PART_TABLE_UUID}=="<the PTUUID you just noted>", TAG+="systemd", ENV{SYSTEMD_WANTS}+="automatic-backup.service"
38
+
The rule matches the filesystem on the backup drive by its UUID, which is the same UUID
39
+
that you will also record in ``/etc/backups/backup.disks``. A single line can also match
40
+
several backup drives, if you separate their UUIDs with ``|``, e.g.
41
+
``ENV{ID_FS_UUID}=="<UUID 1>|<UUID 2>"``.
39
42
40
43
The "systemd" tag in conjunction with the SYSTEMD_WANTS environment variable has systemd
41
44
launch the "automatic-backup" service, which we will create next, as the
@@ -54,12 +57,7 @@ modify it to suit your needs (e.g., more backup sets, dumping databases, etc.).
54
57
55
58
#!/bin/bash -ue
56
59
57
-
# The udev rule is not terribly accurate and may trigger our service before
58
-
# the kernel has finished probing partitions. Sleep for a bit to ensure
59
-
# the kernel is done.
60
-
#
61
-
# This can be avoided by using a more precise udev rule, e.g. matching
62
-
# a specific hardware path and partition.
60
+
# Give the system a moment to settle after the backup drive was connected.
63
61
sleep 5
64
62
65
63
#
@@ -186,6 +184,13 @@ Find the UUID of the filesystem on which backups should be stored::
186
184
187
185
Record the UUID in the ``/etc/backups/backup.disks`` file.
188
186
187
+
Add a line for this UUID to ``/etc/backups/80-backup.rules`` (see above), so that connecting
188
+
the drive starts the ``automatic-backup`` service, and reload the udev rules::
189
+
190
+
udevadm control --reload
191
+
192
+
Every backup drive needs both: its UUID in ``backup.disks`` and a matching udev rule.
193
+
189
194
Mount the drive at /mnt/backup.
190
195
191
196
Create a Borg repository at the location indicated by ``TARGET``::
0 commit comments