translate 'dm-' to file system name

We occasionally get errors in /var/log/messages like:
Buffer I/O error on device dm-17, logical block 6045

I am trying to find the command(s) I can script to translate “dm-17” back to a file system name.

I have looked at df, lvdisplay, etc and do not see anything that helps.

Can someone point me in the correct direction of where/what to look at?

TIA,
Scott

Try to find the Disk and partition via.


# ls -l /dev/disk/by-id     | grep dm-17

Then you can use badblocks(8), after checking you have a backup, if not then recover all the data you can onto a different disk.

With luck just some blocks are no longer readable in one file system, smartctl(8) can interogate the disk directly, so you can decide if it’s likely to be near failure.

That certainly pointed me to a place in Linux I had never been in before :slight_smile:

But when I run that command I don’t see all the “dm’s”, or at least not the one in the error message:

lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030303430 → …/…/dm-0
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030303430-part1 → …/…/dm-9
lrwxrwxrwx 1 root root 11 Nov 12 09:09 scsi-360060480000190102827533030304130 → …/…/dm-22
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333134 → …/…/dm-1
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333135 → …/…/dm-2
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333136 → …/…/dm-3
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333442 → …/…/dm-4
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333443 → …/…/dm-5
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333530 → …/…/dm-6
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333531 → …/…/dm-7
lrwxrwxrwx 1 root root 10 Nov 12 09:09 scsi-360060480000190102827533030333532 → …/…/dm-8
lrwxrwxrwx 1 root root 11 Dec 3 16:32 scsi-vg03-lvol4 → …/…/dm-18

In fact, we don’t have a vg03, so I don’t know what the last line means.

I also tried this command on some of our other systems (same OS version, etc), and the directory doesn’t exist.

Can you give me some idea of what is supposed to be in this directory, or what man page to read. I can’t find anything worthwhile with a Google search.

Sorry I tried to give a quick clue, but the info you need isn’t where I expected it to be.

fir:/work/dl # mount | grep mapper
/dev/mapper/System-Work--DL on /work/dl type xfs (rw)
# ls -l /dev/disk/by-id
lrwxrwxrwx 1 root root  9 Dec 17 09:52 ata-WDC_WD2500JS-75NCB3_WD-WCANKL034520 -> ../../sda
lrwxrwxrwx 1 root root 10 Dec 17 09:52 ata-WDC_WD2500JS-75NCB3_WD-WCANKL034520-part1 -> ../../sda1
...                                                              

So I expected you’ld get a clue, you could chase down but I see :


ybaG1VpkGyBjHCnchGlkYjvf56UgRZsCumG -> ../../dm-0
lrwxrwxrwx 1 root root 10 Dec 17 09:52 dm-uuid-LVM-710FpHFnXOOITGXFJVKnBmDeZZBEJybaKiKBOw10mTT6LpzFCZpbT9gq33PBfQ4a -> ../../dm-3
lrwxrwxrwx 1 root root 10 Dec 17 09:52 dm-uuid-LVM-710FpHFnXOOITGXFJVKnBmDeZZBEJ

So actually it wasn’t going to be so simple.

You should be able to discover the underlying partition with the LVM system. I don’t know if it’s shown in the YaST LVM or Partitioner, or whether there’s some funky command line tool to go from LVM ID to the actual disk partitons.

Basically the device mapper, allows several partions to form a Volume Group, from which your logical filesystem is ‘hosted’. The contents of /dev/mapper are unhelpful but there are the block devices.

I have a Volgroup “System” and a Logical Volume “Root”.

fir:/work/dl # ls -l /dev/System/Root
lrwxrwxrwx 1 root root 23 Dec 17 09:52 /dev/System/Root -> /dev/mapper/System-Root
fir:/work/dl # ls -l /dev/mapper
total 0
brw------- 1 root root 253, 0 Dec 17 09:52 System-Root
brw------- 1 root root 253, 2 Dec 17 09:52 System-TestTmp
brw------- 1 root root 253, 3 Dec 17 09:52 System-TestVar
brw------- 1 root root 253, 4 Dec 17 09:52 System-Work
brw------- 1 root root 253, 5 Dec 17 09:52 System-Work--DL

Querying the LVM system would appear the way to discover which disk partitions are involved.

You can try badblocks on the underlying mapper device. I’m assuming the error messages are caused by occasional reads of a duff file, or scan of directory by find or some such.

Rob - thanks for all the info. I guess “Querying the LVM system” is the part I am trying to discover.

Scott

That’s the bit I don’t understand. When I fire up YaST LVM tool (from the Administration menu) and look.

I see :

Device     Size     Type       Volume Group
/dev/sdb9  41.0 GB  Linux LVM  System

So once you have the way to go from mapper device to volume group names that I showed you, it appears trivial. You get to see the real devices by simply starting the Logical Volume Manager.