2
dmraid tool design document v1.0.0-rc5f Heinz Mauelshagen 2004.11.05
3
----------------------------------------------------------------------------
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.
9
It supports multiple on-disk RAID metadata formats and is open for
10
extension with new ones.
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.
17
See future enhancements at the end.
20
Functional requirements:
21
------------------------
23
1. dmraid must be able to read multiple vendor specific ondisk
24
RAID metadata formats:
31
- Silicon Image Medley
33
2. dmraid shall be open to future extensions by other ondisk RAID formats,
35
(http://www.snia.org/tech_activities/ddftwg/DDFTrial-UseDraft_0_45.pdf)
37
3. dmraid shall generate the necessary dm table(s) defining
38
the needed mappings to address the RAID data.
40
4. Device discovery, activation, deactivation and
41
property display shall be supported.
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!
49
6. Activation of MSDOS partitions in RAID sets shall be supported.
52
Feature set definition:
53
-----------------------
55
Feature set summarizes as: Discover, Activate, Deactivate, Display.
60
1 scan active disk devices identifying RD.
62
2 try to find an RD signature and if recognized,
63
add the device to the list of RDs found.
65
3 Abstract the metadata describing the RD layout and translate the vendor
66
specific format into it.
71
1 group devices into abstracted RAID sets (RS) conforming to
72
their respective layout (SPAN, RAID0, RAID1, RAID10).
74
2 generate dm mapping tables for a/those RS(s) derived from the abstracted
75
information about RS(s) and RD(s).
77
3 create multiple/a dm device(s) for each RS to activate and
78
load the generated table(s) into the device.
80
4 Recusively discover and activate MSDOS partitions in active RAID sets.
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).
91
1 display RS and RD properties
92
(eg, display information kept with RS(s) such as size and type)
96
Technical specification:
97
------------------------
99
All functions returning int or a pointer return 0/NULL on failure.
101
o RAID metadata format handler
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):
107
- int register_format_handler(struct lib_context *lc,
108
struct dmraid_format *fmt);
110
x returns !0 on successfull format handler registration
112
- Format handler methods:
114
x struct raid_dev *(read)(struct lib_context *lc, struct dev_info* di);
116
- returns 'struct raid_dev *' describing the RD (eg, offset, length)
118
x int (*write)(struct lib_context *lc, struct raid_dev* rd, int erase);
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)
124
x struct raid_set (*group)(struct lib_context *lc,
125
struct raid_dev *raid_dev)
127
- returns pointer to RAID set structure on success
129
x int (*check)(struct lib_context *lc, struct raid_set *raid_set)
131
- returns != 0 in case raid set is consistent
133
x void (*log)(struct lib_context *lc, struct raid_dev *rd)
135
- display metadata in native format (ie. all vendor specific
136
metadata fields) for RD rd
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 *'.
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).
153
Tool calls the following high level function which hides
154
the iteration through all the registered format handler methods:
156
x void discover_devices(struct lib_context *lc)
158
- returns != 0 in case it discovered all supported disks (IDE, SCSI)
159
and added them to a list
161
x void discover_raid_devices(struct lib_context *lc,
165
- discovers all suported RDs using the list filled by
166
discover_devices() and adds them to a list
168
x void discover_partitions(struct lib_context *lc);
170
- discovers all MSDOS partitions in active RAID sets and builds
171
RAID sets with one linear device hanging off for activation.
173
x int count_devices(struct lib_context *lc, enum dev_type type);
175
- returns number of devices found by discover_devices() and
176
discover_raid_devices() of specified type (eg, DEVICE, RAID, ...)
178
x int perform(struct lib_context *lc, char **argv);
180
- returns != 0 on success performing various actions
181
(ie. activation/deacivation of RAID sets, displaying properties, ...)
185
Tool calls the following high level function which hide
186
the details of the RAID set assembly:
188
x int group_set(struct lib_context *lc, char *name);
190
- returns != 0 on successfully grouping an RS/RSs
194
- don't activate non-RAID1 devices which have an invalid set check result
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:
204
x int activate_set(struct lib_context *lc, void *rs)
206
- returns != 0 in case of successfull RAID set activation
209
- activate MSDOS partitioned RAID sets as in 2+3
214
- check if a partitioned RAID set is active and deactivate it first
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)
220
x int deactivate_set(struct lib_context *lc, void *rs)
222
- returns != 0 in case of successfull RAID set deactivation
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
233
x void display_devices(struct lib_context *lc, enum dev_type type);
235
- display devices of dev_type 'type' (eg, RAID, DEVICE, ...)
237
x void display_set(struct lib_context *lc, void *rs,
238
enum active_type type, int top);
240
- display RS of active_type 'type' (ACTIVE, INACTIVE, ALL)
252
| |-/format ---/ataraid
267
o enhance write support to update ondisk metadata
268
- to restore metadata backups
269
- to record disk failures
271
o support to log state (eg, sector failures) in standard/vendor ondisk logs;
272
needs above write support
274
o status daemon to monitor RAID set sanity
275
(eg, disk failure, hot spare rebuild, ...) and
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) ?