DragonFly 3.2 supports the Areca ARC-1882 RAID controller family
[ikiwiki.git] / docs / handbook / handbook-vinum-examples.mdwn
1 \r
2 \r
3 ## 13.6 Some Examples \r
4 \r
5 Vinum maintains a ***configuration database*** which describes the objects known to an individual system. Initially, the user creates the configuration database from one or more configuration files with the aid of the [vinum(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vinum&section8) utility program. Vinum stores a copy of its configuration database on each disk slice (which Vinum calls a ***device***) under its control. This database is updated on each state change, so that a restart accurately restores the state of each Vinum object.\r
6 \r
7 ### 13.6.1 The Configuration File \r
8 \r
9 The configuration file describes individual Vinum objects. The definition of a simple volume might be:\r
10 \r
11     \r
12         drive a device /dev/da3h\r
13         volume myvol\r
14           plex org concat\r
15             sd length 512m drive a\r
16 \r
17 \r
18 This file describes four Vinum objects:\r
19 \r
20
21 * The ***drive*** line describes a disk partition (***drive***) and its location relative to the underlying hardware. It is given the symbolic name ***a***. This separation of the symbolic names from the device names allows disks to be moved from one location to another without confusion.\r
22
23 * The ***volume*** line describes a volume. The only required attribute is the name, in this case ***myvol***.\r
24
25 * The ***plex*** line defines a plex. The only required parameter is the organization, in this case ***concat***. No name is necessary: the system automatically generates a name from the volume name by adding the suffix ***.p******x***, where ***x*** is the number of the plex in the volume. Thus this plex will be called ***myvol.p0***.\r
26
27 * The ***sd*** line describes a subdisk. The minimum specifications are the name of a drive on which to store it, and the length of the subdisk. As with plexes, no name is necessary: the system automatically assigns names derived from the plex name by adding the suffix ***.s******x***, where ***x*** is the number of the subdisk in the plex. Thus Vinum gives this subdisk the name ***myvol.p0.s0***.\r
28 \r
29 After processing this file, [vinum(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vinum&section8) produces the following output:\r
30 \r
31     \r
32           # vinum -> `create config1`\r
33           Configuration summary\r
34           Drives:         1 (4 configured)\r
35           Volumes:        1 (4 configured)\r
36           Plexes:         1 (8 configured)\r
37           Subdisks:       1 (16 configured)\r
38     \r
39         D a                     State: up       Device /dev/da3h        Avail: 2061/2573 MB (80%)\r
40     \r
41         V myvol                 State: up       Plexes:       1 Size:        512 MB\r
42     \r
43         P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB\r
44     \r
45         S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB\r
46 \r
47 \r
48 This output shows the brief listing format of [vinum(8)](http://leaf.dragonflybsd.org/cgi/web-man?command#vinum&section8). It is represented graphically in [vinum-examples.html#VINUM-SIMPLE-VOL Figure 13-4].\r
49 \r
50 ***'Figure 13-4. A Simple Vinum Volume***'\r
51 \r
52 vinum/vinum-simple-vol.png\r
53 \r
54 This figure, and the ones which follow, represent a volume, which contains the plexes, which in turn contain the subdisks. In this trivial example, the volume contains one plex, and the plex contains one subdisk.\r
55 \r
56 This particular volume has no specific advantage over a conventional disk partition. It contains a single plex, so it is not redundant. The plex contains a single subdisk, so there is no difference in storage allocation from a conventional disk partition. The following sections illustrate various more interesting configuration methods.\r
57 \r
58 ### 13.6.2 Increased Resilience: Mirroring \r
59 \r
60 The resilience of a volume can be increased by mirroring. When laying out a mirrored volume, it is important to ensure that the subdisks of each plex are on different drives, so that a drive failure will not take down both plexes. The following configuration mirrors a volume:\r
61 \r
62     \r
63         drive b device /dev/da4h\r
64         volume mirror\r
65           plex org concat\r
66             sd length 512m drive a\r
67           plex org concat\r
68             sd length 512m drive b\r
69 \r
70 \r
71 In this example, it was not necessary to specify a definition of drive ***a*** again, since Vinum keeps track of all objects in its configuration database. After processing this definition, the configuration looks like:\r
72 \r
73     \r
74         Drives:         2 (4 configured)\r
75         Volumes:        2 (4 configured)\r
76         Plexes:         3 (8 configured)\r
77         Subdisks:       3 (16 configured)\r
78     \r
79         D a                     State: up       Device /dev/da3h        Avail: 1549/2573 MB (60%)\r
80         D b                     State: up       Device /dev/da4h        Avail: 2061/2573 MB (80%)\r
81     \r
82         V myvol                 State: up       Plexes:       1 Size:        512 MB\r
83         V mirror                State: up       Plexes:       2 Size:        512 MB\r
84     \r
85         P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB\r
86         P mirror.p0           C State: up       Subdisks:     1 Size:        512 MB\r
87         P mirror.p1           C State: initializing     Subdisks:     1 Size:        512 MB\r
88     \r
89         S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB\r
90         S mirror.p0.s0          State: up       PO:        0  B Size:        512 MB\r
91         S mirror.p1.s0          State: empty    PO:        0  B Size:        512 MB\r
92 \r
93 \r
94 [vinum-examples.html#VINUM-MIRRORED-VOL Figure 13-5] shows the structure graphically.\r
95 \r
96 ***'Figure 13-5. A Mirrored Vinum Volume***'\r
97 \r
98 vinum/vinum-mirrored-vol.png\r
99 \r
100 In this example, each plex contains the full 512 MB of address space. As in the previous example, each plex contains only a single subdisk.\r
101 \r
102 ### 13.6.3 Optimizing Performance \r
103 \r
104 The mirrored volume in the previous example is more resistant to failure than an unmirrored volume, but its performance is less: each write to the volume requires a write to both drives, using up a greater proportion of the total disk bandwidth. Performance considerations demand a different approach: instead of mirroring, the data is striped across as many disk drives as possible. The following configuration shows a volume with a plex striped across four disk drives:\r
105 \r
106     \r
107         drive c device /dev/da5h\r
108         drive d device /dev/da6h\r
109         volume stripe\r
110         plex org striped 512k\r
111           sd length 128m drive a\r
112           sd length 128m drive b\r
113           sd length 128m drive c\r
114           sd length 128m drive d\r
115 \r
116 \r
117 As before, it is not necessary to define the drives which are already known to Vinum. After processing this definition, the configuration looks like:\r
118 \r
119     \r
120         Drives:         4 (4 configured)\r
121         Volumes:        3 (4 configured)\r
122         Plexes:         4 (8 configured)\r
123         Subdisks:       7 (16 configured)\r
124     \r
125         D a                     State: up       Device /dev/da3h        Avail: 1421/2573 MB (55%)\r
126         D b                     State: up       Device /dev/da4h        Avail: 1933/2573 MB (75%)\r
127         D c                     State: up       Device /dev/da5h        Avail: 2445/2573 MB (95%)\r
128         D d                     State: up       Device /dev/da6h        Avail: 2445/2573 MB (95%)\r
129     \r
130         V myvol                 State: up       Plexes:       1 Size:        512 MB\r
131         V mirror                State: up       Plexes:       2 Size:        512 MB\r
132         V striped               State: up       Plexes:       1 Size:        512 MB\r
133     \r
134         P myvol.p0            C State: up       Subdisks:     1 Size:        512 MB\r
135         P mirror.p0           C State: up       Subdisks:     1 Size:        512 MB\r
136         P mirror.p1           C State: initializing     Subdisks:     1 Size:        512 MB\r
137         P striped.p1            State: up       Subdisks:     1 Size:        512 MB\r
138     \r
139         S myvol.p0.s0           State: up       PO:        0  B Size:        512 MB\r
140         S mirror.p0.s0          State: up       PO:        0  B Size:        512 MB\r
141         S mirror.p1.s0          State: empty    PO:        0  B Size:        512 MB\r
142         S striped.p0.s0         State: up       PO:        0  B Size:        128 MB\r
143         S striped.p0.s1         State: up       PO:      512 kB Size:        128 MB\r
144         S striped.p0.s2         State: up       PO:     1024 kB Size:        128 MB\r
145         S striped.p0.s3         State: up       PO:     1536 kB Size:        128 MB\r
146 \r
147 \r
148 ***'Figure 13-6. A Striped Vinum Volume***'\r
149 \r
150 vinum/vinum-striped-vol.png\r
151 \r
152 This volume is represented in [vinum-examples.html#VINUM-STRIPED-VOL Figure 13-6]. The darkness of the stripes indicates the position within the plex address space: the lightest stripes come first, the darkest last.\r
153 \r
154 ### 13.6.4 Resilience and Performance \r
155 \r
156 With sufficient hardware, it is possible to build volumes which show both increased resilience and increased performance compared to standard UNIX® partitions. A typical configuration file might be:\r
157 \r
158     \r
159         volume raid10\r
160           plex org striped 512k\r
161             sd length 102480k drive a\r
162             sd length 102480k drive b\r
163             sd length 102480k drive c\r
164             sd length 102480k drive d\r
165             sd length 102480k drive e\r
166           plex org striped 512k\r
167             sd length 102480k drive c\r
168             sd length 102480k drive d\r
169             sd length 102480k drive e\r
170             sd length 102480k drive a\r
171             sd length 102480k drive b\r
172 \r
173 \r
174 The subdisks of the second plex are offset by two drives from those of the first plex: this helps ensure that writes do not go to the same subdisks even if a transfer goes over two drives.\r
175 \r
176 [vinum-examples.html#VINUM-RAID10-VOL Figure 13-7] represents the structure of this volume.\r
177 \r
178 ***'Figure 13-7. A Mirrored, Striped Vinum Volume***'\r
179 \r
180 vinum/vinum-raid10-vol.png\r
181 \r
182 \r
183 \r
184 CategoryHandbook\r
185 CategoryHandbook-vinum\r