<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sat, Sep 8, 2018 at 8:20 PM Michael Hirmke <<a href="mailto:mh@mike.franken.de">mh@mike.franken.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi *,<br>
<br>
for my backups I use disks in a way similar to tapes.<br>
I have a fixed backup disk with one single partition, which is used for<br>
backing up the machine hosting this disk and a few other machines from<br>
remote. At night the contents from this disk get copied via rsync to a<br>
removable disk of the same size, which is replaced by another one next<br>
morning.<br>
<br>
For the backup "master" I have the following requirements:<br>
<br>
- The partition has to be mounted on boot.<br>
- It has to be unmounted before the nightly copy job, so that an fsck<br>
can be performed.<br>
- After that it has to be mounted read only, so that during the copy<br>
job no other machine can write to it.<br>
- After finishing the copy job, the partition has to be remounted read<br>
write again.<br></blockquote><div><br></div><div>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.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
To achive that, at the moment my backup routine calls the following<br>
commands:<br>
- systemctl mask var-backup.mount<br>
- systemctl stop nfsserver smb (to avoid the partition being busy)<br>
- systemctl stop var-backup.mount<br>
- systemctl start nfsserver smb<br>
- fsck -yf /dev/sdf1<br>
- mount -o ro /dev/sdf1 /var/backup<br>
- (mount dup partition, fsck dup partition, rsync, umount dup partition)<br>
- mount -o remount,rw /dev/sdf1 /var/backup<br>
- systemctl unmask var-backup.mount<br>
<br>
It seems to be unnecessary complicated, but I didn't find a way to<br>
achive what I described above with a less complicated approach.<br>
Everything else I tried, led to problems with systemd, that tried<br>
to take unwanted actions. Even using the commands above, 1 out of 10<br>
jobs fails with messages like "Specified filename /dev/sdf1 has no<br>
mountpoint." when *stopping* var-backup.mount.<br></blockquote><div><br></div><div>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.</div><div><br></div><div>(I would just use `umount /var/backup`, however.)</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Mantas Mikulėnas</div></div></div>