Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi Lennart, >On Fri, 14.10.16 12:06, Michael Hirmke (camp...@mike.franken.de) wrote: >> 1. How can I prevent systemd from mounting a manually unmounted >>partition? The partiton should be mounted automatically during system >>start, though. >There were some changes related to this in more recent versions of >systemd. Consider upgrading, 210 is pretty ancient. the distribution I use is openSuSE Leap 42.1 which comes with this version of systemd. Installing a newer version would break a lot of things so I tried to avoid this. But Leap 42.2 is on its way and it contains a much newer version of systemd. So I hope they get it finished soon. >That said, if you don't want systemd to mount the thing, consider >removing it from /etc/fstab (or setting "noauto" on the entry there) >and issuing "systemctl daemon-reload". This would mean, that it isn't mounted on system start, which is necessary for this machine. >In never systemd versions you can also take BSD file lock on the >top-level device node in order to block udev from refreshing the >device and generating events for it. That sounds interesting, but I never heard of this feature. Where can I get more information about it? >> 2. If I would switch from mount/umount to pure systemd behaviour for >>mounting and unmounting partitons in my script, would a command like >>"systemctl stop|start /var/backup" be sufficient? >>And how would a remount command (for read only or read write) look >>like? >"systemctl stop /var/backup" is probably not going to suffice. If you >modify your partition table/disk image during runtime this means the >device will vanish from and return to systemd's view as the accesses >are serialized. Whenever the device pops up again systemd might >requeue the jobs declared in /etc/fstab via the "auto" mount option. I tried it and it behaved exactly as you described above. Therefore it was not useful for my purpose. I then added a mask command before my umount and an unmask command after remounting the partition. Dirty, but working solution. >Lennart Thx and bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
On Fri, 14.10.16 12:06, Michael Hirmke (camp...@mike.franken.de) wrote: > 1. How can I prevent systemd from mounting a manually unmounted >partition? The partiton should be mounted automatically during system >start, though. There were some changes related to this in more recent versions of systemd. Consider upgrading, 210 is pretty ancient. That said, if you don't want systemd to mount the thing, consider removing it from /etc/fstab (or setting "noauto" on the entry there) and issuing "systemctl daemon-reload". In never systemd versions you can also take BSD file lock on the top-level device node in order to block udev from refreshing the device and generating events for it. > 2. If I would switch from mount/umount to pure systemd behaviour for >mounting and unmounting partitons in my script, would a command like >"systemctl stop|start /var/backup" be sufficient? >And how would a remount command (for read only or read write) look >like? "systemctl stop /var/backup" is probably not going to suffice. If you modify your partition table/disk image during runtime this means the device will vanish from and return to systemd's view as the accesses are serialized. Whenever the device pops up again systemd might requeue the jobs declared in /etc/fstab via the "auto" mount option. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi Karel, >On Fri, Oct 14, 2016 at 12:06:00PM +0200, Michael Hirmke wrote: >> Hi *, >> >> I've read the man pages and some more documentation about the mount >> behaviour of systemd, but I couldn't find a definitive answer to my >> questions. >> I have a backup script, that copies all files to backup to a hard disk >> partition, then duplicates the partition to one on a second disk, which >> in turn is changed every day. Before duplicating, the script tries to >> umount the partition on the original disk, does an fsck and then mounts >> the partition read only. When duplicating is finished, the original >> partition is remounted read write again. >Not sure if you copy individual files or all partition (dd(1) or so), >but would be enough to use fsfreeze(8) to avoid umount/mount? I copy individual files with rsync. Therefore I want to make sure, the original partition is clean. >I guess you can call fsck on duplicated partition on the second disk. No, because when copying individual files I never can be sure, that everything goes right. >IMHO fsfreeze is less invasive than umount. Or use LVM snapshots ;-) I know :) But that is not what I need. >Karel Thx and bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
On Fri, Oct 14, 2016 at 12:06:00PM +0200, Michael Hirmke wrote: > Hi *, > > I've read the man pages and some more documentation about the mount > behaviour of systemd, but I couldn't find a definitive answer to my > questions. > I have a backup script, that copies all files to backup to a hard disk > partition, then duplicates the partition to one on a second disk, which > in turn is changed every day. Before duplicating, the script tries to > umount the partition on the original disk, does an fsck and then mounts > the partition read only. When duplicating is finished, the original > partition is remounted read write again. Not sure if you copy individual files or all partition (dd(1) or so), but would be enough to use fsfreeze(8) to avoid umount/mount? I guess you can call fsck on duplicated partition on the second disk. IMHO fsfreeze is less invasive than umount. Or use LVM snapshots ;-) Karel -- Karel Zak http://karelzak.blogspot.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
I think there's been some recent discussion related to this on this mailing list. You might want to check the archives and/or look into the nofail and/or noauto options in your fstab entries. Seems like nofail at least will change the local-fs.target dependency into a Want instead of a Require, which may be what you're looking for here. Cheers, Brian On Fri, Oct 14, 2016 at 9:12 AM, Michael Hirmke wrote: > Hi again, > > [...] > >nfsserver and postfix are depending on local-fs.target, which includes > >var-backup.mount. > >When stopping /var/backup with systemctl, systemd also stops nfsserver > >and postfix. Therefore this is not a solution, because in fact both > >don't need /var/backup. > >How can I solve this? > > it seems to be a very ugly solution, but masking var-backup.mount > before umounting it and unmasking it after remounting works. > Hopefully there are no side effects. > > Does anyone know any not so ugly solution? > > >[...] > > Bye. > Michael. > -- > Michael Hirmke > ___ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/systemd-devel > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi again, [...] >nfsserver and postfix are depending on local-fs.target, which includes >var-backup.mount. >When stopping /var/backup with systemctl, systemd also stops nfsserver >and postfix. Therefore this is not a solution, because in fact both >don't need /var/backup. >How can I solve this? it seems to be a very ugly solution, but masking var-backup.mount before umounting it and unmasking it after remounting works. Hopefully there are no side effects. Does anyone know any not so ugly solution? >[...] Bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi, [...] >>systemd shouldn't generally start any unit on a whim ? if the corresponding >>.mount was started, then it likely was either by request, or as a >>dependency of some program, or via autofs (if you use systemd.automount). >I don't use systemd.automount. >No one requested it as far as I can see. >And "systemctl list-dependencies var-backup.mount" only shows >var-backup.mount. found it out: nfsserver and postfix are depending on local-fs.target, which includes var-backup.mount. When stopping /var/backup with systemctl, systemd also stops nfsserver and postfix. Therefore this is not a solution, because in fact both don't need /var/backup. How can I solve this? [...] Bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
On Fri, 14 Oct 2016, Mantas Mikulėnas wrote: [...] And how would a remount command (for read only or read write) look like? There isn't any. Use `mount`. FWIW, I'm pretty sure "systemctl reload var-backup.mount" will remount the filesystem. You probably want to avoid "restart" though. :-p - Michael___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi Michael, >On Fri, 14 Oct 2016, Mantas Mikul?nas wrote: >[...] >>>And how would a remount command (for read only or read write) look >>>like? >>> >> >> There isn't any. Use `mount`. >FWIW, I'm pretty sure "systemctl reload var-backup.mount" will remount the >filesystem. yes, but not changing from read only to read write and back. >You probably want to avoid "restart" though. :-p >- Michael Bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
Hi Mantas, thx for your answer. [...] >> 1. How can I prevent systemd from mounting a manually unmounted >>partition? The partiton should be mounted automatically during system >>start, though. >> >First, see if you can figure out *why* systemd mounted it. I tried to found that out, but couldn't find any reason. >systemd shouldn't generally start any unit on a whim ? if the corresponding >.mount was started, then it likely was either by request, or as a >dependency of some program, or via autofs (if you use systemd.automount). I don't use systemd.automount. No one requested it as far as I can see. And "systemctl list-dependencies var-backup.mount" only shows var-backup.mount. >> 2. If I would switch from mount/umount to pure systemd behaviour for >>mounting and unmounting partitons in my script, would a command like >>"systemctl stop|start /var/backup" be sufficient? >> >Looks about right, though in some cases `systemctl foo var-backup.mount` >might be needed. Ok, thx. >But, I don't think it will make any difference. >>And how would a remount command (for read only or read write) look >>like? >> >There isn't any. Use `mount`. Ok. Bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd 210 - mount/umount/remount
On Fri, Oct 14, 2016 at 1:06 PM, Michael Hirmke wrote: > Hi *, > > I've read the man pages and some more documentation about the mount > behaviour of systemd, but I couldn't find a definitive answer to my > questions. > I have a backup script, that copies all files to backup to a hard disk > partition, then duplicates the partition to one on a second disk, which > in turn is changed every day. Before duplicating, the script tries to > umount the partition on the original disk, does an fsck and then mounts > the partition read only. When duplicating is finished, the original > partition is remounted read write again. > The script uses the "ancient" mount and umount commands, but once in a > while, systemd takes over and remounts the disk, before fsck has been > finished. > So my questions are: > > 1. How can I prevent systemd from mounting a manually unmounted >partition? The partiton should be mounted automatically during system >start, though. > First, see if you can figure out *why* systemd mounted it. systemd shouldn't generally start any unit on a whim – if the corresponding .mount was started, then it likely was either by request, or as a dependency of some program, or via autofs (if you use systemd.automount). > 2. If I would switch from mount/umount to pure systemd behaviour for >mounting and unmounting partitons in my script, would a command like >"systemctl stop|start /var/backup" be sufficient? > Looks about right, though in some cases `systemctl foo var-backup.mount` might be needed. But, I don't think it will make any difference. >And how would a remount command (for read only or read write) look >like? > There isn't any. Use `mount`. -- Mantas Mikulėnas ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd 210 - mount/umount/remount
Hi *, I've read the man pages and some more documentation about the mount behaviour of systemd, but I couldn't find a definitive answer to my questions. I have a backup script, that copies all files to backup to a hard disk partition, then duplicates the partition to one on a second disk, which in turn is changed every day. Before duplicating, the script tries to umount the partition on the original disk, does an fsck and then mounts the partition read only. When duplicating is finished, the original partition is remounted read write again. The script uses the "ancient" mount and umount commands, but once in a while, systemd takes over and remounts the disk, before fsck has been finished. So my questions are: 1. How can I prevent systemd from mounting a manually unmounted partition? The partiton should be mounted automatically during system start, though. 2. If I would switch from mount/umount to pure systemd behaviour for mounting and unmounting partitons in my script, would a command like "systemctl stop|start /var/backup" be sufficient? And how would a remount command (for read only or read write) look like? TIA. Bye. Michael. -- Michael Hirmke ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel