systemd: root device on iscsi
Bill Nottingham
notting at redhat.com
Tue Nov 29 20:49:25 UTC 2011
Karel Zak (kzak at redhat.com) said:
> On Tue, Nov 29, 2011 at 12:18:03PM -0500, Bill Nottingham wrote:
> > Jeremy Sanders (jeremy at jeremysanders.net) said:
> > > > What are you using for networking - the old network service or
> > > > NetworkManager?
> > >
> > > The old network service. The root device is cloned from a non-iscsi
> > > installation, however, as kickstart didn't like to install onto a non-
> > > partitioned iscsi device: https://bugzilla.redhat.com/show_bug.cgi?id=757106
> > > I thought that the _netdev option would be sufficient to get the ordering
> > > correct.
> >
> > Ah, crud. The issue is that we're checking /etc/mtab for _netdev, which is
> > now /proc/mounts, which doesn't transfer over random options such as these
> > into its data store.
> >
> > So, we either need it to start doing that (cc: kzak), or we need to have th
> > code cross-reference devices against /etc/fstab.
> >
>
> libmount manages the option _netdev in userspace (in /run/mount/utab -- but this
> private libmount file is not part of any API, so don't read it), use findmnt(8):
>
> $ grep _netdev /etc/fstab
> /dev/sdb1 /mnt ext3 defaults,_netdev 0
>
> $ findmnt --mtab /mnt
> TARGET SOURCE FSTYPE OPTIONS
> /mnt /dev/sdb1 ext3 rw,relatime,errors=continue,barrier=0,data=ordered,_netdev
>
> $ mount | grep /mnt
> /dev/sdb1 on /mnt type ext3(rw,relatime,errors=continue,barrier=0,data=ordered,_netdev)
>
> Note that things like _netdev are ugly hacks, it would be nice to found a
> better way how mark/detect some specific devices.
It would be nice, yes. In the meantime, Jeremy, can you try the attached
patch?
Bill
-------------- next part --------------
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index c6b86c3..e6ac38e 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -174,12 +174,11 @@ case "$1" in
[ "$EUID" != "0" ] && exit 4
# Don't shut the network down if root is on NFS or a network
# block device.
- rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts)
- rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
-
- if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then
- exit 1
- fi
+ findmnt -m -n -o fstype,options / | while read rootfs rootopts; do
+ if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then
+ exit 1
+ fi
+ done
# If this is a final shutdown/halt, check for network FS,
# and unmount them even if the user didn't turn on netfs
More information about the devel
mailing list