Changeset f3317d4 for chapter07/symlinks.xml
- Timestamp:
- 02/15/2013 09:14:37 PM (11 years ago)
- Branches:
- 7.5-systemd, 7.6-systemd, 7.7-systemd, 7.8-systemd, 7.9-systemd
- Children:
- b588d62
- Parents:
- 4a4e017
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter07/symlinks.xml
r4a4e017 rf3317d4 10 10 11 11 <title>Creating Custom Symlinks to Devices</title> 12 13 <sect2>14 15 <title>CD-ROM symlinks</title>16 17 <para>Some software that you may want to install later (e.g., various18 media players) expect the <filename class="symlink">/dev/cdrom</filename>19 and <filename class="symlink">/dev/dvd</filename> symlinks to exist, and20 to point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put21 references to those symlinks into <filename>/etc/fstab</filename>. Udev22 comes with a script that will generate rules files to create these symlinks23 for you, depending on the capabilities of each device, but you need to24 decide which of two modes of operation you wish to have the script use.</para>25 26 <para>First, the script can operate in <quote>by-path</quote> mode (used by27 default for USB and FireWire devices), where the rules it creates depend on28 the physical path to the CD or DVD device. Second, it can operate in29 <quote>by-id</quote> mode (default for IDE and SCSI devices), where the30 rules it creates depend on identification strings stored in the CD or DVD31 device itself. The path is determined by Udev's <command>path_id</command>32 script, and the identification strings are read from the hardware by its33 <command>ata_id</command> or <command>scsi_id</command> programs, depending34 on which type of device you have.</para>35 36 <para>There are advantages to each approach; the correct approach to use37 will depend on what kinds of device changes may happen. If you expect the38 physical path to the device (that is, the ports and/or slots that it plugs39 into) to change, for example because you plan on moving the drive to a40 different IDE port or a different USB connector, then you should use the41 <quote>by-id</quote> mode. On the other hand, if you expect the device's42 identification to change, for example because it may die, and you would43 replace it with a different device with the same capabilities and which44 is plugged into the same connectors, then you should use the45 <quote>by-path</quote> mode.</para>46 47 <para>If either type of change is possible with your drive, then choose a48 mode based on the type of change you expect to happen more often.</para>49 50 <!-- If you use by-id mode, the symlinks will survive even the transition51 to libata for IDE drives, but that is not for the book. -->52 53 <important><para>External devices (for example, a USB-connected CD drive)54 should not use by-path persistence, because each time the device is plugged55 into a new external port, its physical path will change. All56 externally-connected devices will have this problem if you write Udev rules57 to recognize them by their physical path; the problem is not limited to CD58 and DVD drives.</para></important>59 60 <para>If you wish to see the values that the Udev scripts will use, then61 for the appropriate CD-ROM device, find the corresponding directory under62 <filename class="directory">/sys</filename> (e.g., this can be63 <filename class="directory">/sys/block/hdd</filename>) and64 run a command similar to the following:</para>65 66 <screen role="nodump"><userinput>udevadm test /sys/block/hdd</userinput></screen>67 68 <para>Look at the lines containing the output of various *_id programs.69 The <quote>by-id</quote> mode will use the ID_SERIAL value if it exists and70 is not empty, otherwise it will use a combination of ID_MODEL and71 ID_REVISION. The <quote>by-path</quote> mode will use the ID_PATH value.</para>72 73 <para>If the default mode is not suitable for your situation, then the74 following modification can be made to the75 <filename>/lib/udev/rules.d/75-cd-aliases-generator.rules</filename> file,76 as follows (where <replaceable>mode</replaceable> is one of77 <quote>by-id</quote> or <quote>by-path</quote>):</para>78 79 <screen role="nodump"><userinput>sed -i -e 's/"write_cd_rules"/"write_cd_rules <replaceable>mode</replaceable>"/' \80 /lib/udev/rules.d/75-cd-aliases-generator.rules</userinput></screen>81 82 <para>Note that it is not necessary to create the rules files or symlinks83 at this time, because you have bind-mounted the host's84 <filename class="directory">/dev</filename> directory into the LFS system,85 and we assume the symlinks exist on the host. The rules and symlinks will86 be created the first time you boot your LFS system.</para>87 88 <para>However, if you have multiple CD-ROM devices, then the symlinks89 generated at that time may point to different devices than they point to on90 your host, because devices are not discovered in a predictable order. The91 assignments created when you first boot the LFS system will be stable, so92 this is only an issue if you need the symlinks on both systems to point to93 the same device. If you need that, then inspect (and possibly edit) the94 generated <filename>/etc/udev/rules.d/70-persistent-cd.rules</filename>95 file after booting, to make sure the assigned symlinks match what you need.</para>96 97 </sect2>98 12 99 13 <sect2>
Note:
See TracChangeset
for help on using the changeset viewer.