Skip to contentSkip to conversation

persistent.rules

DISCUSSION Marco d'Itri 2 participants 2 messages Aug 5, 2005 – Aug 9, 2005

lore
Share & tools
lore
#0 lore raw

For the debian directory. I cleaned up the gentoo rules, it's not widely tested but looks like it's working fine.

Signature · 2 lines
ciao,
Marco

# This file contains the rules needed to create persistent device names.

# we are only interested in add actions for block devices
ACTION!="add",		GOTO="no_volume_id"
SUBSYSTEM!="block",	GOTO="no_volume_id"
# and we can safely ignore these kinds of devices
KERNEL=="ram*|loop*|fd*|sr*", GOTO="no_volume_id"
# skip removable ide devices, because the IDE drivers are horrible broken
BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id"
# disk id
KERNEL=="hd*[!0-9]",	IMPORT="/sbin/ata_id --export $tempnode"
KERNEL=="hd*[!0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"

KERNEL=="hd*[0-9]", IMPORT{parent}="ID_*"

KERNEL=="hd*[0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
KERNEL=="sd*[!0-9]",	SYSFS{ieee1394_id}=="*", \
	IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="", \
	IMPORT="/sbin/scsi_id -g -x -a -s %p"
KERNEL=="sd*[!0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}"

KERNEL=="sd*[0-9]", IMPORT{parent}="ID_*"

KERNEL=="sd*[0-9]",	ENV{ID_SERIAL}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# path
KERNEL=="*[!0-9]",	ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}"

KERNEL=="*[0-9]", IMPORT{parent}="ID_*"

KERNEL=="*[0-9]",	ENV{ID_PATH}=="?*", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n"
# volume label and uuid
KERNEL=="*[!0-9]",	SYSFS{removable}=="1", GOTO="no_volume_id"
KERNEL=="*[0-9]",	IMPORT="/sbin/vol_id --export $tempnode"
KERNEL=="*[0-9]",	ENV{ID_FS_UUID}=="?*", \
	SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
KERNEL=="*[0-9]",	ENV{ID_FS_LABEL_SAFE}=="?*", \
	SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
# end of processing
SUBSYSTEM=="block", LABEL="no_volume_id"
#1 lore raw
Quoted 2 lines · Marco d'Itri

For the debian directory. I cleaned up the gentoo rules, it's not widely tested but looks like it's working fine.

Nice, I like the skip on ACTION!="add". :)
You may want to add:
SUBSYSTEM="block", BUS="ide", SYSFS{removable}="1", GOTO="no_volume_id"

cause removable IDE devices causes hotplug events on open()/close(), which gives a nice infinite loop.

Kay

Quoted 49 lines

# This file contains the rules needed to create persistent device names.

# we are only interested in add actions for block devices
ACTION!="add",		GOTO="no_volume_id"
SUBSYSTEM!="block",	GOTO="no_volume_id"
# and we can safely ignore these kinds of devices
KERNEL="ram*|loop*|fd*|sr*", GOTO="no_volume_id"
# skip removable ide devices, because the IDE drivers are horrible broken
BUS="ide", SYSFS{removable}="1", GOTO="no_volume_id"
# disk id
KERNEL="hd*[!0-9]",	IMPORT="/sbin/ata_id --export $tempnode"
KERNEL="hd*[!0-9]",	ENV{ID_SERIAL}="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"

KERNEL="hd*[0-9]", IMPORT{parent}="ID_*"

KERNEL="hd*[0-9]",	ENV{ID_SERIAL}="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
KERNEL="sd*[!0-9]",	SYSFS{ieee1394_id}="*", \
	IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'"
KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="", IMPORT="/sbin/usb_id -x"
KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="", \
	IMPORT="/sbin/scsi_id -g -x -a -s %p"
KERNEL="sd*[!0-9]",	ENV{ID_SERIAL}="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}"

KERNEL="sd*[0-9]", IMPORT{parent}="ID_*"

KERNEL="sd*[0-9]",	ENV{ID_SERIAL}="?*", \
	SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
# path
KERNEL="*[!0-9]",	ENV{ID_TYPE}="?*", IMPORT="/sbin/path_id %p", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}"

KERNEL="*[0-9]", IMPORT{parent}="ID_*"

KERNEL="*[0-9]",	ENV{ID_PATH}="?*", \
	SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n"
# volume label and uuid
KERNEL="*[!0-9]",	SYSFS{removable}="1", GOTO="no_volume_id"
KERNEL="*[0-9]",	IMPORT="/sbin/vol_id --export $tempnode"
KERNEL="*[0-9]",	ENV{ID_FS_UUID}="?*", \
	SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
KERNEL="*[0-9]",	ENV{ID_FS_LABEL_SAFE}="?*", \
	SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
Quoted 2 lines
# end of processing
SUBSYSTEM="block", LABEL="no_volume_id"

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel