Difference between revisions of "Udev - symlinks"

From SME Server
Jump to navigationJump to search
(First draft)
 
m (categorisation)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
For ease of server maintenace it is sometimes preferable to use a human readable symlink to a device rather than refer to the some what cryptic computer device names. For example /dev/ups is easier to understand that this device has a UPS attached to it rather than /dev/ttyS0. However any manually entered symlinks do not survive a reboot as udev creates the /dev structure at boot time.
+
For ease of server maintenace it is sometimes preferable to use a human readable symlink to a device rather than the some what cryptic computer device names. For example /dev/ups is easier to understand that this device has a UPS attached to it rather than /dev/ttyS0. However any manually entered symlinks do not survive a reboot as udev creates the /dev directory structure at boot time.
  
 
You have to get udev to create the symlinks for you. This is straightforward with the use of a custom template.  
 
You have to get udev to create the symlinks for you. This is straightforward with the use of a custom template.  
Line 5: Line 5:
 
<ol></li><li>Create the directory /etc/e-smith/templates-custom/etc/udev/rules.d/10-local.rules and change to it.
 
<ol></li><li>Create the directory /etc/e-smith/templates-custom/etc/udev/rules.d/10-local.rules and change to it.
  
</li><li>Using your favorite text editor create a file with a suitable mnemonic name with content similar to:
+
</li><li>Using your favorite text editor create a file with a suitable mnemonic name and content similar to:
  
 
  # For <description of symlink>
 
  # For <description of symlink>
Line 24: Line 24:
 
Using a template also means that only the template needs to be changed should there be an alteration to the hardware, rather than finding and editing individual application config files.
 
Using a template also means that only the template needs to be changed should there be an alteration to the hardware, rather than finding and editing individual application config files.
  
[[Category:HowTo]]
+
----
 +
[[Category:Howto]]
 +
[[Category:Administration]]

Latest revision as of 14:02, 11 May 2010

For ease of server maintenace it is sometimes preferable to use a human readable symlink to a device rather than the some what cryptic computer device names. For example /dev/ups is easier to understand that this device has a UPS attached to it rather than /dev/ttyS0. However any manually entered symlinks do not survive a reboot as udev creates the /dev directory structure at boot time.

You have to get udev to create the symlinks for you. This is straightforward with the use of a custom template.

  1. Create the directory /etc/e-smith/templates-custom/etc/udev/rules.d/10-local.rules and change to it.
  2. Using your favorite text editor create a file with a suitable mnemonic name and content similar to: # For <description of symlink> KERNEL="<device>", SYMLINK="<name>" Where:
    <device> is the device name. eg. ttyS0.
    <name> is the name of the symlink. eg. ups.
  3. Expand the template: expand-template /etc/udev/rules.d/10-local.rules This is required as a seperate expansion as this template is not known to SME Server.

Using a template also means that only the template needs to be changed should there be an alteration to the hardware, rather than finding and editing individual application config files.