Skip to content

Instantly share code, notes, and snippets.

View daks's full-sized avatar

Éric Veiras daks

View GitHub Profile
@daks
daks / 10-udev-disks.rules
Last active November 21, 2023 08:58
mpd configuration with music collection on removable usb disk, using autofs to automount when needed. Used on a RaspberryPi
# /etc/udev/rules.d/10-udev-disks.rules
# udev custom rule
# using # udevadm info -a -p $(udevadm info -q path -n /dev/sda1)
# I found the necessary information about my USB device
# and take the necessary ones to make it unique (idVendor, idProduct, serial here)
# when plugging the disk, nevermind the device name it gets (sda1, sdb1,...) udev creates /dev/mpd-disk and runs the script indicated
KERNEL=="sd?1",ATTRS{idVendor}=="xxxx",ATTRS{idProduct}=="yyyy",ATTRS{serial}=="zzzzzzzzzzzz",SYMLINK+="mpd-disk",RUN+="/root/bin/hdparm-mpd-disk.sh"