Article 5CZ5T Policy to reject multi-reader device from being scanned by LVM

Policy to reject multi-reader device from being scanned by LVM

by
richinsc
from LinuxQuestions.org on (#5CZ5T)
Good afternoon,

I'm attempting to not have my USB card reader scanned by LVM, whenever I execute lvs, vgs or pvs I keep getting no medium found. I won't ever be using a SD card or other card reader media as an LVM device in the near future. Below you can see the output. I don't want to have this happen when I attempt to use these commands to scan for lvm devices.

Code:# pvs && vgs && lvs
/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
PV VG Fmt Attr PSize PFree
/dev/mapper/storage storage lvm2 a-- <7.28t <7.18t

/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
VG #PV #LV #SN Attr VSize VFree
storage 1 1 0 wz--n- <7.28t <7.18t

/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
/dev/sdc: open failed: No medium found
/dev/sdd: open failed: No medium found
/dev/sde: open failed: No medium found
/dev/sdf: open failed: No medium found
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
test storage -wi-ao---- 100.00gI did see that I can set a policy in lvm.conf to that will reject the device based upon it's dev path, but being that this my desktop I can't guarantee that the device id will always be the same. Based upon what I read I could put in the following policy based upon the output that follows after, but like I said, the dev devices may change.

Code:/etc/lvm/lvm.conf
# global_filter = [ "a|.*|", "r|/dev/sdc|", "r|/dev/sdd|", "r|/dev/sde|", "r|/dev/sdf|"]
Code:# lsscsi -g
[0:0:0:0] disk ATA Seagate BarraCud 1024 /dev/sda /dev/sg0
[6:0:0:0] disk SanDisk Cruzer Glide 1.00 /dev/sdb /dev/sg1
[7:0:0:0] disk Multi-Reader -0 1.00 /dev/sdc /dev/sg2
[7:0:0:1] disk Multi-Reader -1 1.00 /dev/sdd /dev/sg3
[7:0:0:2] disk Multi-Reader -2 1.00 /dev/sde /dev/sg4
[7:0:0:3] disk Multi-Reader -3 1.00 /dev/sdf /dev/sg5
[8:0:0:0] disk WD My Book 1130 1008 /dev/sdh /dev/sg7
[8:0:0:1] enclosu WD SES Device 1008 - /dev/sg8
[9:0:0:0] disk Seagate Backup+ Hub BK D781 /dev/sdg /dev/sg6It would be preferable if I can have a policy to block based upon vendor or product id. Is this possible, if so does anyone have a sample policy I could apply?

System Stats: Ubuntu 20.04, LVM version: 2.03.07(2)
Card Reader stats:
Code:Bus 001 Device 006: ID 11b0:6368 ATECH FLASH TECHNOLOGY
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x11b0 ATECH FLASH TECHNOLOGY
idProduct 0x6368
bcdDevice 12.27
iManufacturer 1 Kingston
iProduct 2 Multi-Reader
iSerial 3 08738192504000
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 CARD READER
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 5 Bulk-In, Bulk-Out, Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x0016
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes 0x0000f41e
BESL Link Power Management (LPM) Supported
BESL value 1024 us
Deep BESL value 61440 us
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x000e
Device can operate at Full Speed (12Mbps)
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 1023 micro seconds
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)P.S. - Feel free to move this thread if it is not in the proper forum.latest?d=yIl2AUoC8zA latest?i=MAwuh-qNq08:hNn_U2Y471M:F7zBnMy latest?i=MAwuh-qNq08:hNn_U2Y471M:V_sGLiP latest?d=qj6IDK7rITs latest?i=MAwuh-qNq08:hNn_U2Y471M:gIN9vFwMAwuh-qNq08
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments