0

I found the following output from sar -d -f /var/log/sa/sa22 of my rhel7.2 vm

09:30:01 PM dev253-10      0.03      0.00      1.25     39.37      0.09   2915.21    766.00      2.43

Then I tried to figure out the partition of dev253-10 using dmsetup but there is no 253:10

docker-253:0-1159-1beb12cb313b06d439cc35e2cf4010133a24579dc90b6132239ea3d26c3c2bd9 (253:7)
 └─docker-253:0-1159-pool (253:4)
    ├─ (7:0)
    └─ (7:1)
rhel-swap (253:1)
 └─ (8:2)
rhel-root (253:0)
 └─ (8:2)
docker-253:0-1159-2bb8f2440697cb95e63a9633dc6ceffb0e8b553f8143b8f98332886f43767cb1 (253:6)
 └─docker-253:0-1159-pool (253:4)
    ├─ (7:0)
    └─ (7:1)
docker-253:0-1159-504a9bdece15050bcb895d0f6f2a9816f2105ca5bdc6324f95e755f85f8c5a2f (253:5)
 └─docker-253:0-1159-pool (253:4)
    ├─ (7:0)
    └─ (7:1)
rhel-lv_data1 (253:3)
 └─ (8:33)
rhel-lv_data0 (253:2)
 └─ (8:17)
docker-253:0-1159-84166572e8b53991f1d928db949a677d5cd3a8553d8e19d1845a1ef7056c18f8 (253:8)
 └─docker-253:0-1159-pool (253:4)
    ├─ (7:0)
    └─ (7:1)

Also tried to cat /proc/partitions

major minor  #blocks  name

   2        0          4 fd0
   8       16   52428800 sdb
   8       17   52427776 sdb1
   8       32  104857600 sdc
   8       33  104856576 sdc1
   8        0   25165824 sda
   8        1     512000 sda1
   8        2   24652800 sda2
  11        0    1048575 sr0
 253        0   16457728 dm-0
 253        1    8192000 dm-1
 253        2   52424704 dm-2
 253        3  104853504 dm-3
   7        0  104857600 loop0
   7        1    2097152 loop1
 253        4  104857600 dm-4
 253        5   10485760 dm-5
 253        6   10485760 dm-6
 253        7   10485760 dm-7
 253        8   10485760 dm-8

but no where there is 253:10.

What is the reason and how can I find that?

al mamun
  • 123

1 Answers1

2

253-10 refers to the device's major and minor number.

The easiest (but least reliable because you should never parse ls) way to find out what it is is:

ls -l /dev/ | grep -E ' 253, +10 '

(the + is because there will be an unknown, but at least one, number of spaces between the comma following the major number and the minor number)

Note that if the major/minor number you are searching could match both character and block devices, you will get two lines of output. Since you know that you are interested only in block devices (because you know it's a disk partition) you can modify the regexp to:

ls -l /dev/ | grep -E '^b.* 253, +10 '

I don't have any device-mapper partitions on my system, so i'll use loop devices (major 7, minors 0,16,32,48,etc) as an example:

# ls -l /dev/ | grep -E '^b.* 7, +16 '
brw-rw----  1 root disk      7,  16 Mar 17 10:37 loop1

Another alternative is to use GNU find, stat, and grep. Unlike ls, this is safely reliable to parse because you have complete control over the output format of stat. The catch is that GNU stat can only output major and minor numbers in hexadecimal, not decimal. So you need to convert the decimal 253 and 10 to hexadecimal fd and a.

Most calculator apps on linux can do this conversion, and you can even do it from the bash command line with, e.g., printf '%x\n' 253

find /dev -type b -exec stat -c '%t %T %n' {} + | grep -i '^fd a '

for my loop device example, 7 decimal is also 7 hexadecimal, but 16 decimal is 10 hex.

# find /dev -type b -exec stat -c '%t %T %n' {} + | grep -i '^7 10 '
7 10 /dev/loop1

This would be much simpler (wouldn't require either stat or grep or converting decimal to hex) if you could refine find's searching by device major and minor numbers (same as you can by size or perms or mtime etc), but AFAICT from man find, it doesn't seem to have that capability.

cas
  • 78,579