Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • udev policy rule setting ro fails for large USB device

    Posted on

    Operating System is RHEL 8.6:

    I have created a udev rule that restricts USB devices to read-only and it appears to work as expected for USB 2.x and USB 3.x devices, but for large USB 3.x devices - it does not appear to work correctly.

    The contents of the rule seem pretty simple:

    cat /etc/udev/rules.d/80-readonly-removables.rules

    ACTION=="add", SUBSYSTEM=="block", ATTRS{removable}=="1", ENV{ID_USB_DRIVER}=="usb-storage", RUN{program}="/sbin/blockdev --setro %N"

    After mounting 2 USB 3.x devices the 16gb device is mount in read-only mode, while the 512gb device is in rw mode.

    (cmd)root:~# mount | grep -E 'sd[a,b]'
    /dev/sdb on /mnt/usb_16gb type ext4 (ro,relatime,seclabel)
    /dev/sda on /mnt/usb_512gb type ext4 (rw,relatime,seclabel,stripe=8191)

    Running the "udevadm test" against the 2 devices shows the devices are loading identical rules.

    My goal is to have any USB device mounted to the machine be read-only.

    Any ideas on how to troubleshoot this issue and isolate why large USB 3.x devices are being mounted in read-write rather than read-only as defined in the rule?

    Attachments

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat