All of lore.kernel.org
 help / color / mirror / Atom feed
* better alternative to part multpath -l output?
@ 2012-01-05 13:33 Rudy Gevaert
  2012-01-05 13:50 ` Bryn M. Reeves
  2012-01-05 19:24 ` Christophe Varoqui
  0 siblings, 2 replies; 3+ messages in thread
From: Rudy Gevaert @ 2012-01-05 13:33 UTC (permalink / raw)
  To: dm-devel

Hello,

Can anybody suggest a better alternative to parsing multpath -l <device> 
to get the underlying devices that are part of the multipath?

Thanks in advance,

Rudy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: better alternative to part multpath -l output?
  2012-01-05 13:33 better alternative to part multpath -l output? Rudy Gevaert
@ 2012-01-05 13:50 ` Bryn M. Reeves
  2012-01-05 19:24 ` Christophe Varoqui
  1 sibling, 0 replies; 3+ messages in thread
From: Bryn M. Reeves @ 2012-01-05 13:50 UTC (permalink / raw)
  To: device-mapper development; +Cc: Rudy Gevaert

On 01/05/2012 01:33 PM, Rudy Gevaert wrote:
> Hello,
> 
> Can anybody suggest a better alternative to parsing multpath -l
> <device> to get the underlying devices that are part of the
> multipath?
> 
> Thanks in advance,
> 
> Rudy

You could parse the output of dmsetup, either table or deps:

# dmsetup table mpath2
0 31457280 multipath 1 queue_if_no_path 1 emc 1 1 round-robin 0 2 1
8:32 1000 8:80 1000
^^^^      ^^^^
# dmsetup deps mpath2
2 dependencies	: (8, 80) (8, 32)
                   ^^^^^   ^^^^^
The lsblk command (or dmsetup ls --tree) will also display dependency
trees graphically but you probably wouldn't want to parse this (and it
operates bottom-up rather than top-down):

# lsblk /dev/sdc /dev/sdd
NAME                            MAJ:MIN RM   SIZE RO MOUNTPOINT
sdc                               8:32   0    15G  0
└─mpatha (dm-0)                 253:0    0    15G  0
  ├─mpathap1 (dm-1)             253:1    0   500M  0 /boot
  └─mpathap2 (dm-2)             253:2    0  14.5G  0
    ├─vg_pe19503-lv_root (dm-3) 253:3    0  10.6G  0 /
    └─vg_pe19503-lv_swap (dm-4) 253:4    0     4G  0 [SWAP]
sdd                               8:48   0    15G  0
└─mpatha (dm-0)                 253:0    0    15G  0
  ├─mpathap1 (dm-1)             253:1    0   500M  0 /boot
  └─mpathap2 (dm-2)             253:2    0  14.5G  0
    ├─vg_pe19503-lv_root (dm-3) 253:3    0  10.6G  0 /
    └─vg_pe19503-lv_swap (dm-4) 253:4    0     4G  0 [SWAP]

But probably the easiest and most direct way is to use the sysfs
holders/slaves directories:

# multipath -l mpath2
mpath2 (3600601608e661a01a50ff0fe2776e011) dm-1 DGC,RAID 5
[size=15G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
\_ round-robin 0 [prio=0][active]
 \_ 1:0:0:0 sdc 8:32  [active][undef]
 \_ 2:0:0:0 sdf 8:80  [active][undef]

# ls /sys/block/dm-1/slaves/
sdc  sdf

The only niggle here is that you need to map the mpath device name to
it's device mapper minor number to obtain the sysfs path.

If you want to find out what's using the device rather than what it's
using change slaves to holders:

# ls /sys/block/dm-0/holders/
dm-1  dm-2

# dmsetup info /dev/dm-1
Name:              mpathap1
State:             ACTIVE
Read Ahead:        256
Tables present:    LIVE
Open count:        1
Event number:      0
Major, minor:      253, 1
Number of targets: 1
UUID: part1-mpath-3600601608e661a01a60ff0fe2776e011

etc.

Regards,
Bryn.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: better alternative to part multpath -l output?
  2012-01-05 13:33 better alternative to part multpath -l output? Rudy Gevaert
  2012-01-05 13:50 ` Bryn M. Reeves
@ 2012-01-05 19:24 ` Christophe Varoqui
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Varoqui @ 2012-01-05 19:24 UTC (permalink / raw)
  To: dm-devel

On jeu., 2012-01-05 at 14:33 +0100, Rudy Gevaert wrote:
> Hello,
> 
> Can anybody suggest a better alternative to parsing multpath -l <device> 
> to get the underlying devices that are part of the multipath?
> 
"multipathd show paths format ..." maybe ?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-05 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05 13:33 better alternative to part multpath -l output? Rudy Gevaert
2012-01-05 13:50 ` Bryn M. Reeves
2012-01-05 19:24 ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.