source: udev-config/doc/60-persistent-storage.txt@ 37a9275

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 37a9275 was 1c48007, checked in by Bruce Dubbs <bdubbs@…>, 16 years ago

Moved bootscripts and udev-config to BOOK
Updated Makefile to automatically generate bootscript and udev-config tarballs
Updated licesnse to be the same as BLFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8548 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 5.4 KB
Line 
1Purpose of rules file:
2
3This rules file provides nonvolatile, unique names (in the form of symlinks)
4for various types of storage devices -- both IDE/ATA and SCSI.
5
6
7Description of rules:
8
9First, similar to the 60-persistent-input.rules file, we skip the entire file
10for uevents that this rules file should not apply to, as an optimization. The
11file does not apply to removal uevents or non-block devices. It does not apply
12to ramdisks, loopback-mount devices, floppy disks, netblock devices, or device-
13mapper devices. It also should not apply to removable devices (that is, non-
14partition devices with attributes named "removable" with the value "1", or
15partition devices whose parents have "removable" set to "1" -- partition
16kobjects don't have the "removable" attribute, only whole-disk kobjects do).
17
18For partition devices, we use the IMPORT{parent} option to pull in all the
19environment variables that get set for the parent device. (The parent of a
20partition device is the containing whole-disk device.) The IMPORT{parent}
21option is documented in the udev(7) manpage, but basically the value that we
22assign is used as a filter of environment variable names to import.
23
24Now, we start with rules to create by-ID symlinks (similar to the by-ID links
25created for input devices). For hd* whole-disk devices (they're IDE/ATA, since
26they start with hd), we run the ata_id program in --export mode. The ata_id
27program requires a device node to be passed, so we also use the $tempnode Udev
28variable -- this causes Udev to create a temporary device node somewhere and
29substitute its name where $tempnode appears in the program command line.
30
31The ata_id program, in --export mode, prints several ID_* values. If we're
32looking at a whole-disk device, and if ID_SERIAL is among those, we add a
33symlink containing the device's ID_MODEL and ID_SERIAL values. If we're
34looking at a partition device, we create an ID_MODEL- and ID_SERIAL-based
35symlink also, but we add -partX to the end of the link name (where X is the
36partition number).
37
38For SCSI devices, we first make some modifications to the environment. If the
39device's kobject has a parent with a non-empty "ieee1394_id" attribute, then
40the device is Firewire, so we set the ID_SERIAL environment variable to the
41value of that attribute, and we set ID_BUS to "ieee1394". Now, if ID_SERIAL is
42not set, we run usb_id, which (if this is a USB storage device) will print
43various values. If ID_SERIAL is still unset, we run scsi_id with a set of
44parameters designed to get an ID_SERIAL by querying the device itself. If that
45still fails, we try running scsi_id in a mode that prints the information even
46if the disk doesn't support so-called "vital product data" pages. If the
47uevent is for a DASD device, we run dasd_id.
48
49If one of these *_id programs gave us an ID_SERIAL, then for whole-disk devices
50we create a by-ID symlink using the ID_BUS and ID_SERIAL. For partition
51devices, we create a by-ID symlink that has the same form except we add -partX
52to the end (just like for IDE/ATA devices).
53
54
55Now we have some rules to create by-path persistent symlinks. We start by
56running the path_id program on the DEVPATH (%p) value. For whole-disk devices
57and SCSI ROM type devices, we create a symlink directly, using the environment
58variable ID_PATH, under the /dev/disk/by-path directory. But for SCSI tape
59devices, we create a by-path symlink in the /dev/tape/by-path directory (we
60base the symlink on the same information, though: the ID_PATH value printed by
61path_id). Now, for both SCSI ROM and SCSI tape devices, we skip everything
62that's left in the rules file (this is another optimization: neither SCSI ROM
63nor SCSI tape devices have UUIDs, labels, or EDD information).
64
65For partition devices, we now create a by-path symlink of the same form as the
66other partition device persistent symlinks (that is, with the same name as the
67parent device, but with -partX added). We know that ID_PATH is set whenever it
68applies, because we ran the path_id program on the parent device, and we did an
69IMPORT{parent} on ID_* earlier in the rules file.
70
71Now we create by-label and by-uuid symlinks. These use properties of various
72filesystems to generate a persistent name for a partition. For instance, if
73you use the ext2 filesystem, you can use e2label to assign a label, and mke2fs
74assigns a UUID when the filesystem is created. MS-DOS compatible filesystems
75also assign a "UUID" (actually it's just a serial number, created based on the
76date and time the partition was formatted, so it is not unique), which these
77rules will also use. But for removable partitions, we skip the rules (for the
78same reason as we skipped them above for removable disks).
79
80We run the vol_id program to get ID_FS_USAGE, ID_FS_UUID, and ID_FS_LABEL_SAFE
81values. (vol_id supports other values as well, but we do not use them here.)
82ID_FS_USAGE corresponds to the way the filesystem is supposed to be used; if it
83gets set to "filesystem", "other", or "crypto", we create a symlink. If
84ID_FS_UUID is set, we use it in a by-uuid symlink. If ID_FS_LABEL_SAFE is set,
85we use it in a by-label symlink.
86
87Finally, we create EDD-based symlinks in the by-id directory. For whole-disk
88devices, we run edd_id to get the EDD-generated ID string. (For partition
89devices, we import this string from the parent.) If edd_id yields an ID_EDD
90value, we use it in a symlink, for both whole disks and partitions.
91
92
93The last rule in the file is merely a LABEL that various other rules use to
94bypass the file (or the rest of the file) when needed.
95
Note: See TracBrowser for help on using the repository browser.