-1

I had a homework question which I answered correctly:

Use lvdisplay to discover information about the VG Name found in the previous question. What is the first LV Path which is using the volume group discovered in the previous question?

The next question said:

Using the path discovered in the previous question, look at this path in the /dev directory using a long listing ls command. Assuming this is in fact a soft link, what is the absolute device name which this link is pointing to?

How do you find the Absolute device name on Linux?

All I got was this on Google:

  • ls - list files in the file system.
  • lsblk - list the block devices (i.e. drives)
  • lspci - list the pci devices.
  • lsusb - list the USB devices.
  • lsdev - list all the devices.
2
  • 1
    What is an "Absolute device name"? – DopeGhoti Oct 10 '18 at 16:13
  • @DopeGhoti I don't know what the homework question means by that as well any helps? – Rakata Infinite Empire Oct 10 '18 at 16:14
0

it depends on what kind of device you are looking for. for example for network devices you can search through /etc/network or /etc/sysconfig/network or if you want your system information you can search through /sys/class. for HDD information search through /dev. these kind of files in linux contains really useful information. as i said before , depend of what kind of device you are looking for, you can find all information you need.

0

You have to list the device itself, for example:

ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 Oct  5 11:12 /dev/cdrom -> sr0

The name after -> represent the absolute device name

3
  • Works in this case but doesn't work for many devices. /dev/dm-0 and /dev/st* come to mind immediately. Do I actually have a serial device hooked to /dev/ttyS0? etc. – doneal24 Oct 10 '18 at 16:22
  • Didn't worked. The question says Using the path discovered in the previous question, look at this path in the /dev directory using a long listing ls command. Assuming this is in fact a soft link, what is the ABSOLUTE device name which this link is pointing to? The previous question that I answered correctly was Use lvdisplay to discover information about the VG Name found in the previous question. What is the first LV Path which is using the volume group discovered in the previous question? – Rakata Infinite Empire Oct 10 '18 at 16:27
  • @DougO'Neal you have to list a mounted device. Tty is not an actual device! – user88036 Oct 10 '18 at 16:29
0

Using the ls -l command in the directory will give you the answer for this.

In my case, using the ls -l command in the /dev/centos_lvm/ directory gave the following;

root -> ../dm-0

Meaning the ABSOLUTE device name which this link is pointing to is the directory before (../) - /dev/dm-0

0

"absolute device name" is not a term that is in common use as far as I know.

Maybe they mean an absolute path to a block device file that corresponds to the LVM logical volume.

Or given that they mention "soft link", which itself is more commonly referred to as "symbolic link" or "symlink", maybe they meant the absolute canonical (i.e. free or any symlink, . and .. components and with only one / in between each component and at the start and none at the end) path to a device file for that LV.

/dev/VG_name/LV_name is generally an absolute path to the LV_name LV in the VG_name volume group. /dev/mapper/VG_name-LV_name is often another one path to the same device file (though note that - in the VG/LV names are encoded as --).

Running readlink -e <that-path> on both should give you the canonical absolute path of that file (generally something like /dev/dm-<number>).

Now, you do cp -a /dev/dm-<number> /root/mydevice, and /root/mydevice will be another canonical absolute path to a block device file for that LV.

$ ls -l /root/mydevice
brw-rw---- 1 root disk 253, 1 Sep 15 06:17 /dev/dm-1

What identifies the device here are the b (type: block), 253 (major number) and 1 (minor number) above that identify the device. You can recreate the same with the mknod command.

On Linux, to find the canonical name for that block device, you can look for 253:1 in /sys/class/block/*/dev:

$ grep -xFl 253:1 /sys/class/block/*/dev
/sys/class/block/dm-1/dev

Or resolve the /sys/dev/block/253:1 symlink:

$ readlink -e /sys/dev/block/253:1
/sys/devices/virtual/block/dm-1

dm-1 being the canonical name here. udev would generally create a corresponding /dev/dm-1 file when that device is discovered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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