Skip to contentSkip to conversation

Specifying a generic and per-fs mount line in /etc/fstab as well as no-canonicalize.

DISCUSSION Linda A. Walsh 3 participants 6 messages Aug 6, 2014 – Aug 8, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Karel Zak

Well, I'm trying to help you, so it would be nice to have more information about your use-case...

I think I explained that it was the default to follow user-specified symbolic link names in following and echoing a path -- notable in shells like bash.

if "/usr/src" is a symlink pointing to /home/src,

and under /home/src, packages points to ../packages, then when I switch to /usr/src/packages, I see my path listed as /usr/src/packages:

Quoted 1 line

cd /usr/src/packages

/usr/src/packages> pwd
/usr/src/packages

Only by asking an external util can I find the real name:

Quoted 1 line

/bin/pwd

/home/packages

It's a display choice for *user-convenience* that was made over years of feedback.

Why not allow the same paradigm in /etc/fstab and allow nocanonicalize as an option with mounts in /etc/fstab?

#1 lore raw
Quoted 10 lines · Linda A. Walsh

if "/usr/src" is a symlink pointing to /home/src,

and under /home/src, packages points to ../packages, then when I switch to /usr/src/packages, I see my path listed as /usr/src/packages:

Quoted 1 line
Quoted 1 line

cd /usr/src/packages

/usr/src/packages> pwd
/usr/src/packages

Only by asking an external util can I find the real name:

OT, but: no, "pwd -P" (pwd, the shell built-in) does.

Have a nice day,
Berny

#2 lore raw
Quoted 7 lines · Bernhard Voelker
Quoted 5 lines · Linda A. Walsh

if "/usr/src" is a symlink pointing to /home/src,
and under /home/src, packages points to ../packages, then when I switch to /usr/src/packages, I see my path listed as /usr/src/packages:

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

cd /usr/src/packages

/usr/src/packages> pwd
/usr/src/packages

Only by asking an external util can I find the real name:

OT, but: no, "pwd -P" (pwd, the shell built-in) does.

Yeah... by asking the builtin for the physical path, I could see mount -p showing you the physical path. But wouldn't
that be "/dev/dm-x"? Where is it coming up with /dev/mapper/<mangledname>?

It's not the link the user gave, and it's not the real device, seems like those are "dm" internal names?

maybe mount -d? for those?

or put all of them under 1 mountop -D{d|p|s}?

maintainer
#3 lore raw
Quoted 7 lines · Linda Walsh
Quoted 6 lines · Bernhard Voelker
Quoted 5 lines · Linda A. Walsh

if "/usr/src" is a symlink pointing to /home/src,
and under /home/src, packages points to ../packages, then when I switch to /usr/src/packages, I see my path listed as /usr/src/packages:

Quoted 1 line
Quoted 1 line

cd /usr/src/packages

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

/usr/src/packages> pwd
/usr/src/packages

Only by asking an external util can I find the real name:

OT, but: no, "pwd -P" (pwd, the shell built-in) does.

Yeah... by asking the builtin for the physical path, I could see mount -p showing you the physical path. But wouldn't that be "/dev/dm-x"?

/dev/dm-N is *private* DM path and should be nowhere used in userspace. This is requirement from DM guys.

Quoted 1 line

Where is it coming up with /dev/mapper/<mangledname>?

/sys/block/dm-N/dm/name

Quoted 2 lines

It's not the link the user gave, and it's not the real device, seems like those are "dm" internal names?

it's official device name

Quoted 1 line

maybe mount -d? for those?

I don't plan to do anything with mount(8) output. If you want more customized output then use findmnt(8), for long time I think about a new column KNAME (kernel device name of the mount source). We already have such column in lsblk(8), maybe it would be nice for findmnt(8) too.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
maintainer
#4 lore raw
In reply to Linda A. Walsh
Quoted 5 lines · Linda A. Walsh

It's a display choice for *user-convenience* that was made over years of feedback.

Why not allow the same paradigm in /etc/fstab and allow nocanonicalize as an option with mounts in /etc/fstab?

You can use symlinks in fstab, but mount(8) canonicalizes the path before mount(2) syscall, because:

* kernel canonicalizes the path as well and we (userspace) want to be compatible with kernel to make it possible to compare paths in mtab (or another in userspace cached files) with /proc/mounts

* you can think about mount table as about cache, how do you want keep the mount table up to date if you remove or change the link?

mount /dev/foo /symlink
rm /symlink

note that "rmdir /mountpoint" (or rename) is very special situation for kernel (-EBUSY)

* it's also performance improvement to have canonical paths in the mount table when you want search in the table

* etc..

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw
Quoted 7 lines · Karel Zak
Quoted 5 lines · Linda A. Walsh

It's a display choice for *user-convenience* that was made over years of feedback.

Why not allow the same paradigm in /etc/fstab and allow nocanonicalize as an option with mounts in /etc/fstab?

Quoted 6 lines

You can use symlinks in fstab, but mount(8) canonicalizes the path before mount(2) syscall, because:

* kernel canonicalizes the path as well and we (userspace) want to be compatible with kernel to make it possible to compare paths in mtab (or another in userspace cached files) with /proc/mounts

----
Shells translate symlinks into physical paths before they talk to the
kernel. There is no difference on this point. The symlink management is all done at the user level and is the "friendly" interface given to users.

Quoted 6 lines

* you can think about mount table as about cache, how do you want keep the mount table up to date if you remove or change the link?

mount /dev/foo /symlink
rm /symlink

I'm not suggesting any changes to how mounts deal with file
system symlinks. I'm using file symlinks and the shells presenting the logical interface to the user while presenting the physical interface to the kernel as an example in good user-engineering that's been developed over years.

Similarly, letting the user call a device by the official lvm name, that may be a symlink to some canonical name is a similar mechanism that is **already supported** by the current mount. It's just that you require the mounts to be entered manually.

I simply asked for a way to specify "non-canonical" in fstab as one can on the mount line.

Quoted 2 lines

* it's also performance improvement to have canonical paths in the mount table when you want search in the table

Computer time is cheap compared to human time. Keeping things more
sane for humans make more sense in terms of time and money than computers who can handle names in GUID form among other human-difficult forms.

Quoted 2 lines

I don't plan to do anything with mount(8) output.

I didn't ask you to do anything with the mount output.

I asked to support the same switch "non-canonical" that is already
implemented on the command line as mount-op. The code is already
in there to do everything I am asking for. I'm just asking for the same option in fstab as on the command line.

Quoted 2 lines

If you want more
customized output then use findmnt(8)

---
Not what I wanted. I just want mount to show what is in fstab. It used to do that -- that was the standard -- I'm trying to make it easy to keep things the same, and only add access to the command-line switch in the mntops. The code to handle the name display -- one way or the other is already there.