Skip to contentSkip to conversation

Inconsistent naming...?

linux-lvm Linda A. Walsh 5 participants 13 messages Jul 11, 2011 – Jul 19, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

I created a snapshot volume "with the name corresponding the volume name-date-time:

ll /dev/Home+Space/
total 0
lrwxrwxrwx 1 8 Jul 10 18:16 Home-2011.07.07-00.00.00 -> ../dm-12 lrwxrwxrwx 1 7 Jul 10 18:16 Home-2011.07.10-09.42.07 -> ../dm-5

Ok and they look that way in 'lvs', but when I mount them, 'df'' (or mount) shows:

/dev/mapper/Home+Space-Home--2011.07.07--00.00.00

^^ ^^

                     897M  160K  897M   1% 
/home/snapdir/@GMT-2011.07.07-00.00.00
/dev/mapper/Home+Space-Home--2011.07.10--09.42.07
                     1.0T  468G  557G  46% 

/home/snapdir/@GMT-2011.07.10-09.42.07

Notice the device name. notice how the single dashes are now displayed
as two dashes?!?!

What up with that? Seems like a bug somewhere... -- though it doesn't
**seem** to affect how it work....but it is disturbing...I thought my volume names had mutated somehow...

#1 lore raw

The canonical name to use is /dev/<vgname>/<lvname>.
That's been inherited from the original LVM1 code and has never changed. That's the only form of the name to use to maintain compatibility.

Other forms - dm-N and /dev/mapper/X-Y are internal and the format of those is not guaranteed: indeed there'll probably be some further changes soon to workaround some other completely arbitrary udev restrictions we don't cope with yet.

Different versions of df and mount haven't always retained this preferred form for their output.

Alasdair

#2 lore raw
Quoted 4 lines · Alasdair G Kergon

The canonical name to use is /dev/<vgname>/<lvname>.
That's been inherited from the original LVM1 code and has never changed. That's the only form of the name to use to maintain compatibility.

---
Those are the format's i've used (and am using), ... just that the
output from
mount (or in /proc/mount) messed up...

#3 lore raw
In reply to Alasdair G Kergon
Quoted 11 lines · Alasdair G Kergon

The canonical name to use is /dev/<vgname>/<lvname>.
That's been inherited from the original LVM1 code and has never changed. That's the only form of the name to use to maintain compatibility.

Other forms - dm-N and /dev/mapper/X-Y are internal and the format of those is not guaranteed: indeed there'll probably be some further changes soon to workaround some other completely arbitrary udev restrictions we don't cope with yet.

Different versions of df and mount haven't always retained this preferred form for their output.

note that on a freshly installed rhel 6.1 i have this in fstab

/dev/mapper/vg_candela--lv_root / ext4 ....

L.

Signature · 1 line
Luca Berra -- [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [linux-lvm] mount's (&udev's) dirty little naming problem -- (was Inconsistent naming...?)

Quoted 15 lines · Linda A. Walsh

(sorry for the length of this, in advance, but I've tried to give
this some though...(maybe not enough/maybe too much!) ;-) )

Quoted 6 lines · Luca Berra
Quoted 5 lines · Alasdair G Kergon

The canonical name to use is /dev/<vgname>/<lvname>. ...

[~Other forms - dm-N and /dev/mapper/X-Y are internal and ... there'll probably be some further changes to workaround other arbitrary

udev restrictions...~]

Quoted 4 lines
Quoted 4 lines

Different versions of df and mount haven't always retained this preferred form for their output.

Quoted 7 lines
Quoted 3 lines

note that on a freshly installed rhel 6.1 i have this in fstab

/dev/mapper/vg_candela--lv_root / ext4 ....

---

Why are there two dashes between the VG&LG?

woops, typo, sorry for that
it is :
/dev/mapper/vg_candela-lv_root / ext4 defaults 1 1

L.

Signature · 1 line
Luca Berra -- [email protected]
#6 lore raw
In reply to Linda A. Walsh
Quoted 2 lines · Linda A. Walsh

Notice the device name. notice how the single dashes are now displayed
as two dashes?!?!

Roughly: a dash is the separator we chose, and we double it to escape a real dash. But we still need to extend our escaping mechanism to handle characters that udev states it doesn't support in primary device names but which the old /dev did used to support (and so we still do).

Alasdair

#7 lore raw
Quoted 11 lines · Alasdair G Kergon
Quoted 3 lines · Linda A. Walsh

Notice the device name. notice how the single dashes are now displayed
as two dashes?!?!

Roughly: a dash is the separator we chose, and we double it to escape a real dash. But we still need to extend our escaping mechanism to handle characters that udev states it doesn't support in primary device names but which the old /dev did used to support (and so we still do).

----
Roughly, if I give a script the mount point of a logical device, how
can I find
out the name of the LV it is on?

Before I stumbled upon this quote-hack, I could look the mount point in
/proc/mounts and get the dev name.

But since the devname in /proc/mounts is corrupt -- that's not possible.

So what is the recommended way to do something that should be very
simple,
but is not because of a specialized 'quoting' scheme (sigh)...just tired...I should be in bed, but was trying to do a snap and fix the scripts...but ug...

Maybe tomorrow...I'll think of someting else, or you have something
to recommend,
since it sounds like you want to change the mangling even more so the device name won't match what what is in /proc/mounts...

(How can that not be a bug? Does proc/mounts double quote every '-'? with another?_

Thanks...
linda

#8 lore raw
Quoted 6 lines · Linda A. Walsh

Roughly, if I give a script the mount point of a logical device, how can I
find
out the name of the LV it is on?

Before I stumbled upon this quote-hack, I could look the mount point in
/proc/mounts and get the dev name.

I apologize for not being more helpful and actually posting such a script (would be happy to do so when I find the link to the quoting spec), but I would write a python script (or even a C program in the unlikely event it becomes a bottleneck) to quote/unquote lv names. Use that
in your shell scripts to get the dev name.

--

	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154

"Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial.

#9 lore raw
Quoted 5 lines · Stuart D. Gathman

I apologize for not being more helpful and actually posting such a script (would be happy to do so when I find the link to the quoting spec), but I would write a python script (or even a C program in the unlikely event it becomes a bottleneck) to quote/unquote lv names. Use that
in your shell scripts to get the dev name.

Oh - you've just reminded me:
dmsetup splitname

Alasdair

#10 lore raw
Quoted 6 lines

Oh - you've just reminded me:
dmsetup splitname

Alasdair

That works, but it's not exactly convenient.

[root@system ~]# dmsetup splitname /dev/mapper/tempvg-lvspare1
VG LV LVLayer
/dev/mapper/tempvg lvspare1

If /dev/tempvg/lvspare1 is the optimal naming scheme, cut or awk is needed to recreate the name from that output. How about a 'dmsetup canonical' that takes <device> and provides /dev/<vg>/<lv>?

-- Jess

#11 lore raw
Quoted 2 lines · Jess

That works, but it's not exactly convenient. [root@system ~]# dmsetup splitname /dev/mapper/tempvg-lvspare1

It's not expecting the /dev/mapper prefix there.

It's used here:
11-dm-lvm.rules:IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"

Obviously we can patch it to understand the '/dev/mapper' prefix and other things.

Alasdair

#12 lore raw
Quoted 8 lines · Alasdair G Kergon
Quoted 3 lines · Jess

That works, but it's not exactly convenient. [root@system ~]# dmsetup splitname /dev/mapper/tempvg-lvspare1

It's not expecting the /dev/mapper prefix there.

Quoted 8 lines

It's used here:
11-dm-lvm.rules:IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"

Obviously we can patch it to understand the '/dev/mapper' prefix and other things.

Alasdair

The problem is NOT what lsm puts out or what I see in /dev, it's only in the output of 'mount' and 'fstab'... and being able to map what devs are mounted on what mount points.

#13 lore raw

[linux-lvm] Inconsistent naming needs to be fixed (was Re: Inconsistent naming...?)

In reply to Linda A. Walsh
Quoted 10 lines · Linda A. Walsh
Quoted 6 lines · Alasdair G Kergon
Quoted 2 lines · Linda A. Walsh

Notice the device name. notice how the single dashes are now
displayed as two dashes?!?! >> Roughly: a dash is the separator we chose, and we double it to escape a

real dash. But we still need to extend our escaping mechanism to handle characters that udev states it doesn't support in primary device names but which the old /dev did used to support (and so we still do).

Roughly, if I give a script the mount point of a logical device, how can I find out the name of the LV it is on?

Ok, I think I bass-ackwards way of hacking around this -- but my solution is unique to my usage and conventions.

In my 'application' (meaning 'usage'), I start with a mount-point
of a volume I want to take a snapshot of. I want to map that mount point back to the original dev. It's not straightforward when the device in /proc/mounts, isn't the real device NOR is it the name I
used! I.e. real dev = /dev/dm-[0-x], name i used /dev/VG/LV.
What /proc/mounts shows: /mapper/dev/<mangled VG>-<mangled LV>.

So who's responsible for that mess of code so we can get /proc to
either, show the value I used (when I mount by LABEL I see the 'real'
devices in mounts -- not /dev/disk-by-label/<label>. It isn't consistent
but it's worse, as it choose a name that's gone through some 'translation'...

Am I being more clear about why this create problems (besides
being confusing and just looking bad (because my computer has to come up with it's own name for a dev -- neither the one I used nor the real name?

Now, I can kludge around this, by knowing some different pieces
of information unique to my app/situation, but in the general case, it would be unpredictable, and that's bad, as I'd like to release these scripts if I can get them working to my satisfaction.

Can the situation with /proc/mounts be fixed?