Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Linux is obsolete (Andrew Tanenbaum)


devel / comp.unix.programmer / Re: NFS

SubjectAuthor
* Question on umount: Why is "-l" the magic bullet?Kenny McCormack
+* Question on umount: Why is "-l" the magic bullet?Scott Lurndal
|`* NFSIvan Shmakov
| `* NFSScott Lurndal
|  `- NFSIvan Shmakov
`* Question on umount: Why is "-l" the magic bullet?Lew Pitcher
 `- Question on umount: Why is "-l" the magic bullet?Ivan Shmakov

1
Question on umount: Why is "-l" the magic bullet?

<u488v0$3rtcp$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10773&group=comp.unix.programmer#10773

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer
Subject: Question on umount: Why is "-l" the magic bullet?
Date: Fri, 19 May 2023 16:43:12 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <u488v0$3rtcp$1@news.xmission.com>
Injection-Date: Fri, 19 May 2023 16:43:12 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="4060569"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Fri, 19 May 2023 16:43 UTC

One thing I've noticed through the years is that if a "umount" command is
failing (some error message, e.g., "target is busy" or whatever), you can
often get around this (*) by adding "-l" to the command line. "-l" is
documented as "lazy" (yes, I'm familiar with what the man page says about
it), but it seems, in practice to be more of a "do it anyway" - a
functionality that is usually coded as "-f" (meaning "force") or similar.

Note that umount *does* have a "-f" option, but in my experience that never
seems to work; "-f" is documented as having something to do with NFS and I
don't use NFS.

Here's a recent example of this in action (Note that I am describing this
in detail, but the details don't really matter; I'm not looking for tech
support on the problem, but rather an answer to the question in the Subject
line). This example is only one of many similar things I've noticed over
the years.

--- Example ---
I have one Linux machine ("Machine #1") that has an external hard disk
attached as /dev/sda1. I have /dev/sda1 mounted as /mnt/something and have
/mnt/something Samba shared on my LAN. Other Linux machines on the LAN
Samba mount this drive (e.g., "Machine #2"). Now, while trying to fix some
other problem, I decided to umount and re-mount the drive (on Machine #1).

Then I go over to Machine #2 and try to access the Samba-mounted drive and
get some weird error message. I note that this is probably because of it
having been umounted and re-mounted (on Machine #1), so I probably need
to unmount and remount the Samba connection. But whenever I try to access
/mnt/SambaDrive, I get some weird error message (Something like
"/mnt/SambaDrive is not a directory"). When I look at it with "ls -lsa",
the "mode" string in the "ls" output displays as something like
"d?????????". If I try to umount it (as root or as a user), it says "Not a
directory". But, and here's the key: If I umount with -l (as root), it
umounts as expected. I then re-mount it (as a user) and everything is fine.
--- End of Example ---

So, my question is: Why does "-l" make it magically work? And thus why
isn't it the default?

(*) Assuming, of course, that it isn't really busy. Often I get the
"target is busy" err msg in error. Such is life.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/ModernXtian

Re: Question on umount: Why is "-l" the magic bullet?

<T6O9M.808064$PXw7.280497@fx45.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10774&group=comp.unix.programmer#10774

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx45.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Question on umount: Why is "-l" the magic bullet?
Newsgroups: comp.unix.programmer
References: <u488v0$3rtcp$1@news.xmission.com>
Lines: 36
Message-ID: <T6O9M.808064$PXw7.280497@fx45.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 19 May 2023 17:13:23 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 19 May 2023 17:13:23 GMT
X-Received-Bytes: 2570
 by: Scott Lurndal - Fri, 19 May 2023 17:13 UTC

gazelle@shell.xmission.com (Kenny McCormack) writes:
>One thing I've noticed through the years is that if a "umount" command is
>failing (some error message, e.g., "target is busy" or whatever), you can
>often get around this (*) by adding "-l" to the command line. "-l" is
>documented as "lazy" (yes, I'm familiar with what the man page says about
>it), but it seems, in practice to be more of a "do it anyway" - a
>functionality that is usually coded as "-f" (meaning "force") or similar.
>
>Note that umount *does* have a "-f" option, but in my experience that never
>seems to work; "-f" is documented as having something to do with NFS and I
>don't use NFS.
>
>Here's a recent example of this in action (Note that I am describing this
>in detail, but the details don't really matter; I'm not looking for tech
>support on the problem, but rather an answer to the question in the Subject
>line). This example is only one of many similar things I've noticed over
>the years.
>
>--- Example ---
>I have one Linux machine ("Machine #1") that has an external hard disk
>attached as /dev/sda1. I have /dev/sda1 mounted as /mnt/something and have
>/mnt/something Samba shared on my LAN. Other Linux machines on the LAN
>Samba mount this drive (e.g., "Machine #2"). Now, while trying to fix some
>other problem, I decided to umount and re-mount the drive (on Machine #1).

Why on earth would you use Samba for linux-to-linux file sharing?

Just export the NFS filesystem to the other linux machines directly
or via autofs (preferred, but generally requires NIS/YP as well).

In general, the behaviour of either NFS or CIFS when remounting
an underlying physical drive is somewhat unspecified and should
generally be avoided. It is possible that using the -o remount
option to mount rather than using umount/mount may ameleiorate
your client issues.

Re: Question on umount: Why is "-l" the magic bullet?

<u48b3i$nosi$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10775&group=comp.unix.programmer#10775

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.programmer
Subject: Re: Question on umount: Why is "-l" the magic bullet?
Date: Fri, 19 May 2023 17:19:46 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 54
Message-ID: <u48b3i$nosi$1@dont-email.me>
References: <u488v0$3rtcp$1@news.xmission.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 19 May 2023 17:19:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="f70cb39e92a630c4cfdd8d2b2791b098";
logging-data="779154"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HTX/mzE1/jSD6N8dHtXRmdgaWo5RPtG4="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:B8lz/P0vb2pivlmls+hR+MUk6bo=
 by: Lew Pitcher - Fri, 19 May 2023 17:19 UTC

On Fri, 19 May 2023 16:43:12 +0000, Kenny McCormack wrote:

> One thing I've noticed through the years is that if a "umount" command is
> failing (some error message, e.g., "target is busy" or whatever), you can
> often get around this (*) by adding "-l" to the command line. "-l" is
> documented as "lazy" (yes, I'm familiar with what the man page says about
> it), but it seems, in practice to be more of a "do it anyway" - a
> functionality that is usually coded as "-f" (meaning "force") or similar.
[snip]
> So, my question is: Why does "-l" make it magically work? And thus why
> isn't it the default?

Forgive the redundancy, but let's first review what the manpage says about
the umount -l option:

-l, --lazy
Lazy unmount. Detach the filesystem from the file hierarchy
now, and clean up all references to this filesystem as soon as
it is not busy anymore

Now, consider this scenario: You have a physically detachable hard drive
(say a USB drive), mounted, and processes with files open in the mount
space of this drive.

You issue the umount command
umount /where-ever
and, because there are open files on that mount's mountspace, umount tells
you that the target is busy. So, you issue the
umount -l /where-ever
and the hard drive is lazy unmounted. External commands show that the
hard drive no longer hosts the mountspace.

And, now you physically disconnect the hard drive (as you might do with
an unmounted USB drive). What happens to all the files that processes had
open on the drive? They certainly did not get whatever close()/sync()
housekeeping that a proper close and umount would provide.

Without "lazy umount", umount won't unmount the media unless all activity
on that media has cleanly terminated (no files open, no processes using
the media as cwd).

With "lazy umount", umount performs /some/ of the umount activity immediatly;
removal from the mountpoint means no new file or chdir activity can occur
on the media. But, "lazy umount" leaves some umount activity (directory
updates, buffer flush, etc) to later, as processes terminate. Until those
activities complete, it is unsafe to physically disconnect the media, even
though it has been "unmounted".

[snip]

HTH
--
Lew Pitcher
"In Skills We Trust"

Re: Question on umount: Why is "-l" the magic bullet?

<u48ck6$o54f$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10776&group=comp.unix.programmer#10776

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: iva...@siamics.netNOSPAM.invalid (Ivan Shmakov)
Newsgroups: comp.unix.programmer
Subject: Re: Question on umount: Why is "-l" the magic bullet?
Date: Fri, 19 May 2023 17:45:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <u48ck6$o54f$1@dont-email.me>
References: <u488v0$3rtcp$1@news.xmission.com> <u48b3i$nosi$1@dont-email.me>
Injection-Date: Fri, 19 May 2023 17:45:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6448ed01eecce87e2af15cf3313ef1c2";
logging-data="791695"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fBG61bx6/YVmazkyT+Jp8"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:cAsoFMq3gMIQKxPFOn+HynSAdeU=
License: CC0-1.0 (original contributions only)
 by: Ivan Shmakov - Fri, 19 May 2023 17:45 UTC

>>>>> On 2023-05-19, Lew Pitcher wrote:

(Not sure I quite understand how the question is related to
Unix /programming./)

> Without "lazy umount", umount won't unmount the media unless all
> activity on that media has cleanly terminated (no files open, no
> processes using the media as cwd).

> With "lazy umount", umount performs /some/ of the umount activity
> immediatly; removal from the mountpoint means no new file or
> chdir activity can occur on the media. But, "lazy umount" leaves
> some umount activity (directory updates, buffer flush, etc) to
> later, as processes terminate. Until those activities complete,
> it is unsafe to physically disconnect the media, even though it
> has been "unmounted".

+1. Can only add that you won't be able to remount it back,
either (until all the files there are closed and such), as
so far the kernel is concerned, the filesystem's still mounted.

--
FSF associate member #7257 http://am-1.org/~ivan/

NFS

<u48e35$oacv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10777&group=comp.unix.programmer#10777

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: iva...@siamics.netNOSPAM.invalid (Ivan Shmakov)
Newsgroups: comp.unix.programmer
Subject: NFS
Date: Fri, 19 May 2023 18:10:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <u48e35$oacv$1@dont-email.me>
References: <u488v0$3rtcp$1@news.xmission.com>
<T6O9M.808064$PXw7.280497@fx45.iad>
Injection-Date: Fri, 19 May 2023 18:10:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6448ed01eecce87e2af15cf3313ef1c2";
logging-data="797087"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sbK3wp7xb25V71ZzLTB5z"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:xVj9UJXJgx1pvWdFKr+DvKgalyk=
License: CC0-1.0 (original contributions only)
 by: Ivan Shmakov - Fri, 19 May 2023 18:10 UTC

>>>>> On 2023-05-19, Scott Lurndal wrote:

> Just export the NFS filesystem to the other linux machines directly
> or via autofs (preferred, but generally requires NIS/YP as well).

I've used LDAP for the maps last time I've used Autofs, but
given that NFSv4 apparently doesn't require submounts to be
mounted explicitly at the client(s) (though each still needs
to be exported at the server), I'm not sure it's all that
necessary anymore.

Without Autofs, it's along the lines of:

mysrv.example.com:/srv/nfsv4 /com/nfsv4/mysrv.example.com nfs4 nosuid,nodev
other.example.com:/srv/nfsv4 /com/nfsv4/other.example.com nfs4 nosuid,nodev

> In general, the behaviour of either NFS or CIFS when remounting
> an underlying physical drive is somewhat unspecified and should
> generally be avoided. It is possible that using the -o remount
> option to mount rather than using umount/mount may ameleiorate
> your client issues.

One problem I could think of is that (AIUI) NFSv3 uses
filesystem ids (i. e., struct statfs f_fsid field values),
and those aren't necessarily preserved when the filesystems
get unmounted and mounted back.

OTOH, NFSv4 uses filesystem "UUIDs," where available, so
unless you do something funny, unmounting a given ("idle")
filesystem and mounting it back tends to "just work" IME.

--
FSF associate member #7257 http://am-1.org/~ivan/

Re: NFS

<v9P9M.2073471$Tcw8.660720@fx10.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10778&group=comp.unix.programmer#10778

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx10.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: NFS
Newsgroups: comp.unix.programmer
References: <u488v0$3rtcp$1@news.xmission.com> <T6O9M.808064$PXw7.280497@fx45.iad> <u48e35$oacv$1@dont-email.me>
Lines: 40
Message-ID: <v9P9M.2073471$Tcw8.660720@fx10.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 19 May 2023 18:24:27 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 19 May 2023 18:24:27 GMT
X-Received-Bytes: 2382
 by: Scott Lurndal - Fri, 19 May 2023 18:24 UTC

Ivan Shmakov <ivan@siamics.netNOSPAM.invalid> writes:
>>>>>> On 2023-05-19, Scott Lurndal wrote:
>
> > Just export the NFS filesystem to the other linux machines directly
> > or via autofs (preferred, but generally requires NIS/YP as well).
>
> I've used LDAP for the maps last time I've used Autofs, but
> given that NFSv4 apparently doesn't require submounts to be
> mounted explicitly at the client(s) (though each still needs
> to be exported at the server), I'm not sure it's all that
> necessary anymore.
>
> Without Autofs, it's along the lines of:
>
>mysrv.example.com:/srv/nfsv4 /com/nfsv4/mysrv.example.com nfs4 nosuid,nodev
>other.example.com:/srv/nfsv4 /com/nfsv4/other.example.com nfs4 nosuid,nodev

Along with updating /etc/exports on the server and running the exportfs(1)
command.

>
> > In general, the behaviour of either NFS or CIFS when remounting
> > an underlying physical drive is somewhat unspecified and should
> > generally be avoided. It is possible that using the -o remount
> > option to mount rather than using umount/mount may ameleiorate
> > your client issues.
>
> One problem I could think of is that (AIUI) NFSv3 uses
> filesystem ids (i. e., struct statfs f_fsid field values),
> and those aren't necessarily preserved when the filesystems
> get unmounted and mounted back.
>
> OTOH, NFSv4 uses filesystem "UUIDs," where available, so
> unless you do something funny, unmounting a given ("idle")
> filesystem and mounting it back tends to "just work" IME.

Yes. It can't always be counted on, however. I tend to
comment out the filesystem in /etc/exports and re-run exportfs
to ensure that no clients are using it when remounting (which,
granted is extremely rare in these modern times).

Re: NFS

<u48hiq$oo4b$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=10779&group=comp.unix.programmer#10779

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: iva...@siamics.netNOSPAM.invalid (Ivan Shmakov)
Newsgroups: comp.unix.programmer
Subject: Re: NFS
Date: Fri, 19 May 2023 19:10:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <u48hiq$oo4b$1@dont-email.me>
References: <u488v0$3rtcp$1@news.xmission.com>
<T6O9M.808064$PXw7.280497@fx45.iad> <u48e35$oacv$1@dont-email.me>
<v9P9M.2073471$Tcw8.660720@fx10.iad>
Injection-Date: Fri, 19 May 2023 19:10:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6448ed01eecce87e2af15cf3313ef1c2";
logging-data="811147"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19A4gkdBIC3vr/2DaTDKV41"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:WzD9DbieVinnCErgr4UFwX85aZE=
License: CC0-1.0 (original contributions only)
 by: Ivan Shmakov - Fri, 19 May 2023 19:10 UTC

>>>>> On 2023-05-19, Scott Lurndal wrote:
>>>>> Ivan Shmakov <ivan@siamics.netNOSPAM.invalid> writes:

>> I've used LDAP for the maps last time I've used Autofs, but given
>> that NFSv4 apparently doesn't require submounts to be mounted
>> explicitly at the client(s) (though each still needs to be exported
>> at the server), I'm not sure it's all that necessary anymore.

>> Without Autofs, it's along the lines of:

>> mysrv.example.com:/srv/nfsv4 /com/nfsv4/mysrv.example.com nfs4 nosuid,nodev
>> other.example.com:/srv/nfsv4 /com/nfsv4/other.example.com nfs4 nosuid,nodev

(In the client's fstab(5), that is.)

> Along with updating /etc/exports on the server and running the
> exportfs(1) command.

Yep; exportfs(8) rather, though.

>> One problem I could think of is that (AIUI) NFSv3 uses
>> filesystem ids (i. e., struct statfs f_fsid field values),
>> and those aren't necessarily preserved when the filesystems
>> get unmounted and mounted back.

>> OTOH, NFSv4 uses filesystem "UUIDs," where available, so
>> unless you do something funny, unmounting a given ("idle")
>> filesystem and mounting it back tends to "just work" IME.

> Yes. It can't always be counted on, however.

I don't seem to be aware of any potential issues with doing so,
provided that UUIDs are properly maintained and such.

> I tend to comment out the filesystem in /etc/exports and re-run
> exportfs to ensure that no clients are using it when remounting
> (which, granted is extremely rare in these modern times).

Well, alright, Linux doesn't seem to allow me to unmount an
exported filesystem in the first place. For that matter, it
doesn't seem to allow me to unexport a filesystem currently
"used" by a client, either. So the OP scenario isn't something
I've had to deal with myself, at least in recent years.

Still, when I've had, say, /srv/nfsv4/foo mounted and exported,
and I've had /srv/nfsv4 mounted at the client, but foo not
actually used there at the moment, I've had no issue with
unexporting and unmounting the former at the server, then
mounting and exporting the same filesystem back: the client just
picks the "new" mount up transparently when it's accessed.

--
FSF associate member #7257 np. Frog Dreaming by Nodal

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor