~psusi/ubuntu/precise/dmraid/fix-gpt

« back to all changes in this revision

Viewing changes to 1.0.0.rc14/doc/dmraid_design.txt

  • Committer: Bazaar Package Importer
  • Author(s): Giuseppe Iuculano, 6af052c
  • Date: 2009-03-25 22:34:59 UTC
  • mfrom: (2.1.9 sid)
  • mto: (2.4.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20090325223459-y54f0rmxem7htn6r
Tags: 1.0.0.rc15-6
[6af052c] Remove 15_isw_incorrect_status_fix.patch, it causes a
segfault. (Closes: #521104)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
dmraid tool design document v1.0.0-rc5f         Heinz Mauelshagen 2004.11.05
3
 
----------------------------------------------------------------------------
4
 
 
5
 
The dmraid tool supports RAID devices (RDs) such as ATARAID with
6
 
device-mapper (dm) in Linux 2.6 avoiding the need to install a
7
 
vendor specific (binary) driver to access them.
8
 
 
9
 
It supports multiple on-disk RAID metadata formats and is open for
10
 
extension with new ones.
11
 
 
12
 
Initially dmraid aims to support activation of RDs and doesn't support
13
 
*updates* of the ondisk metadata (eg, to record disk failures)
14
 
It can optionally erase on disk metadata in case of multiple format
15
 
signatures on a device.
16
 
 
17
 
See future enhancements at the end.
18
 
 
19
 
 
20
 
Functional requirements:
21
 
------------------------
22
 
 
23
 
1. dmraid must be able to read multiple vendor specific ondisk
24
 
   RAID metadata formats:
25
 
 
26
 
   o ATARAID
27
 
     - Highpoint 37x/45x
28
 
     - Intel Software RAID
29
 
     - LSI Logic MegaRaid
30
 
     - Promise FastTrak
31
 
     - Silicon Image Medley
32
 
 
33
 
2. dmraid shall be open to future extensions by other ondisk RAID formats,
34
 
   eg. SNIA DDF
35
 
   (http://www.snia.org/tech_activities/ddftwg/DDFTrial-UseDraft_0_45.pdf)
36
 
 
37
 
3. dmraid shall generate the necessary dm table(s) defining
38
 
   the needed mappings to address the RAID data.
39
 
 
40
 
4. Device discovery, activation, deactivation and
41
 
   property display shall be supported.
42
 
 
43
 
5. Spanning of disks, RAID0, RAID1 and RAID10 shall be supported
44
 
   (in order to be able to support SNIA DDF, higher raid levels need
45
 
    implementing in form of respective dm targets; eg, RAID5);
46
 
   Some vendors do have support for RAID5 already which is outside the scope
47
 
   of dmraid because of the lag of a RAID5 target in device-mapper!
48
 
 
49
 
6. Activation of MSDOS partitions in RAID sets shall be supported.
50
 
 
51
 
 
52
 
Feature set definition:
53
 
-----------------------
54
 
 
55
 
Feature set summarizes as: Discover, Activate, Deactivate, Display.
56
 
 
57
 
 
58
 
o Discover (1-n RD)
59
 
 
60
 
  1 scan active disk devices identifying RD.
61
 
 
62
 
  2 try to find an RD signature and if recognized,
63
 
    add the device to the list of RDs found.
64
 
 
65
 
  3 Abstract the metadata describing the RD layout and translate the vendor
66
 
    specific format into it.
67
 
 
68
 
 
69
 
o Activate (1-n RD)
70
 
 
71
 
  1 group devices into abstracted RAID sets (RS) conforming to
72
 
    their respective layout (SPAN, RAID0, RAID1, RAID10).
73
 
  
74
 
  2 generate dm mapping tables for a/those RS(s) derived from the abstracted
75
 
    information about RS(s) and RD(s).
76
 
  
77
 
  3 create multiple/a dm device(s) for each RS to activate and 
78
 
    load the generated table(s) into the device.
79
 
 
80
 
  4 Recusively discover and activate MSDOS partitions in active RAID sets.
81
 
 
82
 
 
83
 
o Deactivate (1-n RD)
84
 
 
85
 
  1 remove the dm device(s) making up an RS; can be a stacked hierachy of
86
 
    devices (eg, RAID10: RAID1 on top of n RAID0 devices).
87
 
 
88
 
 
89
 
o Display (1-n RD)
90
 
 
91
 
  1 display RS and RD properties
92
 
    (eg, display information kept with RS(s) such as size and type)
93
 
 
94
 
 
95
 
 
96
 
Technical specification:
97
 
------------------------
98
 
 
99
 
All functions returning int or a pointer return 0/NULL on failure.
100
 
 
101
 
o RAID metadata format handler
102
 
 
103
 
  Tool calls the following function to register a vendor specific
104
 
  format handler; in case of success, a new instance with methods is
105
 
  accessible to the high level metadata handling functions (see below):
106
 
 
107
 
  - int register_format_handler(struct lib_context *lc,
108
 
                                struct dmraid_format *fmt);
109
 
 
110
 
    x returns !0 on successfull format handler registration
111
 
 
112
 
  - Format handler methods:
113
 
 
114
 
    x struct raid_dev *(read)(struct lib_context *lc, struct dev_info* di);
115
 
 
116
 
      - returns 'struct raid_dev *' describing the RD (eg, offset, length)
117
 
 
118
 
    x int (*write)(struct lib_context *lc, struct raid_dev* rd, int erase);
119
 
 
120
 
      - returns != 0 successfully written the vendor specific metadata
121
 
        back to the respective RD rd (optionally erasing the
122
 
        metadata area(s) in case erase != 0)
123
 
 
124
 
    x struct raid_set (*group)(struct lib_context *lc,
125
 
                                 struct raid_dev *raid_dev)
126
 
 
127
 
      - returns pointer to RAID set structure on success
128
 
 
129
 
    x int (*check)(struct lib_context *lc, struct raid_set *raid_set)
130
 
 
131
 
      - returns != 0 in case raid set is consistent
132
 
 
133
 
    x void (*log)(struct lib_context *lc, struct raid_dev *rd)
134
 
 
135
 
      - display metadata in native format (ie. all vendor specific
136
 
        metadata fields) for RD rd
137
 
 
138
 
 
139
 
o Discover
140
 
 
141
 
  1 retrieve block device information from sysfs for all disk
142
 
    devices by scanning /SYSFS_MOUNTPOINT/block/[sh]d*;
143
 
    keep information about the device path and size which is the base
144
 
    to find the RAID signature on the device in a linked list
145
 
    of type 'struct dev_info *'.
146
 
 
147
 
  2 walk the list and try to read RD metadata signature off the device
148
 
    trying vendor specific read methods (eg, Highpoint...) in turn;
149
 
    library exposes interface to register format handlers for vendor
150
 
    specific RAID formats in order to be open for future extensions
151
 
    (see register_format_handler() above).
152
 
 
153
 
    Tool calls the following high level function which hides
154
 
    the iteration through all the registered format handler methods:
155
 
 
156
 
    x void discover_devices(struct lib_context *lc)
157
 
 
158
 
      - returns != 0 in case it discovered all supported disks (IDE, SCSI)
159
 
        and added them to a list
160
 
 
161
 
    x void discover_raid_devices(struct lib_context *lc,
162
 
                                 char **fmt_names,
163
 
                                 char **devices);
164
 
 
165
 
      - discovers all suported RDs using the list filled by
166
 
        discover_devices() and adds them to a list
167
 
 
168
 
    x void discover_partitions(struct lib_context *lc);
169
 
 
170
 
      - discovers all MSDOS partitions in active RAID sets and builds
171
 
        RAID sets with one linear device hanging off for activation.
172
 
 
173
 
    x int count_devices(struct lib_context *lc, enum dev_type type);
174
 
 
175
 
      - returns number of devices found by discover_devices() and
176
 
        discover_raid_devices() of specified type (eg, DEVICE, RAID, ...)
177
 
 
178
 
    x int perform(struct lib_context *lc, char **argv);
179
 
 
180
 
      - returns != 0 on success performing various actions
181
 
        (ie. activation/deacivation of RAID sets, displaying properties, ...)
182
 
 
183
 
o Activate 1
184
 
 
185
 
    Tool calls the following high level function which hide
186
 
    the details of the RAID set assembly:
187
 
 
188
 
    x int group_set(struct lib_context *lc, char *name);
189
 
 
190
 
      - returns != 0 on successfully grouping an RS/RSs
191
 
 
192
 
o Activate 2+3
193
 
 
194
 
  - don't activate non-RAID1 devices which have an invalid set check result
195
 
    and display an error
196
 
  - create the ASCII dm mapping table by iterating through the list
197
 
    of RD in a particular set, retrieving the layout (SPAN, ...)
198
 
    the device path, the offset into the device and the length to map
199
 
    and the stripe size in case of RAID
200
 
  - create a unique device_name
201
 
  - call device-mapper library to create the mapped device and load
202
 
    the mapping table using this function:
203
 
 
204
 
    x int activate_set(struct lib_context *lc, void *rs)
205
 
 
206
 
      - returns != 0 in case of successfull RAID set activation
207
 
 
208
 
o Activate 4
209
 
  - activate MSDOS partitioned RAID sets as in 2+3
210
 
 
211
 
 
212
 
o Deactivate
213
 
 
214
 
  - check if a partitioned RAID set is active and deactivate it first
215
 
 
216
 
  - check if the RAID set is active and call device-mapper library to
217
 
    remove the mapped device (recursively in case of a mapped-device hierarchy)
218
 
    using this function:
219
 
 
220
 
    x int deactivate_set(struct lib_context *lc, void *rs)
221
 
 
222
 
      - returns != 0 in case of successfull RAID set deactivation
223
 
 
224
 
 
225
 
o Display
226
 
 
227
 
  - list all block devices found
228
 
  - list all (in)active RD
229
 
  - display properties of a particular/all RD devices
230
 
    (eg, members of the set by block device name and offset/length mapped
231
 
     to those...)
232
 
 
233
 
    x void display_devices(struct lib_context *lc, enum dev_type type);
234
 
 
235
 
      - display devices of dev_type 'type' (eg, RAID, DEVICE, ...)
236
 
 
237
 
    x void display_set(struct lib_context *lc, void *rs,
238
 
                       enum active_type type, int top);
239
 
 
240
 
      - display RS of active_type 'type' (ACTIVE, INACTIVE, ALL)
241
 
 
242
 
 
243
 
Code directory tree:
244
 
--------------------
245
 
 
246
 
dmraid ---/doc
247
 
        +-/include
248
 
        +-/lib ---/activate
249
 
        |       |-/datastruct
250
 
        |       |-/device
251
 
        |       |-/display
252
 
        |       |-/format ---/ataraid
253
 
        |       |          +-/partition
254
 
        |       |          +-/template
255
 
        |       |-/locking
256
 
        |       |-/log
257
 
        |       |-/misc
258
 
        |       |-/metadata
259
 
        |       +-/mm
260
 
        +-/man
261
 
        +-/tools
262
 
 
263
 
 
264
 
Future enhancements:
265
 
--------------------
266
 
 
267
 
o enhance write support to update ondisk metadata
268
 
  - to restore metadata backups
269
 
  - to record disk failures
270
 
 
271
 
o support to log state (eg, sector failures) in standard/vendor ondisk logs;
272
 
  needs above write support
273
 
 
274
 
o status daemon to monitor RAID set sanity
275
 
  (eg, disk failure, hot spare rebuild, ...) and
276
 
  frontend with CLI
277
 
 
278
 
 
279
 
Open questions:
280
 
---------------
281
 
 
282
 
o do we need to prioritize on device-mapper targets for higher RAID levels
283
 
  (in particular we'ld need RAID3+5 to support some ATARAID formats) ?