You must write a rule for the udev daemon to perform certain actions when a device is detected.

Rule:

KERNEL=="sd*",SUBSYSTEM=="block",ACTION=="add",ENV{ID_FS_UUID}=="?",RUN+="/opt/bin/create_virtual.sh %k" 

Instead of the value of the environment variable ID_FS_UUID, the corresponding value of the block device is substituted.

However, on one of the systems, the ID_FS_UUID parameter was empty.

System MSVS 5.0. Parameters left by default. At the same time, partitions are created "jammed" using the device-mapper module (lvm is automatically installed on the system).

Output cat /proc/partitions :

 major minor #blocks name 8 0 33554432 sda 8 1 104391 sda1 8 2 33447330 sda2 253 0 29327360 dm-0 253 1 4096000 dm-1 

Output parted -l /dev/sda :

 Number Start End Size Type File system Flags 1 32,3kB 107MB 107MB основной ext3 boot 2 107MB 34,4GB 34,3GB основной lvm 

I see that the sda2 partition does not have a file system, but I cannot understand why. And I just need this section.

Tell me how to determine the ID_FS_UUID parameter for this section.

  • Because you have an LVM volume there, on top of which there are already partitions and already file systems on them. - 0andriy
  • @ 0andriy That is, / dev / sda2 - a physical volume that does not have a file system? - AccumPlus
  • I honestly never came across lvm in practice, so, like you, I will need to read the documentation. But so far this problem has not arisen. - 0andriy
  • @ 0andriy understood. Nevertheless thank you. - AccumPlus

0