Skip to contentSkip to conversation

mount --no-canonical seems broken.

DISCUSSION Linda Walsh 2 participants 8 messages Apr 22, 2013 – May 21, 2013 Util-Linux package

lore
Share & tools
lore
#0 lore raw

I would use mount --no-canonical to rewrite mtab to match fstab so

my utils could find volumes in /etc/fstab -- but recently in util-linux-2.21.2
this has no longer worked.

I made sure to have /etc/mtab NOT be a symlink to /proc/self/mounts so mount could write to it. It DOES write to it, but it doesn't display it.

Example:
After doing a remount as recommended by the manpage...

    mount -f --no-canonical -a -o remount

mount and df now produce different output.

Ishtar:home/../archive# echo $PWD
/home/.snapdir/@GMT-2013.04.16-05.07.03/archive

Ishtar:home/../archive# df .

Filesystem                         Size  Used Avail Use% Mounted on
/dev/HnS/Home-2013.04.16-05.07.03  1.0T  787G  238G  77%

/home/.snapdir/@GMT-2013.04.16-05.07.03

Ishtar:home/../archive# mount |grep /home/snapdir Ishtar:home/../archive# mount |grep 04.16 /dev/mapper/HnS-Home--2013.04.16--05.07.03 on /home/.snapdir/@GMT-2013.04.16-05.07.03 type xfs (ro,nouuid,norecovery)

I've tried up to version util-linux-2.23-rc2....

Ideas?

maintainer
#1 lore raw
Quoted 7 lines · Linda Walsh

I would use mount --no-canonical to rewrite mtab to match fstab so

my utils could find volumes in /etc/fstab -- but recently in util-linux-2.21.2
this has no longer worked.

Quoted 7 lines

I made sure to have /etc/mtab NOT be a symlink to /proc/self/mounts so mount could write to it. It DOES write to it, but it doesn't display it.

Example:
After doing a remount as recommended by the manpage...

    mount -f --no-canonical -a -o remount

Well, --no-canonicalize assume that all paths are already canonicalized and the remount updates mount options only.

What exactly do you want to do? Maybe we can try to find a better solution than play nasty games with mtab ;-)

Karel

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

I would use mount --no-canonical to rewrite mtab to match fstab so

my utils could find volumes in /etc/fstab -- but recently in util-linux-2.21.2
this has no longer worked.

I made sure to have /etc/mtab NOT be a symlink to /proc/self/mounts so mount could write to it. It DOES write to it, but it doesn't display it.

Quoted 9 lines
Quoted 5 lines

Example:
After doing a remount as recommended by the manpage...

    mount -f --no-canonical -a -o remount

Well, --no-canonicalize assume that all paths are already canonicalized and the remount updates mount options only.

---
Well my main concern has been how lvm volumes are renamed.

i.e. /dev/Vol-group/Log-vol ->
/dev/mapper/Vol--group-Log--vol

I have backup and file-system utils that use the values in fstab, and it looks for those values in the output of mount (and df).

Also, recently, (in the "mostest latest" ;-), mount in my distro (suse), the root dev has disappeared... I don't get /dev/sdc1 (my root partition) I get /dev/root -- and only if I follow the symlink in /dev, will I find /dev/sdc6.

But that's just the latest probl... the other stuff...

I've been using the mount --no-canonicalize to mount my lvm volumes -- and also going back and doing the "mount -f --nocanonicalize ..." to get the ones mounted at boot time.

Now... programs crashing, dogs and cats living togther... heinous!

??ideas?
Note -- I don't recall doing anything with mtab BEFORE -- BUT I may have made sure it was a separate file years ago when I started using lvm.

Recently it was changed back to a symlink and on top of that -- whether it is a file or a symlink, mount doesn't seem to show the "non-canon" name (i.e. /dev/Vol/Log...)
(though oddly enough -- "df" does!)...

Quoted 8 lines

What exactly do you want to do? Maybe we can try to find a better solution than play nasty games with mtab ;-)

Karel

#3 lore raw
Quoted 8 lines · Linda Walsh

Note -- I don't recall doing anything with mtab BEFORE -- BUT I may have made sure it was a separate file years ago when I started using lvm.

Recently it was changed back to a symlink and on top of that -- whether it is a file or a symlink, mount doesn't seem to show the "non-canon" name (i.e. /dev/Vol/Log...)
(though oddly enough -- "df" does!)..

--------------
Note, to give an example of what is broken if you DO link /etc/mtab -> /proc/self/mounts:
(from 'df''):

/dev/root                           12G  8.8G  3.3G  73% /
/dev/sdc6                           15G   10G  5.0G  67% /usr
/dev/sdc2                          7.8G  2.0G  5.9G  25% /var
/dev/sdc2                          7.8G  2.0G  5.9G  25% /tmp
/dev/sdc3                          908M  585M  323M  65% /boot
/dev/mapper/HnS-Share              1.5T  1.4T  153G  91% /Share
/dev/mapper/HnS-Home               1.0T  792G  233G  78% /home
/dev/mapper/HnS-Squid_Cache        128G   43G   86G  33% /var/cache/squid
/dev/mapper/Backups-Backups         11T  9.7T  1.3T  89% /backups
/dev/mapper/Media-Media            7.3T  6.4T  943G  88% /Media
/dev/HnS/Home-2013.03.29-21.00.11  1.5G  1.3G  208M  86%

/home/.snapdir/@GMT-2013.03.29-21.00.11 /dev/HnS/Home-2013.04.06-13.22.10 2.4G 2.1G 369M 85% /home/.snapdir/@GMT-2013.04.06-13.22.10 /dev/HnS/Home-2013.04.08-05.07.04 1.2G 1008M 155M 87% /home/.snapdir/@GMT-2013.04.08-05.07.04 /dev/HnS/Home-2013.04.10-05.07.03 1.2G 1.1G 160M 87% /home/.snapdir/@GMT-2013.04.10-05.07.03 /dev/HnS/Home-2013.04.12-05.07.03 1.2G 1010M 153M 87% /home/.snapdir/@GMT-2013.04.12-05.07.03 /dev/HnS/Home-2013.04.24-05.07.02 1.0T 792G 233G 78% /home/.snapdir/@GMT-2013.04.24-05.07.02 /dev/HnS/Home-2013.04.16-05.07.03 8.1G 6.8G 1.3G 85% /home/.snapdir/@GMT-2013.04.16-05.07.03

----
The only correct entries above are /dev/sdc? and the /dev/HnS/ lines, but the last lines are correct as they are mounted by a script that mounts the snapshot
and it uses no-canonicalize on mount.

The LVM volumes mounted at boot from /etc/fstab don't match the names in fstab.

The output from mount is worse -- it has the last entries wrong as well -- even though no-canonicalize was specified on mount (as df shows),
mount shows:
/dev/mapper/HnS-Home--2013.03.29--21.00.11 on /home/.snapdir/@GMT-2013.03.29-21.00.11 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.06--13.22.10 on /home/.snapdir/@GMT-2013.04.06-13.22.10 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.08--05.07.04 on /home/.snapdir/@GMT-2013.04.08-05.07.04 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.10--05.07.03 on /home/.snapdir/@GMT-2013.04.10-05.07.03 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.12--05.07.03 on /home/.snapdir/@GMT-2013.04.12-05.07.03 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.24--05.07.02 on /home/.snapdir/@GMT-2013.04.24-05.07.02 type xfs (ro,relatime,nouuid,norecovery,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota) /dev/mapper/HnS-Home--2013.04.16--05.07.03 on /home/.snapdir/@GMT-2013.04.16-05.07.03 type xfs (rw,relatime,attr2,inode64,logbsize=64k,sunit=128,swidth=1536,noquota)

If I use separate /etc/fstab && mtab, then running "mount -f -no-canonicalize -a" will fix
all of the paths to match what is in /etc/fstab -- FOR 'df'' -- but not for mount...
mount stays broken either way.

maintainer
#4 lore raw
In reply to Linda Walsh
Quoted 4 lines · Linda Walsh

Well my main concern has been how lvm volumes are renamed.

i.e. /dev/Vol-group/Log-vol ->
/dev/mapper/Vol--group-Log--vol

The /dev/mapper/<name> is the canonical name, this is only user-friendly name that is possible to generate by utils in userspace, because the <name> is exported by /sys/block/dm-<n>/dm/name to userspace.

Things like /dev/Vol-group/Log-vol are LVM specific and there is no way how to convert /dev/dm-<n> to this format. This is reason why mount(8) canonicalizes the names to /dev/mapper/<name>.

Quoted 2 lines

I have backup and file-system utils that use the values in fstab, and it looks for those values in the output of mount (and df).

The ideal solution is to use utils which are able to convert symlinks/tags/whatever to canonical device names. It's mistake to assume that fstab matches with /proc/mounts.

Use

    $ findmnt --fstab --canonicalize --evaluate

to get canonical paths and evaluated tags.

Quoted 8 lines

I've been using the mount --no-canonicalize to mount my lvm volumes -- and also going back and doing the "mount -f --nocanonicalize ..." to get the ones mounted at boot time.

Recently it was changed back to a symlink and on top of that -- whether it is a file or a symlink, mount doesn't seem to show the "non-canon" name (i.e. /dev/Vol/Log...)
(though oddly enough -- "df" does!)...

The problem is that "mount" (without options) prints always canonicalized paths (and in this case --no-canonicalize has no effect, this option is used for mounting only). It means if you have non-canonical paths in /etc/mtab then "mount" still prints canonical paths. I can fix it and make the output sensitive to --no-canonicalize option too.

Anyway, use findmnt, it provides but complete control on the output.

Karel

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

The problem is that "mount" (without options) prints always canonicalized paths (and in this case --no-canonicalize has no effect, this option is used for mounting only). It means if you have non-canonical paths in /etc/mtab then "mount" still prints canonical paths. I can fix it and make the output sensitive to --no-canonicalize option too.

Anyway, use findmnt, it provides but complete control on the output.

Karel

----
Sure give better control, but not as widely known as "df" or "mount".

I might point out that by default,

Quoted 1 line

findmnt /

TARGET SOURCE FSTYPE OPTIONS
/ /dev/root xfs rw,nodiratime,relatime,attr2,inode64,noquota

Quoted 1 line
Quoted 1 line

l /dev/root

ls: cannot access /dev/root: No such file or directory

-----
It's not a device in /dev/ nor is it in /proc/devices.

Conversely,

klogd 1.4.1, log source = ksyslog started.

[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.9.0-Isht-Van (law@Ishtar) (gcc version
4.7.2 20130205 [gcc-4_7-branch revision 195759] (SUSE Linux) ) #6 SMP
PREEMPT Wed May 8 17:28:40 PDT 2013
[    0.000000] Command line: BOOT_IMAGE=390-Isht-Van rw root=/dev/sdc1

root=/dev/sdc1 showopts console=ttyS0,115200n8 console=tty0 elevator=cfq pcie_aspm=force pcie_ports=native reboot=bios

The kernel seems to know the root image at boot (even told twice from this output!)

Not to mention, there is some comment in the kernel-related code of using /dev/root because there is no writable storage available... even though the command line
shows that root is mounted 'rw'...

maintainer
#6 lore raw
Quoted 9 lines · Linda Walsh

widely known as "df" or "mount".

I might point out that by default,

Quoted 1 line

findmnt /

TARGET SOURCE FSTYPE OPTIONS
/ /dev/root xfs rw,nodiratime,relatime,attr2,inode64,noquota

Quoted 1 line
Quoted 1 line

l /dev/root

ls: cannot access /dev/root: No such file or directory

util-linux 2.23 ?

libmount since this version is able to use the root= kernel command line option to convert /dev/root from the /proc/self/mountinfo file to a real device name.

Karel

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

widely known as "df" or "mount".

I might point out that by default,

Quoted 2 lines

findmnt /

TARGET SOURCE FSTYPE OPTIONS
/ /dev/root xfs rw,nodiratime,relatime,attr2,inode64,noquota

Quoted 2 lines
Quoted 2 lines

l /dev/root

Quoted 9 lines
Quoted 2 lines

ls: cannot access /dev/root: No such file or directory

util-linux 2.23 ?

libmount since this version is able to use the root= kernel command line option to convert /dev/root from the /proc/self/mountinfo file to a real device name.

----
I'm only at 2.19, will get & try newer version. Thanks!