]> sourceware.org Git - lvm2.git/blame - doc/udev_assembly.txt
man: document allocation process in lvm.8
[lvm2.git] / doc / udev_assembly.txt
CommitLineData
10c7d802
PR
1Automatic device assembly by udev
2=================================
3
4We want to asynchronously assemble and activate devices as their components
5become available. Eventually, the complete storage stack should be covered,
6including: multipath, cryptsetup, LVM, mdadm. Each of these can be addressed
7more or less separately.
8
9The general plan of action is to simply provide udev rules for each of the
10device "type": for MD component devices, PVs, LUKS/crypto volumes and for
11multipathed SCSI devices. There's no compelling reason to have a daemon do these
12things: all systems that actually need to assemble multiple devices into a
13single entity already either support incremental assembly or will do so shortly.
14
15Whenever in this document we talk about udev rules, these may include helper
16programs that implement a multi-step process. In many cases, it can be expected
17that the functionality can be implemented in couple lines of shell (or couple
18hundred of C).
19
20Multipath
21---------
22
23For multipath, we will need to rely on SCSI IDs for now, until we have a better
24scheme of things, since multipath devices can't be identified until the second
25path appears, and unfortunately we need to decide whether a device is multipath
26when the *first* path appears. Anyway, the multipath folks need to sort this
27out, but it shouldn't bee too hard. Just bring up multipathing on anything that
28appears and is set up for multipathing.
29
30LVM
31---
32
33For LVM, the crucial piece of the puzzle is lvmetad, which allows us to build up
34VGs from PVs as they appear, and at the same time collect information on what is
d742cdf3 35already available. A command, pvscan --cache is expected to be used to
10c7d802
PR
36implement udev rules. It is relatively easy to make this command print out a
37list of VGs (and possibly LVs) that have been made available by adding any
38particular device to the set of visible devices. In othe words, udev says "hey,
d742cdf3 39/dev/sdb just appeared", calls pvscan --cache, which talks to lvmetad, which
10c7d802
PR
40says "cool, that makes vg0 complete". Pvscan takes this info and prints it out,
41and the udev rule can then somehow decide whether anything needs to be done
42about this "vg0". Presumably a table of devices that need to be activated
43automatically is made available somewhere in /etc (probably just a simple list
44of volume groups or logical volumes, given by name or UUID, globbing
45possible). The udev rule can then consult this file.
46
47Cryptsetup
48----------
49
50This may be the trickiest of the lot: the obvious hurdle here is that crypto
51volumes need to somehow obtain a key (passphrase, physical token or such),
52meaning there is interactivity involved. On the upside, dm-crypt is a 1:1
53system: one encrypted device results in one decrypted device, so no assembly or
54notification needs to be done. While interactivity is a challenge, there are at
55least partial solutions around. (TODO: Milan should probably elaborate here.)
56
57(For LUKS devices, these can probably be detected automatically. I suppose that
58non-LUKS devices can be looked up in crypttab by the rule, to decide what is the
59appropriate action to take.)
60
61MD
62--
63
64Fortunately, MD (namely mdadm) already comes with a mechanism for incremental
65assembly (mdadm -I or such). We can assume that this fits with the rest of stack
66nicely.
67
68
69Filesystem &c. discovery
70========================
71
72Considering other requirements that exist for storage systems (namely
73large-scale storage deployments), it is absolutely not feasible to have the
74system hunt automatically for filesystems based on their UUIDs. In a number of
75cases, this could mean activating tens of thousands of volumes. On small
76systems, asking for all volumes to be brought up automatically is probably the
77best route anyway, and once all storage devices are activated, scanning for
78filesystems is no different from today.
79
80In effect, no action is required on this count: only filesystems that are
81available on already active devices can be mounted by their UUID. Activating
82volumes by naming a filesystem UUID is useless, since to read the UUID the
83volume needs to be active first.
This page took 0.035783 seconds and 5 git commands to generate.