Bug 731785
Summary: | RFE: add option to dmsetup to display device names for "dmsetup deps" | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Dave Wysochanski <dwysocha> |
Component: | device-mapper | Assignee: | Peter Rajnoha <prajnoha> |
Status: | CLOSED ERRATA | QA Contact: | Cluster QE <mspqa-list> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.1 | CC: | agk, bmr, cmarthal, dwysocha, heinzm, jbrassow, mbroz, nperic, pbatkowski, prajnoha, prockai, thornber, zkabelac |
Target Milestone: | rc | Keywords: | FutureFeature |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | lvm2-2.02.95-1.el6 | Doc Type: | Enhancement |
Doc Text: |
The dmsetup command now supports displaying block device names for any devices listed on deps, ls and info command output.
For dmsetup 'deps' and 'ls' command, it's possible to switch among 'devno' (major and minor number, the default and the original behaviour), 'devname' (mapping name for a device-mapper device, block device name otherwise) and 'blkdevname' (always display a block device name).
For dmsetup 'info' command, it's possible to use new 'blkdevname' and 'blkdevs_used' fields.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2012-06-20 14:52:01 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 756082 |
Description
Dave Wysochanski
2011-08-18 16:28:52 UTC
It would be nice, but please note I had RFE for lsblk which provide exactly these simple listings based on sysfs (over all storage devices, not only DM): # lsblk /dev/sda NAME MAJ:MIN RM SIZE RO MOUNTPOINT sda 8:0 0 68.4G 0 ├─sda1 8:1 0 196.1M 0 /boot ├─sda2 8:2 0 996.2M 0 [SWAP] ├─sda3 8:3 0 33.6G 0 └─sda4 8:4 0 33.6G 0 └─vg_rhel6-root (dm-0) 253:0 0 33.6G 0 / Do they know about it? (it is in released version already.) For scripts it's also often easier to follow the deps directly in sysfs via the symlinks in the /sys/block/<device>/slaves directory. (In reply to comment #1) > It would be nice, but please note I had RFE for lsblk which provide exactly > these simple listings based on sysfs (over all storage devices, not only DM): > > # lsblk /dev/sda > NAME MAJ:MIN RM SIZE RO MOUNTPOINT > sda 8:0 0 68.4G 0 > ├─sda1 8:1 0 196.1M 0 /boot > ├─sda2 8:2 0 996.2M 0 [SWAP] > ├─sda3 8:3 0 33.6G 0 > └─sda4 8:4 0 33.6G 0 > └─vg_rhel6-root (dm-0) 253:0 0 33.6G 0 / > > Do they know about it? (it is in released version already.) You could either do a ls -l or use lsblk, but this still requires two steps. dmsetup, then lsblk. It would be more convenient if it was just dmsetup and that made sense of everything. Also, all of these solutions are a devname -> maj,min mapping, as far as I know there isn't a way to get maj:min -> devname mapping. Perhaphs not exactly what you want, but: for DM: cat /sys/dev/block/$MAJOR:$MINOR/dm/name dmsetup deps -j $MAJOR -m $MINOR (hm, and lsblk has no such option, seems like a bug:-) or maybe lsblk /dev/block/$MAJOR:$MINOR Patches posted to lvm-devel for review: https://www.redhat.com/archives/lvm-devel/2011-November/msg00026.html https://www.redhat.com/archives/lvm-devel/2011-November/msg00027.html After a review and further discussion, the final output is as follows (an example with one linear [lvol0] and one mirror [lvol1] LVM2 volume): ------------------ dmsetup info -c -o ------------------ [0] rawhide/~ # dmsetup info -c -o name,blkdevname,devnos_used,blkdevs_used Name BlkDevName DevNos BlkDevNames vg-lvol1 dm-4 253:3,253:2,253:1 dm-3,dm-2,dm-1 vg-lvol1_mimage_1 dm-3 8:80 sdf vg-lvol0 dm-0 8:64 sde vg-lvol1_mimage_0 dm-2 8:64 sde vg-lvol1_mlog dm-1 8:128 sdi ------------ dmsetup deps ------------ [0] rawhide/~ # dmsetup deps vg-lvol1: 3 dependencies : (253, 3) (253, 2) (253, 1) vg-lvol1_mimage_1: 1 dependencies : (8, 80) vg-lvol0: 1 dependencies : (8, 64) vg-lvol1_mimage_0: 1 dependencies : (8, 64) vg-lvol1_mlog: 1 dependencies : (8, 128) [0] rawhide/~ # dmsetup deps -o devno vg-lvol1: 3 dependencies : (253, 3) (253, 2) (253, 1) vg-lvol1_mimage_1: 1 dependencies : (8, 80) vg-lvol0: 1 dependencies : (8, 64) vg-lvol1_mimage_0: 1 dependencies : (8, 64) vg-lvol1_mlog: 1 dependencies : (8, 128) [0] rawhide/~ # dmsetup deps -o blkdevname vg-lvol1: 3 dependencies : (dm-3) (dm-2) (dm-1) vg-lvol1_mimage_1: 1 dependencies : (sdf) vg-lvol0: 1 dependencies : (sde) vg-lvol1_mimage_0: 1 dependencies : (sde) vg-lvol1_mlog: 1 dependencies : (sdi) [0] rawhide/~ # dmsetup deps -o devname vg-lvol1: 3 dependencies : (vg-lvol1_mimage_1) (vg-lvol1_mimage_0) (vg-lvol1_mlog) vg-lvol1_mimage_1: 1 dependencies : (sdf) vg-lvol0: 1 dependencies : (sde) vg-lvol1_mimage_0: 1 dependencies : (sde) vg-lvol1_mlog: 1 dependencies : (sdi) [0] rawhide/~ # dmsetup deps -o abc Option not recognised: abc Couldn't process command line. ---------- dmsetup ls ---------- [0] rawhide/~ # dmsetup ls vg-lvol1 (253:4) vg-lvol1_mimage_1 (253:3) vg-lvol0 (253:0) vg-lvol1_mimage_0 (253:2) vg-lvol1_mlog (253:1) [0] rawhide/~ # dmsetup ls -o devno vg-lvol1 (253:4) vg-lvol1_mimage_1 (253:3) vg-lvol0 (253:0) vg-lvol1_mimage_0 (253:2) vg-lvol1_mlog (253:1) [0] rawhide/~ # dmsetup ls -o devname vg-lvol1 (vg-lvol1) vg-lvol1_mimage_1 (vg-lvol1_mimage_1) vg-lvol0 (vg-lvol0) vg-lvol1_mimage_0 (vg-lvol1_mimage_0) vg-lvol1_mlog (vg-lvol1_mlog) [0] rawhide/~ # dmsetup ls -o blkdevname vg-lvol1 (dm-4) vg-lvol1_mimage_1 (dm-3) vg-lvol0 (dm-0) vg-lvol1_mimage_0 (dm-2) vg-lvol1_mlog (dm-1) [0] rawhide/~ # dmsetup ls -o abc Option not recognised: abc Couldn't process command line. ----------------- dmsetup ls --tree ----------------- [0] rawhide/~ # dmsetup ls --tree vg-lvol1 (253:4) |-vg-lvol1_mimage_1 (253:3) | `- (8:80) |-vg-lvol1_mimage_0 (253:2) | `- (8:64) `-vg-lvol1_mlog (253:1) `- (8:128) vg-lvol0 (253:0) `- (8:64) [0] rawhide/~ # dmsetup ls --tree -o blkdevname vg-lvol1 <dm-4> (253:4) |-vg-lvol1_mimage_1 <dm-3> (253:3) | `- <sdf> (8:80) |-vg-lvol1_mimage_0 <dm-2> (253:2) | `- <sde> (8:64) `-vg-lvol1_mlog <dm-1> (253:1) `- <sdi> (8:128) vg-lvol0 <dm-0> (253:0) `- <sde> (8:64) [0] rawhide/~ # dmsetup ls --tree -o abc Tree options not recognised: abc Couldn't process command line. -------------------------------------------------------------- Briefly: * devno == major and minor pair blkdevname == kernel (block device) name (e.g. dm-0, sda, md0, ...) devname == map name for dm devices (the one found in /dev/mapper dir), equal to blkdevname for non-dm devices * new '-o' switch with possible options of '{devno|blkdevname|devname}' for dmsetup deps and ls * new '-o blkdevname' option for dmsetup ls --tree (ls --tree already had the '-o' switch so this is just an addition of a new option for completeness and consistency with other commmands) * new '-c -o blkdevname,blkdevs_used' options for dmsetup info -c -o Notice: 'devname' works only with kernels >= 2.6.29 (it reads /sys/dev/block/major:minor/dm/name content). For olders kernels, the 'devname' is equal to 'blkdevname'. upstream lvm2 v2.02.89/libdevmapper 1.02.68 I've renamed the headers to make it more comprehensible: DevNames --> DevNamesUsed BlkDevNames --> BlkDevNamesUsed DevNos --> DevNosUsed So we have: [0] devel/~ # dmsetup info -c -o name,blkdevname,devs_used,devnos_used,blkdevs_used Name BlkDevName DevNamesUsed DevNosUsed BlkDevNamesUsed c dm-2 b,a 253:1,253:0 dm-1,dm-0 b dm-1 8:16 sdb a dm-0 8:0 sda It's just a header rename, so it should not cause any harm (scripts use --noheadings anyway). Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: The dmsetup command now supports displaying block device names for any devices listed on deps, ls and info command output. For dmsetup 'deps' and 'ls' command, it's possible to switch among 'devno' (major and minor number, the default and the original behaviour), 'devname' (mapping name for a device-mapper device, block device name otherwise) and 'blkdevname' (always display a block device name). For dmsetup 'info' command, it's possible to use new 'blkdevname' and 'blkdevs_used' fields. (In reply to comment #12) > I've renamed the headers to make it more comprehensible: > > DevNames --> DevNamesUsed > BlkDevNames --> BlkDevNamesUsed > DevNos --> DevNosUsed Renamed in lvm2-2.02.95-6.el6. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0962.html |