[Pkg-sysvinit-devel] Bug#653073: Switching /etc/mtab to /proc/mounts and removing /lib/init/rw

Michael Tokarev mjt at tls.msk.ru
Fri Jan 20 09:19:00 UTC 2012


On 20.01.2012 11:55, Goswin von Brederlow wrote:
[]
>>> And yes it is kinda trivial to add a call to realpath(3) to
>>> busybox (or equivalent).
>>
>> Or add readlink into initramfs-tools, for that matter.
>>
>> But it is still not clear if it is a bug or not :)
> 
> As a side note: With LVM you get entries like:
> 
> /dev/mapper/r-usr       7224824     6392404     465460  94% /usr
> 
> I would much rather have:
> 
> /dev/r/usr       7224824     6392404     465460  94% /usr

> But I guess the solution for this would be to have udev make /dev/r/usr
> the real device and /dev/mapper/r-usr a symlink.

Exactly.  And note that actually, these are dm devices, which
usually appear as /dev/dm-N (cf. multipath devices created by
multipathd - they symlink from /dev/mapper/name to /dev/dm-N).

And this is an interesting place.

The "problem" is that kernel does not know what /dev/mapper
is, or what does /dev/r/usr thing mean.  It knows these by
their canonical (and meaningless) dm-N names, like this:

[    6.887981] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Opts: (null)
[    6.917555] EXT4-fs (dm-1): mounted filesystem with ordered data mode. Opts: usrquota

Go figure which is dm-0 and which is dm-1 (lvm is here)!

There are references to these dm-N names in /proc/partitions
and in /sys and elsewhere, too.

I consider this a bug, a quite serious one at it: there's
no device node which corresponds to kernel names!  So it is
impossible to get, eg, device usage statistics for a
particular volume, or map i/o error to particular dvice and
so on.  This is wrong.

But this is a different problem entirely.

My point is that actually, _both_ /dev/mapper/r-usr and
/dev/r/usr are wrong!  But at least they - hopefully -
lead to the actual device, unlike kernel messages I
mentioned above which leads to nothing due to /dev/dm-0
non-existing.

> What result does "LABEL=..." get?

It is exactly the same as with UUID=.  For both of these,
util-linux mount will canonicalize the name to final
device (like /dev/sda1 or /dev/dm-0 or /dev/mapper/r-usr
as in your case), be it LABEL= or /dev/disk/by-label/LABEL.
While neither busybox nor klibc will do that.  Besides,
klibc does not support LABEL or UUID, in busybox it is
optional (compile-time), and it will do its own resolution
of LABEL/UUID, without using /dev/disk/by-*/.

In initramfs, both are handled the same way
(omiting some details for brevity):

initramfs:init:
                case $ROOT in
                LABEL=*)
                        ROOT="${ROOT#LABEL=}"
                        ROOT="/dev/disk/by-label/${ROOT}"
                        ;;
                UUID=*)
                        ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
                        ;;

So this gives /dev/disk/... arg to mount, be it from
busybox or klibc, and neither calls realpath(3).

Thanks,

/mjt





More information about the Pkg-sysvinit-devel mailing list