Info on /dev/dm files

Hi,

I was looking at my /dev directory and found some files of the pattern dm?. I searched on google and found that it is a device manager file for LVM. But nothing but that.

Can someone give me some info on when these files are created and if we can use this as instead of /dev/mapper/logvol's in the /etc/fstab?

Thanks.

If it helps, I use CentOS 6.2.

it is part of device mapper, and used by LVM among other things like storage connected via some sort of SAN.

It is used for consistent naming, rather than going to individual drives.

Thanks for the info. So, my assumption is these files are created when i run lvcreate. Correct me if I'm wrong.

Yes, you are correct.

If you do an "ls -l" on /dev/mapper/* it will tell you that those are symbolic links to the /dev/dm-* files. Files in /dev/mapper are named according to the volume groups and logical volumes lying on top of them. If you are comfortable with dm-* files and you know what volume group-logical volume they map to, you may use them in /etc/fstab file.

Folks, according to DM Multipath - DM Multipath Configuration and Administration https://docs.google.com/viewer?url=http%3A%2F%2Fdocs.redhat.com%2Fdocs%2Fen-US%2FRed\_Hat\_Enterprise\_Linux%2F6%2Fpdf%2FDM\_Multipath%2FRed\_Hat\_Enterprise\_Linux-6-DM_Multipath-en-US.pdf, page 17

"Any devices of form /dev/dm-n are for internal use only and should never be used"

The manual suggest using /dev/mapper devices in LVM/Multipath setup on RHEL6

Regards
Peasant.

1 Like

@Peasant: Any clue why it /dev/dm-n files should not be used? The doc does not say much about that.

1 Like

Here is from another document,
Device Mapper Support for the udev Device Manager :

NOTE: /dev/dm-N nodes should never be used in scripts to access the device since the N number is assigned dynamically and changes with the sequence of how devices are activated. Therefore, true names in the /dev/mapper directory should be used. This layout is to support udev requirements of how nodes/symlinks should be created.

2 Likes

Thanks a lot @Peasant and @admin_xor for the valuable information. That was exactly what i was looking for.