Duplicate /dev/dm- devices for multipathed SAN LUN.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Duplicate /dev/dm- devices for multipathed SAN LUN.
Trying to understand why I see duplicate /dev/dm- devices and what the logic here is.
Example:
I have 2 HBA's, that can each see 4 disk controllers, totalling 8 paths to a disk.
device-mapper-multipath handles the multipathing and registers it as /dev/mapper/mpath7 and also /dev/dm-9.
When I perform an iostat, I also have a dm-10 that appears to be pointing to the same device because the stats are exactly the same.
According to the documentation for dm-mulitpath, I understand that the Linux Kernel chose not to hide the multiple paths. This is evidenced by the numerous sd devices. But the "dm" devices are a multipath, I just don't understand why there are 2 of them for each SAN LUN and what the logic behind it is?
It makes it difficult to script any type of automated performance monitor because I can't guarantee those dm's will remain the same across reboots. Is there some automated way I can trace back the /dev/mapper/mpath* to both /dev/dm-* devices?
Also, I notice if I do a `ls -lR` on /dev/mpath there is no listing of dm-10.
If I do a `find /dev -name dm-10`, I don't get any hits.
I only ever "see" a listing of dm-10 in iostat.
just to be clear, I am using dm-9 and dm-10 as an example, but I actually have 4 SAN LUN's and all have duplicate dm devices.
I am using RHEL5.6.
What this shows is exactly what the 'multipath -ll' output should look like given the description you gave in your original post.
Quote:
Also, I notice if I do a `ls -lR` on /dev/mpath there is no listing of dm-10.
If I do a `find /dev -name dm-10`, I don't get any hits.
I only ever "see" a listing of dm-10 in iostat.
You should find dm-10 directly under /dev, i.e. /dev/dm-10 if it still exists. Certainly you should have a /dev/dm-9 if that shows in your multipath -ll command.
'find' doesn't appear to work properly against the /dev directory on my RHEL5.6 system, but an 'ls -l /dev/dm-*' does.
So, the issue would be the dm devices.
To start with and as you know, the dm devices are not guaranteed to remain the same from boot to boot. (If you add or remove an LVM LV it'll effect the multipath dm device names.)
Assuming you have coded 'user_friendly_names=yes' in /etc/multipath.conf (see 'man multipath.conf'), then the mpath devices are persistent, but they are not in 'iostat'. 'iostat' reports the actual /dev/dm-n devices and not /dev/mapper/mpathx "alias". As far as I know, there is no way around this.
But to be clear, you're doing an 'iostat', and the command output has both dm-9 and dm-10 shown? Curious. Sorry I have no answer to that.
Last edited by tommylovell; 09-13-2011 at 09:41 PM.
It makes it difficult to script any type of automated performance monitor because I can't guarantee those dm's will remain the same across reboots. Is there some automated way I can trace back the /dev/mapper/mpath* to both /dev/dm-* devices?
Do not use the /dev/dm- devices. (They're for "internal use".)
For your scripting, monitoring, et al. you should only be using the /dev/mapper devices.
I appreciate all the help and time from you. I have opened a case with Red Hat (might as well use that support once this year right?) and will post what occurs.
Just to add some responses to your comments above though, I guess the meat of what I would like to achieve is to work out how best to monitor/graph/report on disk performance stats / per SAN LUN (not per SAN path). As tommylovell mentioned above, there doesn't appear to be a way to have iostat report on the mpath devices.
So how do other people do it? Surely others need to see trends of disk performance from the OS'es perspective?
Also, the below code blocks might clarify what I am seeing on the server:
[root@xxxxxxx ~]# ls -al /dev/dm*
brw-rw---- 1 root root 253, 6 Aug 31 10:34 /dev/dm-6
brw-rw---- 1 root root 253, 7 Aug 31 10:34 /dev/dm-7
brw-rw---- 1 root root 253, 8 Aug 31 10:34 /dev/dm-8
brw-rw---- 1 root root 253, 9 Aug 31 10:34 /dev/dm-9
Another interesting observation, is I have some RHEL4 servers as well, that not only don't have this problem with duplicate dm's being reported in iostat, but also don't map mpath devices through to dm devices for a multipath command e.g.:
So how do other people do it? Surely others need to see trends of disk performance from the OS'es perspective?
I don't even pretend to do this type of thing...
But when our performance and capacity guys asked how they could match up dm- devices and mpath devices, I gave them this info so that they could script something.
Here's how you can get the maj:min numbers for all dm- devices (i.e. the content of /sys/block/dm-*/dev),
Code:
# for d in $(ls /sys/block/dm-*/dev); do echo -n "$d ";cat $d ; done
/sys/block/dm-0/dev 253:0
/sys/block/dm-1/dev 253:1
/sys/block/dm-2/dev 253:2
/sys/block/dm-3/dev 253:3
/sys/block/dm-4/dev 253:4
/sys/block/dm-5/dev 253:5
/sys/block/dm-6/dev 253:6
/sys/block/dm-7/dev 253:7
This may break if the maintainer rearchitects how Device-Mapper keeps track of it's information. Unfortunately, I can't see where this information is available via a command, which would insulate you from changes.
So, the alternative would be just to pick the major/minor number out of an 'ls -l' command,
Code:
# for d in $(ls /dev/dm-*); do ls -l $d; done
brw-rw---- 1 root root 253, 6 Aug 21 02:47 /dev/dm-6
brw-rw---- 1 root root 253, 7 Aug 21 02:47 /dev/dm-7
This gives you just the non-LVM dm- devices.
And, 'dmsetup' can give you major/minor numbers of the mpath devices so you can match them up,
And as mentioned before and you are aware of, these can change from boot to boot, so you better get this from your system at the same time you are getting your 'iostat' info.
Good luck with Red Hat. If they don't give you a fix, at least you can get an explanation.
Last edited by tommylovell; 09-14-2011 at 12:28 PM.
Reason: technical error
ha, that's interesting. Sorry, I don't know about the iostat display problem. Make sure that your sysstat package is at the latest from RedHat and note that they are up to 5.7.
I will say that on a RHEL 6.1 system (sysstat-9.0.4-18.el6), iostat does not display this issue. I don't currently have any RHEL 5 systems hooked up to a SAN.
So how do other people do it? Surely others need to see trends of disk performance from the OS'es perspective?
I monitor CPU, memory usage, and local filesystems on the RHEL side. I have hundreds of LUNs, and tracking them - e.g. via sar(1) - would require a lot of logging. SAN storage performance is monitored on the SAN storage side.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.