3 ms·
Slightly tweaked the above, in case anyone is interested. Copy the following to /etc/udev/rules.d/10-block-device-history-rules: > SUBSYSTEM=="block",ENV{DEVTY
by shasheene 7y ago
Slightly tweaked the above, in case anyone is interested. Copy the following to /etc/udev/rules.d/10-block-device-history-rules:
> SUBSYSTEM=="block",ENV{DEVTYPE}=="disk", RUN+="/usr/bin/logger --tag=block-device-history -- '%E{ACTION} | %E{DEVNAME} | %E{ID_SERIAL}'"
Run
> $ sudo udevadm control --reload-rules && sudo udevadm trigger
> $ sudo journalctl -f SYSLOG_IDENTIFIER=block-device-history
...Then re-inserting a USB device produces output similar to the below:
> Jan 01 12:00:00 hostname block-device-history[12345]:
add | /dev/sdY | TOSHIBA_TOSHIBA_USB_DRV_012345678900FF00-0:0
To customize the printed variables, have a look at:
> sudo udevadm info /dev/sdY