Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I cannot figure out the mapping between different logical and physical block device names. The output of "cat /proc/diskstats" is :

 104    0 cciss/c0d0 ...
 104    1 cciss/c0d0p1 ...
 104    2 cciss/c0d0p2 ...
 104    16 cciss/c0d1 ...
 253    0 dm-0 ...
 253    1 dm-1 ...
 253    2 dm-2 ...
 253    3 dm-3 ...

The output of "df -h" is :

/dev/cciss/c0d0p1                 99M   39M   56M  42% /boot
/dev/mapper/VolGroup01-LogVol02   908G  760G  103G  89% /home
/dev/mapper/VolGroup01-LogVol03   193G  181G  2.6G  99% /opt
/dev/mapper/VolGroup00-LogVol00   54G   11G   41G  21%  /

Where do I find the mapping between "cciss" , "dm-#", and "VolGroup##" ?

Thanks

share|improve this question
1  
Everything in the /dev/mapper directory is typically a symlink to the actual device. –  jw013 Jun 19 '12 at 1:29
add comment

3 Answers

There're handy dmsetup ls --tree and lsblk utils.

share|improve this answer
2  
Although that doesn't give you the mapping between VGs and their PVs. For that, you'd need to run pvdisplay and vgdisplay and correlate their output to that of dmsetup ls. –  Alexios Jun 19 '12 at 9:54
    
@Alexios, ? Didn't try lsblk? –  poige Jun 20 '12 at 13:17
add comment

Ok, finally figured that out.

pvscan command provides the mapping I'm looking for.

share|improve this answer
    
pvs, rather, or did I misunderstand the question? –  Gilles Jun 19 '12 at 23:37
add comment

I was just running into this, so I'll document what helped me here.

poise's answer is correct, You can get all of the information you need from dmsetup ls --tree, if you know how to interpret the output.

cciss is the device name, that's your actual disk. The man page spells it out well, but I'll copy the relevant section here:

   Device nodes
   The device naming scheme is as follows:

   Major numbers:

       104     cciss0
       105     cciss1
       106     cciss2
       105     cciss3
       108     cciss4
       109     cciss5
       110     cciss6
       111     cciss7

   Minor numbers:

       b7 b6 b5 b4 b3 b2 b1 b0
       |----+----| |----+----|
            |           |
            |           +-------- Partition ID (0=wholedev, 1-15 partition)
            |
            +-------------------- Logical Volume number

   The device naming scheme is:

       /dev/cciss/c0d0         Controller 0, disk 0, whole device
       /dev/cciss/c0d0p1       Controller 0, disk 0, partition 1
       /dev/cciss/c0d0p2       Controller 0, disk 0, partition 2
       /dev/cciss/c0d0p3       Controller 0, disk 0, partition 3

       /dev/cciss/c1d1         Controller 1, disk 1, whole device
       /dev/cciss/c1d1p1       Controller 1, disk 1, partition 1
       /dev/cciss/c1d1p2       Controller 1, disk 1, partition 2
       /dev/cciss/c1d1p3       Controller 1, disk 1, partition 3

The "dm-#" is the device mapper number. The easiest way to map DM numbers is to run lvdisplay, which shows the logical volume name, the volume group it belongs to, and the block device. In the "Block device" row, the value listed after the colon is the DM number.

root@centos:/dev > lvdisplay /dev/vg0/opt 
  --- Logical volume ---
  LV Name                /dev/vg0/opt
  VG Name                vg0
  LV UUID                ObffAT-txIn-5Rwy-bW5s-gekn-VLZv-71mDZi
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                1.00 GB
  Current LE             32
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:5

Which maps back nicely to the output of dmsetup ls --tree

vg0-opt (253:5)
 └─ (104:3)

You can also see the DM number mappings by running ls -lrt /dev/mapper.

root@centos:/dev > ls -lrt /dev/mapper
total 0
crw------- 1 root root  10, 60 Aug 29  2013 control
brw-rw---- 1 root disk 253,  0 Aug 29  2013 vg0-root
brw-rw---- 1 root disk 253,  1 Aug 29  2013 vg0-usr
brw-rw---- 1 root disk 253,  2 Aug 29  2013 vg0-tmp
brw-rw---- 1 root disk 253,  3 Aug 29  2013 vg0-var
brw-rw---- 1 root disk 253,  4 Aug 29  2013 vg0-home
brw-rw---- 1 root disk 253,  5 Aug 29  2013 vg0-opt

The sixth column lists the DM number. So, for my server, vg0-opt is mounted on /opt, and maps back to DM-5.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.