On Sat, Sep 8, 2018 at 8:20 PM Michael Hirmke <mh@xxxxxxxxxxxxxxx> wrote:
Hi *,
for my backups I use disks in a way similar to tapes.
I have a fixed backup disk with one single partition, which is used for
backing up the machine hosting this disk and a few other machines from
remote. At night the contents from this disk get copied via rsync to a
removable disk of the same size, which is replaced by another one next
morning.
For the backup "master" I have the following requirements:
- The partition has to be mounted on boot.
- It has to be unmounted before the nightly copy job, so that an fsck
can be performed.
- After that it has to be mounted read only, so that during the copy
job no other machine can write to it.
- After finishing the copy job, the partition has to be remounted read
write again.
Isn't that commonly done using LVM? If it were on a logical volume, you could fsfreeze /var/backup (to suspend writes during snapshotting), make a LVM snapshot, thaw, mount the read-only snapshot elsewhere and rsync off it.
To achive that, at the moment my backup routine calls the following
commands:
- systemctl mask var-backup.mount
- systemctl stop nfsserver smb (to avoid the partition being busy)
- systemctl stop var-backup.mount
- systemctl start nfsserver smb
- fsck -yf /dev/sdf1
- mount -o ro /dev/sdf1 /var/backup
- (mount dup partition, fsck dup partition, rsync, umount dup partition)
- mount -o remount,rw /dev/sdf1 /var/backup
- systemctl unmask var-backup.mount
It seems to be unnecessary complicated, but I didn't find a way to
achive what I described above with a less complicated approach.
Everything else I tried, led to problems with systemd, that tried
to take unwanted actions. Even using the commands above, 1 out of 10
jobs fails with messages like "Specified filename /dev/sdf1 has no
mountpoint." when *stopping* var-backup.mount.
Can you be more specific about the messages you get? The closest I found to yours was "Specified filename * is not a mountpoint" from the `fuser` command – which is not called by systemd nor umount as far as I could grep.
(I would just use `umount /var/backup`, however.)
Mantas Mikulėnas
_______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel