I know I can write udev rule to do this but I don’t know how to make it happen… it would be on any card insertion (SD, CF, etc.) and might be on any media type (for now it’s a Lexar USB3 reader).

Running Ubuntu 14.04.3 LTS Server (no GUI).

Drivers are either FAT32 or ExFAT, never NTFS or anything else.

Then, when it mounts, I presume I can run a script if I can do this via a udev rule.


Any ideas? Here’s the udevadm report for one of the cards, this is a 64GB SD card:

  looking at device '/devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb2/2-1/2-1:1.0/host33/target33:0:0/33:0:0:1/block/sdd':
    KERNEL=="sdd"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{ro}=="0"
    ATTR{size}=="123533312"
    ATTR{stat}=="     528        0     4224      568        0        0        0        0        0      568      568"
    ATTR{range}=="16"
    ATTR{discard_alignment}=="0"
    ATTR{events}=="media_change"
    ATTR{ext_range}=="256"
    ATTR{events_poll_msecs}=="2000"
    ATTR{alignment_offset}=="0"
    ATTR{inflight}=="       0        0"
    ATTR{removable}=="1"
    ATTR{capability}=="51"
    ATTR{events_async}==“"

 looking at parent device '/devices/pci0000:00/0000:00:15.0/0000:03:00.0/usb2/2-1/2-1:1.0/host33/target33:0:0/33:0:0:1':
    KERNELS=="33:0:0:1"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{rev}=="LX01"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="6"
    ATTRS{model}=="SD  USB_3_0 Read"
    ATTRS{state}=="running"
    ATTRS{queue_type}=="none"
    ATTRS{iodone_cnt}=="0x3c3"
    ATTRS{iorequest_cnt}=="0x3c3"
    ATTRS{device_busy}=="0"
    ATTRS{evt_capacity_change_reported}=="0"
    ATTRS{timeout}=="30"
    ATTRS{evt_media_change}=="0"
    ATTRS{max_sectors}=="240"
    ATTRS{ioerr_cnt}=="0x105"
    ATTRS{queue_depth}=="1"
    ATTRS{vendor}=="Lexar   "
    ATTRS{evt_soft_threshold_reached}=="0"
    ATTRS{device_blocked}=="0"
    ATTRS{evt_mode_parameter_change_reported}=="0"
    ATTRS{evt_lun_change_reported}=="0"
    ATTRS{evt_inquiry_change_reported}=="0"
    ATTRS{iocounterbits}=="32"
    ATTRS{eh_timeout}=="10"