Udev: Assign unique names to your devices: Difference between revisions
No edit summary |
No edit summary |
||
Line 26: | Line 26: | ||
</ol> | </ol> | ||
Next, we'll work on [[Automatically mount and unmount your devices | Next, we'll work on [[Automatically mount and unmount your devices|automounting your device]] when it is inserted... |
Revision as of 17:04, 17 October 2008
[udev] was born for this job. This is fun stuff! (I'm a sick geek.)
- Make sure you've emerged [sys-fs/udev] and [sys-apps/baselayout].
- Put [/etc/udev/rules.d/10-local.rules] under version control, you're going to put your rules there.
- Make sure the kernel has the following enabled:
File systems ---> Pseudo filesystems ---> [*] /proc file system support [*] Virtual memory file system support (former shm fs)
- Run [lsusb], plug your device in, run it again and compare. This will show you the bus+device+deviceid. For USB devices, you can use the Device ID as a unique identifier.
- If needed, run [lsusb -D /proc/bus/usb/#bus#/#device#] to find out everything about your device.
- If you still want more help, plug in your device while watching /var/log/messages to get the dev path, then use this to get more udev identifiers:
udevinfo -a -p `udevinfo -q path -n /dev/sda`
- Write a rule using the selected identifier. Add it to [/etc/udev/rules.d/10-local.rules]. Here's one using a device with ID [090c:6000]:
BUS=="usb", SYSFS{idVendor}=="090c", SYSFS{idProduct}=="6000", NAME="sdhc_via_usb"
- Tell udev to reload rules, and wait for it to finish:
udevadm control --reload_rules udevadm trigger udevadm settle
- Remove and re-plugin your device. It should now show up at [/dev/your_name]!
- If it's a drive, add a mount rule to [/etc/fstab] like this:
- Now you can mount your device reliably, using the mount path, no matter where you plug in your device, or what order you plug it in. Pretty cool, eh?
Next, we'll work on automounting your device when it is inserted...