mdadm-0.7.1
Neil Brown
22 years ago
0 | ||
0 | Changed Prior to 0.8 release | |
1 | - update mdadm.spec | |
2 | - use BLKGETSIZE64 if available for array size | |
3 | - give human readable as GiB/MiB and GB and MB, with 2 decimal point precision | |
4 | - Only warn about size variation for raid1/4/5. | |
5 | - Started md.4 man page | |
6 | - Started mdadm.conf.5 man page | |
7 | ||
1 | 8 | Changes Prior to 0.7 release |
2 | 9 | |
3 | 10 | - Fix makefile to install binary at /sbin and not /sbin/sbin |
192 | 192 | if (verbose && level>0) |
193 | 193 | fprintf(stderr, Name ": size set to %dK\n", size); |
194 | 194 | } |
195 | if ((maxsize-size)*100 > maxsize) { | |
195 | if (level >= 1 && ((maxsize-size)*100 > maxsize)) { | |
196 | 196 | fprintf(stderr, Name ": largest drive (%s) exceed size (%dK) by more than 1%\n", |
197 | 197 | maxdisc, size); |
198 | 198 | warn = 1; |
80 | 80 | if (brief) |
81 | 81 | printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks ); |
82 | 82 | else { |
83 | int array_size; | |
84 | if (ioctl(fd, BLKGETSIZE, &array_size)) | |
85 | array_size = 0; | |
86 | else array_size>>= 1; | |
83 | long array_size; | |
84 | long long larray_size; | |
85 | if (ioctl(fd, BLKGETSIZE64, &larray_size)==0) | |
86 | ; | |
87 | else if (ioctl(fd, BLKGETSIZE, &array_size)==0) | |
88 | larray_size = array_size<<9; | |
89 | else larray_size = 0; | |
90 | ||
87 | 91 | printf("%s:\n", dev); |
88 | 92 | printf(" Version : %02d.%02d.%02d\n", |
89 | 93 | array.major_version, array.minor_version, array.patch_version); |
90 | 94 | atime = array.ctime; |
91 | 95 | printf(" Creation Time : %.24s\n", ctime(&atime)); |
92 | 96 | printf(" Raid Level : %s\n", c?c:"-unknown-"); |
93 | if (array_size) | |
94 | printf(" Array Size : %d%s\n", array_size, human_size(array_size)); | |
97 | if (larray_size) | |
98 | printf(" Array Size : %ld%s\n", (long)(larray_size>>10), human_size(larray_size)); | |
95 | 99 | if (array.level >= 1) |
96 | printf(" Device Size : %d%s\n", array.size, human_size(array.size)); | |
100 | printf(" Device Size : %d%s\n", array.size, human_size((long long)array.size<<10)); | |
97 | 101 | printf(" Raid Disks : %d\n", array.raid_disks); |
98 | 102 | printf(" Total Disks : %d\n", array.nr_disks); |
99 | 103 | printf("Preferred Minor : %d\n", array.md_minor); |
153 | 153 | printf(" Creation Time : %.24s\n", ctime(&atime)); |
154 | 154 | c=map_num(pers, super.level); |
155 | 155 | printf(" Raid Level : %s\n", c?c:"-unknown-"); |
156 | printf(" Device Size : %d%s\n", super.size, human_size(super.size)); | |
156 | printf(" Device Size : %d%s\n", super.size, human_size((long long)super.size<<10)); | |
157 | 157 | printf(" Raid Disks : %d\n", super.raid_disks); |
158 | 158 | printf(" Total Disks : %d\n", super.nr_disks); |
159 | 159 | printf("Preferred Minor : %d\n", super.md_minor); |
36 | 36 | |
37 | 37 | OBJS = mdadm.o config.o ReadMe.o util.o Manage.o Assemble.o Build.o Create.o Detail.o Examine.o Monitor.o dlink.o Kill.o |
38 | 38 | |
39 | all : mdadm mdadm.man | |
39 | all : mdadm mdadm.man md.man mdadm.conf.man | |
40 | 40 | |
41 | 41 | mdadm : $(OBJS) |
42 | 42 | $(CC) -o mdadm $^ |
43 | 43 | |
44 | 44 | mdadm.man : mdadm.8 |
45 | 45 | nroff -man mdadm.8 > mdadm.man |
46 | ||
47 | md.man : md.4 | |
48 | nroff -man md.4 > md.man | |
49 | ||
50 | mdadm.conf.man : mdadm.conf.5 | |
51 | nroff -man mdadm.conf.5 > mdadm.conf.man | |
46 | 52 | |
47 | 53 | $(OBJS) : mdadm.h |
48 | 54 |
28 | 28 | |
29 | 29 | #include "mdadm.h" |
30 | 30 | |
31 | char Version[] = Name " - v0.7 - 8 March 2002\n"; | |
31 | char Version[] = Name " - v0.7.1 - 8 March 2002\n"; | |
32 | 32 | /* |
33 | 33 | * File: ReadMe.c |
34 | 34 | * |
0 | 0 | |
1 | 1 | |
2 | 2 | ?? Allow -S /dev/md? - current complains subsequent not a/d/r |
3 | ||
4 | * new "Query" mode to subsume --detail and --examine. | |
5 | --query or -Q, takes a device and tells if it is an MD device, | |
6 | and also tells in a raid superblock is found. | |
3 | 7 | |
4 | 8 | * write proc.c to parse /proc/mdstat file, and maybe /proc/partitions too. |
5 | 9 | Build list of arrays: name, rebuild-percent |
7 | 7 | fi |
8 | 8 | set `grep '^char Version' ReadMe.c ` |
9 | 9 | version=`echo $7 | sed 's/v//'` |
10 | grep "^Version: $version$" mdadm.spec > /dev/null 2>&1 || | |
11 | { | |
12 | echo mdadm.conf does not mention version $version. | |
13 | exit 1 | |
14 | } | |
10 | 15 | echo version = $version |
11 | 16 | base=mdadm-$version.tgz |
12 | 17 | if [ -f $target/$base ] |
0 | .TH MD 4 | |
1 | .SH NAME | |
2 | md \- Multiple Device driver aka Linux Software Raid | |
3 | .SH SYNOPSIS | |
4 | .BI /dev/md n | |
5 | .br | |
6 | .BI /dev/md/ n | |
7 | .SH DESCRIPTION | |
8 | The | |
9 | .B md | |
10 | driver provides virtual devices that are created from one or more | |
11 | independant underlying devices. This array of devices often contains | |
12 | redundancy, and hence the acronym RAID which stands for a Redundant | |
13 | Array of Independant Devices. | |
14 | .PP | |
15 | .B md | |
16 | support RAID levels 1 (mirroring) 4 (striped array with parity device) and 5 | |
17 | (striped array with distributed parity information. If a single underlying | |
18 | device fails while using one of these level, they array will continue | |
19 | to function. | |
20 | .PP | |
21 | .B md | |
22 | also supports a number of pseudo RAID (non-redundant) configuations | |
23 | including RAID0 (striped array), LINEAR (catenated array) and | |
24 | MULTIPATH (a set of different interfaces to the same device). | |
25 | ||
26 | .SS RAID SUPER BLOCK | |
27 | With the exception of Legacy Arrays described below, each device that | |
28 | is incorportated into an MD array has a | |
29 | .I super block | |
30 | written towards the end of the device. This superblock records | |
31 | information about the structure and state of the array so that the | |
32 | array an be reliably re-assembled after a shutdown. | |
33 | ||
34 | The superblock is 4K long and is written into a 64K aligned block that | |
35 | start at least 64K and less than 128K from the end of the device | |
36 | (i.e. to get the address of the superblock round the size of the | |
37 | device down to a multiple of 64K and then subtract 64K). | |
38 | The available size of each device is the ammount of space before the | |
39 | super block, so between 64K and 128K is lost when a device in | |
40 | incorporated into an MD array. | |
41 | ||
42 | The superblock contains, among other things: | |
43 | .TP | |
44 | LEVEL | |
45 | The | |
46 | .TP | |
47 | UUID | |
48 | a 128 bit Universally Unique Identifier that identifies the array that | |
49 | this device is part of. | |
50 | ||
51 | .SS LINEAR | |
52 | .SS RAID0 | |
53 | .SS RAID1 | |
54 | .SS RAID4 | |
55 | .SS RAID5 | |
56 | .SS REBUILD/RESYNC | |
57 | .SH FILES | |
58 | .TP | |
59 | .B /proc/mdstat | |
60 | Contains information about the status of currently running array. | |
61 | .TP | |
62 | .B /proc/sys/dev/raid/speed_limit_min | |
63 | A readable and writable file that reflects the current goal rebuild | |
64 | speed for times when non-rebuild activity is current on an array. | |
65 | The speed is in Kibibytes per second, and is a per-device rate, not a | |
66 | per-array rate (which means that an array with more disc will shuffle | |
67 | more data for a given speed). The default is 100. | |
68 | ||
69 | .TP | |
70 | .B /proc/sys/dev/raid/speed_limit_max | |
71 | A readable and writable file that reflects the current goal rebuild | |
72 | speed for times when no non-rebuild activity is current on an array. | |
73 | The default is 100,000. | |
74 | ||
75 | .SH SEE ALSO | |
76 | .BR mdadm (8), | |
77 | .BR mkraid (8). |
0 | MD(4) MD(4) | |
1 | ||
2 | ||
3 | ||
4 | NNAAMMEE | |
5 | md - Multiple Device driver aka Linux Software Raid | |
6 | ||
7 | SSYYNNOOPPSSIISS | |
8 | //ddeevv//mmdd_n | |
9 | //ddeevv//mmdd//_n | |
10 | ||
11 | DDEESSCCRRIIPPTTIIOONN | |
12 | The mmdd driver provides virtual devices that are created | |
13 | from one or more independant underlying devices. This | |
14 | array of devices often contains redundancy, and hence the | |
15 | acronym RAID which stands for a Redundant Array of Inde- | |
16 | pendant Devices. | |
17 | ||
18 | mmdd support RAID levels 1 (mirroring) 4 (striped array with | |
19 | parity device) and 5 (striped array with distributed par- | |
20 | ity information. If a single underlying device fails | |
21 | while using one of these level, they array will continue | |
22 | to function. | |
23 | ||
24 | mmdd also supports a number of pseudo RAID (non-redundant) | |
25 | configuations including RAID0 (striped array), LINEAR | |
26 | (catenated array) and MULTIPATH (a set of different inter- | |
27 | faces to the same device). | |
28 | ||
29 | ||
30 | RRAAIIDD SSUUPPEERR BBLLOOCCKK | |
31 | With the exception of Legacy Arrays described below, each | |
32 | device that is incorportated into an MD array has a _s_u_p_e_r | |
33 | _b_l_o_c_k written towards the end of the device. This | |
34 | superblock records information about the structure and | |
35 | state of the array so that the array an be reliably re- | |
36 | assembled after a shutdown. | |
37 | ||
38 | The superblock is 4K long and is written into a 64K | |
39 | aligned block that start at least 64K and less than 128K | |
40 | from the end of the device (i.e. to get the address of the | |
41 | superblock round the size of the device down to a multiple | |
42 | of 64K and then subtract 64K). The available size of each | |
43 | device is the ammount of space before the super block, so | |
44 | between 64K and 128K is lost when a device in incorporated | |
45 | into an MD array. | |
46 | ||
47 | The superblock contains, among other things: | |
48 | ||
49 | LEVEL The | |
50 | ||
51 | UUID a 128 bit Universally Unique Identifier that iden- | |
52 | tifies the array that this device is part of. | |
53 | ||
54 | ||
55 | LLIINNEEAARR | |
56 | RRAAIIDD00 | |
57 | RRAAIIDD11 | |
58 | RRAAIIDD44 | |
59 | RRAAIIDD55 | |
60 | RREEBBUUIILLDD//RREESSYYNNCC | |
61 | FFIILLEESS | |
62 | //pprroocc//mmddssttaatt | |
63 | Contains information about the status of currently | |
64 | running array. | |
65 | ||
66 | //pprroocc//ssyyss//ddeevv//rraaiidd//ssppeeeedd__lliimmiitt__mmiinn | |
67 | A readable and writable file that reflects the cur- | |
68 | rent goal rebuild speed for times when non-rebuild | |
69 | activity is current on an array. The speed is in | |
70 | Kibibytes per second, and is a per-device rate, not | |
71 | a per-array rate (which means that an array with | |
72 | more disc will shuffle more data for a given | |
73 | speed). The default is 100. | |
74 | ||
75 | ||
76 | //pprroocc//ssyyss//ddeevv//rraaiidd//ssppeeeedd__lliimmiitt__mmaaxx | |
77 | A readable and writable file that reflects the cur- | |
78 | rent goal rebuild speed for times when no non- | |
79 | rebuild activity is current on an array. The | |
80 | default is 100,000. | |
81 | ||
82 | ||
83 | SSEEEE AALLSSOO | |
84 | mmddaaddmm(8), mmkkrraaiidd(8). | |
85 | ||
86 | ||
87 | ||
88 | MD(4) |
568 | 568 | http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/ |
569 | 569 | .URk |
570 | 570 | .PP |
571 | .BR mdadm.conf (5), | |
572 | .BR md (4). | |
573 | .PP | |
571 | 574 | .IR raidtab (5), |
572 | 575 | .IR raid0run (8), |
573 | 576 | .IR raidstop (8), |
238 | 238 | } |
239 | 239 | switch(level) { |
240 | 240 | default: |
241 | fprintf(stderr, Name ": layout now meaningful for %s arrays.\n", | |
241 | fprintf(stderr, Name ": layout not meaningful for %s arrays.\n", | |
242 | 242 | map_num(pers, level)); |
243 | 243 | exit(2); |
244 | 244 | case -10: |
0 | # mdadm configuration file | |
1 | # | |
2 | # mdadm will function properly without the use of a configuration file, | |
3 | # but this file is useful for keeping track of arrays and member disks. | |
4 | # In general, a mdadm.conf file is created, and updated, after arrays | |
5 | # are created. This is the opposite behavior of /etc/raidtab which is | |
6 | # created prior to array construction. | |
7 | # | |
8 | # | |
9 | # the config file takes two types of lines: | |
10 | # | |
11 | # DEVICE lines specify a list of devices of where to look for | |
12 | # potential member disks | |
13 | # | |
14 | # ARRAY lines specify information about how to identify arrays so | |
15 | # so that they can be activated | |
16 | # | |
17 | # You can have more than one device line and use wild cards. The first | |
18 | # example includes SCSI the first partition of SCSI disks /dev/sdb, | |
19 | # /dev/sdc, /dev/sdd, /dev/sdj, /dev/sdk, and /dev/sdl. The second | |
20 | # line looks for array slices on IDE disks. | |
21 | # | |
22 | #DEVICE /dev/sd[bcdjkl]1 | |
23 | #DEVICE /dev/hda1 /dev/hdb1 | |
24 | # | |
25 | # | |
26 | # | |
27 | # ARRAY lines specify an array to assemble and a method of identification. | |
28 | # Arrays can currently be identified by using a UUID, superblock minor number, | |
29 | # or a listing of devices. | |
30 | # | |
31 | # super-minor is usally the minor number of the metadevice | |
32 | # UUID is the Universally Unique Identifier for the array | |
33 | # Each can be obtained using | |
34 | # | |
35 | # mdadm -D <md> | |
36 | # | |
37 | #ARRAY /dev/md0 UUID=3aaa0122:29827cfa:5331ad66:ca767371 | |
38 | #ARRAY /dev/md1 superminor=1 | |
39 | #ARRAY /dev/md2 devices=/dev/hda1,/dev/hda2 |
0 | .TH MDADM.CONF 5 | |
1 | .SH NAME | |
2 | mdadm.conf \- configuration for management of Software Raid with mdadm | |
3 | .SH SYNOPSIS | |
4 | /etc/mdadm.conf | |
5 | .SH DESCRIPTION | |
6 | .PP | |
7 | .B mdadm | |
8 | is a tools for creating an managing RAID devices using the | |
9 | .B md | |
10 | driver in Linux. | |
11 | .PP | |
12 | Some common tasks, such as assembling all arrays, can be simplified | |
13 | by describing the devices and array in this configuations file. | |
14 | ||
15 | .SS SYNTAX | |
16 | The file should be seen as a collection of words separated by white | |
17 | space (space, tab, or newline). | |
18 | Any word that being with a hash sign (#) starts a comment and that | |
19 | word together with the remainder of the line are ignored. | |
20 | ||
21 | Any line that start with white space (space or tab) is treated as | |
22 | though it were a continuation of the previous line. | |
23 | ||
24 | Empty lines are ignored, but otherwise each (non continuation) line | |
25 | must start with a keyword as listed below. The key words are case | |
26 | insensitve and can be abbreviated to 3 characters. | |
27 | ||
28 | The keywords are: | |
29 | .TP | |
30 | .B DEVICE | |
31 | A | |
32 | .B device | |
33 | line lists the devices (whole devices or partitions) that might contain | |
34 | a component of an MD array. When looking for the components of an | |
35 | array, | |
36 | .B mdadm | |
37 | will scan these devices and no others. | |
38 | ||
39 | The | |
40 | .B device | |
41 | line may contain a number of different devices (separated by spaces) | |
42 | and each device name can contain wild cards as defined by | |
43 | .BR glob (7). | |
44 | ||
45 | Also, there may be several device lines present in the file. | |
46 | ||
47 | .TP | |
48 | .B ARRAY | |
49 | ||
50 | .SH SEE ALSO | |
51 | mdadm (8), | |
52 | md (4). | |
53 |
0 | MDADM.CONF(5) MDADM.CONF(5) | |
1 | ||
2 | ||
3 | ||
4 | NNAAMMEE | |
5 | mdadm.conf - configuration for management of Software Raid | |
6 | with mdadm | |
7 | ||
8 | SSYYNNOOPPSSIISS | |
9 | /etc/mdadm.conf | |
10 | ||
11 | DDEESSCCRRIIPPTTIIOONN | |
12 | mmddaaddmm is a tools for creating an managing RAID devices | |
13 | using the mmdd driver in Linux. | |
14 | ||
15 | Some common tasks, such as assembling all arrays, can be | |
16 | simplified by describing the devices and array in this | |
17 | configuations file. | |
18 | ||
19 | ||
20 | SSYYNNTTAAXX | |
21 | The file should be seen as a collection of words separated | |
22 | by white space (space, tab, or newline). Any word that | |
23 | being with a hash sign (#) starts a comment and that word | |
24 | together with the remainder of the line are ignored. | |
25 | ||
26 | Any line that start with white space (space or tab) is | |
27 | treated as though it were a continuation of the previous | |
28 | line. | |
29 | ||
30 | Empty lines are ignored, but otherwise each (non continua- | |
31 | tion) line must start with a keyword as listed below. The | |
32 | key words are case insensitve and can be abbreviated to 3 | |
33 | characters. | |
34 | ||
35 | The keywords are: | |
36 | ||
37 | DDEEVVIICCEE A ddeevviiccee line lists the devices (whole devices or | |
38 | partitions) that might contain a component of an MD | |
39 | array. When looking for the components of an | |
40 | array, mmddaaddmm will scan these devices and no others. | |
41 | ||
42 | The ddeevviiccee line may contain a number of different | |
43 | devices (separated by spaces) and each device name | |
44 | can contain wild cards as defined by gglloobb(7). | |
45 | ||
46 | Also, there may be several device lines present in | |
47 | the file. | |
48 | ||
49 | ||
50 | AARRRRAAYY | |
51 | ||
52 | SSEEEE AALLSSOO | |
53 | mdadm (8), md (4). | |
54 | ||
55 | ||
56 | ||
57 | ||
58 | MDADM.CONF(5) |
44 | 44 | #include <linux/fs.h> |
45 | 45 | #include <sys/ioctl.h> |
46 | 46 | #define MD_MAJOR 9 |
47 | ||
48 | /* I seem to need this to make BLKGETSIZE64 to work... */ | |
49 | #define u64 __u64 | |
47 | 50 | |
48 | 51 | |
49 | 52 | #include "md_u.h" |
148 | 151 | extern mddev_ident_t conf_get_ident(char *, char*); |
149 | 152 | extern mddev_dev_t conf_get_devs(char *); |
150 | 153 | |
151 | extern char *human_size(long kbytes); | |
154 | extern char *human_size(long long bytes); |
0 | mdadm(8) mdadm(8) | |
1 | ||
2 | ||
3 | ||
4 | NNAAMMEE | |
5 | mdadm - manage MD devices _a_k_a Linux Software Raid. | |
6 | ||
7 | ||
8 | SSYYNNOOPPSSIISS | |
9 | mmddaaddmm _[_m_o_d_e_] _<_r_a_i_d_d_e_v_i_c_e_> _[_o_p_t_i_o_n_s_] _<_s_u_b_d_e_v_i_c_e_s_> | |
10 | ||
11 | ||
12 | DDEESSCCRRIIPPTTIIOONN | |
13 | RAID devices are virtual devices created from two or more | |
14 | real block devices. This allows multiple devices (typi- | |
15 | cally disk drives or partitions there-of) to be combined | |
16 | into a single device to hold (for example) a single | |
17 | filesystem. Some RAID levels included redundancy and so | |
18 | can survive some degree of device failure. | |
19 | ||
20 | Linux Software RAID devices are implemented through the md | |
21 | (Multiple Devices) device driver. | |
22 | ||
23 | Currently, Linux supports LLIINNEEAARR md devices, RRAAIIDD00 (strip- | |
24 | ing), RRAAIIDD11 (mirroring), RRAAIIDD44 and RRAAIIDD55.. | |
25 | ||
26 | Recent kernels (2002) also support a mode known as MMUULLTTII-- | |
27 | PPAATTHH. mmddaaddmm does not support MULTIPATH as yet. | |
28 | ||
29 | mmddaaddmm is a program that can be used to create and manage | |
30 | MD devices. As such it provides a similar set of func- | |
31 | tionality to the rraaiiddttoooollss packages. The key differences | |
32 | between mmddaaddmm and rraaiiddttoooollss are: | |
33 | ||
34 | +o mmddaaddmm is a single program and not a collection of pro- | |
35 | grams. | |
36 | ||
37 | +o mmddaaddmm can perform (almost) all of its functions with- | |
38 | out having a configuration file. Also mdadm helps | |
39 | with management of the configuration file. | |
40 | ||
41 | +o mmddaaddmm can provide information about your arrays | |
42 | (through Detail and Examine) that rraaiiddttoooollss cannot. | |
43 | ||
44 | +o rraaiiddttoooollss can manage MULTIPATH devices which mmddaaddmm | |
45 | cannot yet manage. | |
46 | ||
47 | ||
48 | MMOODDEESS | |
49 | mdadm has 7 major modes of operation: | |
50 | ||
51 | AAsssseemmbbllee | |
52 | Assemble the parts of a previously created array | |
53 | into an active array. Components can be explicitly | |
54 | given or can be searched for. mmddaaddmm checks that | |
55 | the components do form a bona fide array, and can, | |
56 | on request, fiddle superblock information so as to | |
57 | assemble a faulty array. | |
58 | ||
59 | ||
60 | BBuuiilldd Build a legacy array without per-device | |
61 | superblocks. | |
62 | ||
63 | ||
64 | CCrreeaattee Create a new array with per-device superblocks. | |
65 | ||
66 | ||
67 | DDeettaaiill Display the details of a given md device. Details | |
68 | include the RAID level, the number of devices, | |
69 | which ones are faulty (if any), and the array UUID. | |
70 | ||
71 | ||
72 | EExxaammiinnee | |
73 | Examine a device to see if it is part of an md | |
74 | array, and print out the details of that array. | |
75 | This mode can also be used to examine a large num- | |
76 | ber of devices and to print out a summary of the | |
77 | arrays found in a format suitable for the | |
78 | mmddaaddmm..ccoonnff configuration file. | |
79 | ||
80 | ||
81 | FFoollllooww oorr MMoonniittoorr | |
82 | Monitor one or more md devices and act on any state | |
83 | changes. | |
84 | ||
85 | ||
86 | MMaannaaggee This is for odd bits an pieces like hotadd, | |
87 | hotremove, setfaulty, stop, readonly, readwrite. | |
88 | ||
89 | ||
90 | OOPPTTIIOONNSS | |
91 | Available options are: | |
92 | ||
93 | ||
94 | --AA, ----aasssseemmbbllee | |
95 | Assemble an existing array. | |
96 | ||
97 | ||
98 | --BB, ----bbuuiilldd | |
99 | Build a legacy array without superblocks. | |
100 | ||
101 | ||
102 | --CC, ----ccrreeaattee | |
103 | Create a new array. | |
104 | ||
105 | ||
106 | --DD, ----ddeettaaiill | |
107 | Print detail of one or more md devices. | |
108 | ||
109 | ||
110 | --EE, ----eexxaammiinnee | |
111 | Print content of md superblock on device(s). | |
112 | ||
113 | ||
114 | --FF, ----ffoollllooww, ----mmoonniittoorr | |
115 | Select MMoonniittoorr mode. | |
116 | ||
117 | ||
118 | --hh, ----hheellpp | |
119 | Display help message or, after above option, mode | |
120 | specific help message. | |
121 | ||
122 | ||
123 | --VV, ----vveerrssiioonn | |
124 | Print version information for mdadm. | |
125 | ||
126 | ||
127 | --vv, ----vveerrbboossee | |
128 | Be more verbose about what is happening. | |
129 | ||
130 | ||
131 | --bb, ----bbrriieeff | |
132 | Be less verbose. This is used with ----ddeettaaiill and | |
133 | ----eexxaammiinnee. | |
134 | ||
135 | ||
136 | FFoorr ccrreeaattee oorr bbuuiilldd:: | |
137 | --cc, ----cchhuunnkk== | |
138 | Specify chunk size of kibibytes. The default is | |
139 | 64. | |
140 | ||
141 | ||
142 | ----rroouunnddiinngg== | |
143 | Specify rounding factor for linear array (==chunk | |
144 | size) | |
145 | ||
146 | ||
147 | --ll, ----lleevveell== | |
148 | Set raid level. Options are: linear, raid0, 0, | |
149 | stripe, raid1, 1, mirror, raid5, 4, raid5, 5. | |
150 | Obviously some of these are synonymous. Only the | |
151 | first 4 are valid when Building. | |
152 | ||
153 | ||
154 | --pp, ----ppaarriittyy== | |
155 | Set raid5 parity algorithm. Options are: | |
156 | {left,right}-{,a}symmetric, la, ra, ls, rs. The | |
157 | default is left-symmetric. | |
158 | ||
159 | ||
160 | ----llaayyoouutt== | |
161 | same as --parity | |
162 | ||
163 | ||
164 | --nn, ----rraaiidd--ddiisskkss== | |
165 | number of active devices in array. | |
166 | ||
167 | ||
168 | --xx, ----ssppaarree--ddiisskkss== | |
169 | number of spare (eXtra) disks in initial array. | |
170 | Spares can be added and removed later. | |
171 | ||
172 | ||
173 | --zz, ----ssiizzee== | |
174 | Amount (in Kibibytes) of space to use from each | |
175 | drive in RAID1/4/5. This must be a multiple of the | |
176 | chunk size, and must leave about 128Kb of space at | |
177 | the end of the drive for the RAID superblock. If | |
178 | this is not specified (as it normally is not) the | |
179 | smallest drive (or partition) sets the size, though | |
180 | if there is a variance among the drives of greater | |
181 | than 1%, a warning is issued. | |
182 | ||
183 | ||
184 | FFoorr aasssseemmbbllee:: | |
185 | --uu, ----uuuuiidd== | |
186 | uuid of array to assemble. Devices which don't have | |
187 | this uuid are excluded | |
188 | ||
189 | ||
190 | --mm, ----ssuuppeerr--mmiinnoorr== | |
191 | Minor number of device that array was created for. | |
192 | Devices which don't have this minor number are | |
193 | excluded. If you create an array as /dev/md1, then | |
194 | all superblock will contain the minor number 1, | |
195 | even if the array is later assembled as /dev/md2. | |
196 | ||
197 | ||
198 | --cc, ----ccoonnffiigg== | |
199 | config file. Default is //eettcc//mmddaaddmm..ccoonnff. | |
200 | ||
201 | ||
202 | --ss, ----ssccaann | |
203 | scan config file for missing information | |
204 | ||
205 | ||
206 | --ff, ----ffoorrccee | |
207 | Assemble the array even if some superblocks appear | |
208 | out-of-date | |
209 | ||
210 | ||
211 | --RR, ----rruunn | |
212 | Attempt to start the array even if fewer drives | |
213 | were given than are needed for a full array. Nor- | |
214 | mally if not all drives are found and ----ssccaann is not | |
215 | used, then the array will be assembled but not | |
216 | started. With ----rruunn an attempt will be made to | |
217 | start it anyway. | |
218 | ||
219 | ||
220 | GGeenneerraall mmaannaaggeemmeenntt | |
221 | --aa, ----aadddd | |
222 | hotadd listed devices. | |
223 | ||
224 | ||
225 | --rr, ----rreemmoovvee | |
226 | remove listed devices. The must not be active. | |
227 | i.e. they should be failed or spare devices. | |
228 | ||
229 | ||
230 | --ff, ----ffaaiill | |
231 | mark listed devices as faulty. | |
232 | ||
233 | ||
234 | ----sseett--ffaauullttyy | |
235 | same as --fail. | |
236 | ||
237 | ||
238 | --RR, ----rruunn | |
239 | start a partially built array. | |
240 | ||
241 | ||
242 | --SS, ----ssttoopp | |
243 | deactivate array, releasing all resources. | |
244 | ||
245 | ||
246 | --oo, ----rreeaaddoonnllyy | |
247 | mark array as readonly. | |
248 | ||
249 | ||
250 | --ww, ----rreeaaddwwrriittee | |
251 | mark array as readwrite. | |
252 | ||
253 | ||
254 | ||
255 | AASSSSEEMMBBLLYY MMOODDEE | |
256 | Usage: mmddaaddmm ----aasssseemmbbllee _d_e_v_i_c_e _o_p_t_i_o_n_s_._._. | |
257 | ||
258 | Usage: mmddaaddmm ----aasssseemmbbllee ----ssccaann _o_p_t_i_o_n_s_._._. | |
259 | ||
260 | ||
261 | This usage assembles one or more raid arrays from pre- | |
262 | existing components. For each array, mdadm needs to know | |
263 | the md device, the identity of the array, and a number of | |
264 | sub devices. These can be found in a number of ways. | |
265 | ||
266 | The md device is either given before ----ssccaann or is found | |
267 | from the config file. In the latter case, multiple md | |
268 | devices can be started with a single mdadm command. | |
269 | ||
270 | The identity can be given with the ----uuuuiidd option, with the | |
271 | ----ssuuppeerr--mmiinnoorr option, can be found in in the config file, | |
272 | or will be taken from the super block on the first subde- | |
273 | vice listed on the command line. | |
274 | ||
275 | Devices can be given on the ----aasssseemmbbllee command line or | |
276 | from the config file. Only devices which have an md | |
277 | superblock which contains the right identity will be con- | |
278 | sidered for any device. | |
279 | ||
280 | The config file is only used if explicitly named with | |
281 | ----ccoonnffiigg or requested with ----ssccaann.. In the later case, | |
282 | //eettcc//mmddaaddmm..ccoonnff is used. | |
283 | ||
284 | If ----ssccaann is not given, then the config file will only be | |
285 | used to find the identity of md arrays. | |
286 | ||
287 | Normally the array will be started after it is assembled. | |
288 | However is ----ssccaann is not given and insufficient drives | |
289 | were lists to start a complete (non-degraded) array, then | |
290 | the array is not started (to guard against usage errors). | |
291 | To insist that the array be started in this case (as may | |
292 | work for RAID1 or RAID5), give the ----rruunn flag. | |
293 | ||
294 | ||
295 | ||
296 | BBUUIILLDD MMOODDEE | |
297 | Usage: mmddaaddmm ----bbuuiilldd _d_e_v_i_c_e ----cchhuunnkk==_X ----lleevveell==_Y ----rraaiidd-- | |
298 | ddiisskkss==_Z _d_e_v_i_c_e_s | |
299 | ||
300 | ||
301 | This usage is similar to ----ccrreeaattee. The difference is that | |
302 | it creates a legacy array without a superblock. With these | |
303 | arrays there is no difference between initially creating | |
304 | the array and subsequently assembling the array, except | |
305 | that hopefully there is useful data there in the second | |
306 | case. | |
307 | ||
308 | The level may only be 0, raid0, or linear. All devices | |
309 | must be listed and the array will be started once com- | |
310 | plete. | |
311 | ||
312 | ||
313 | CCRREEAATTEE MMOODDEE | |
314 | Usage: mmddaaddmm ----ccrreeaattee _d_e_v_i_c_e ----cchhuunnkk==_X ----lleevveell==_Y | |
315 | ----rraaiidd--ddiisskkss==_Z _d_e_v_i_c_e_s | |
316 | ||
317 | ||
318 | This usage will initialise a new md array, associate some | |
319 | devices with it, and activate the array. | |
320 | ||
321 | As devices are added, they are checked to see if they con- | |
322 | tain raid superblocks or filesystems. They are also check | |
323 | to see if the variance in device size exceeds 1%. | |
324 | ||
325 | If any discrepancy is found, the array will not automati- | |
326 | cally be run, though the presence of a ----rruunn can override | |
327 | this caution. | |
328 | ||
329 | ||
330 | The General Management options that are valid with --cre- | |
331 | ate are: | |
332 | ||
333 | ----rruunn insist of running the array even if some devices | |
334 | look like they might be in use. | |
335 | ||
336 | ||
337 | ----rreeaaddoonnllyy | |
338 | start the array readonly - not supported yet. | |
339 | ||
340 | ||
341 | DDEETTAAIILL MMOODDEE | |
342 | Usage: mmddaaddmm ----ddeettaaiill [----bbrriieeff] _d_e_v_i_c_e _._._. | |
343 | ||
344 | ||
345 | This usage sill print out the details of the given array | |
346 | including a list of component devices. To determine names | |
347 | for the devices, mmddaaddmm searches //ddeevv for device files with | |
348 | the right major and minor numbers. | |
349 | ||
350 | With ----bbrriieeff mmddaaddmm prints a single line that identifies | |
351 | the level, number of disks, and UUID of the array. This | |
352 | line is suitable for inclusion in //eettcc//mmddaaddmm..ccoonnff. | |
353 | ||
354 | ||
355 | EEXXAAMMIINNEE MMOODDEE | |
356 | Usage: mmddaaddmm ----eexxaammiinnee [----ssccaann] [----bbrriieeff] _d_e_v_i_c_e _._._. | |
357 | ||
358 | This usage will examine some block devices to see if that | |
359 | have a valid RAID superblock on them. The information in | |
360 | each valid raid superblock will be printed. | |
361 | ||
362 | If ----ssccaann is used, the no devices should be listed, and | |
363 | the complete set of devices identified in the configura- | |
364 | tion file are checked. ----ssccaann implies ----bbrriieeff but this | |
365 | implication can be countered by specifying ----vveerrbboossee. | |
366 | ||
367 | With ----bbrriieeff mmddaaddmm will output an config file entry of | |
368 | each distinct array that was found. This entry will list | |
369 | the UUID, the raid level, and a list of the individual | |
370 | devices on which a superblock for that array was found. | |
371 | This output will by syntactically suitable for inclusion | |
372 | in the configuration file, but should NNOOTT be used blindly. | |
373 | Often the array description that you want in the configu- | |
374 | ration file is much less specific than that given by mmddaaddmm | |
375 | --BBss. For example, you normally do not want to list the | |
376 | devices, particularly if they are SCSI devices. | |
377 | ||
378 | ||
379 | ||
380 | FFIILLEESS | |
381 | //pprroocc//mmddssttaatt | |
382 | If you're using the //pprroocc filesystem, //pprroocc//mmddssttaatt gives | |
383 | you informations about md devices status. This file is | |
384 | not currently used by mmddaaddmm. | |
385 | ||
386 | ||
387 | //eettcc//mmddaaddmm..ccoonnff | |
388 | The config file is line oriented with, as usual, blank | |
389 | lines and lines beginning with a hash (or pound sign or | |
390 | sharp or number sign, whichever you like to call it) | |
391 | ignored. Lines that start with a blank are treated as | |
392 | continuations of the previous line (I don't like trailing | |
393 | slashes). | |
394 | ||
395 | Each line contains a sequence of space-separated words, | |
396 | the first of which identified the type of line. Keywords | |
397 | are case-insensitive, and the first work on a line can be | |
398 | abbreviated to 3 letters. | |
399 | ||
400 | There are two types of lines. ARRAY and DEVICE. | |
401 | ||
402 | The DEVICE lines usually come first. All remaining words | |
403 | on the line are treated as names of devices, possibly con- | |
404 | taining wild cards (see _g_l_o_b(7)). These list all the | |
405 | devices that mmddaaddmm is allowed to scan when looking for | |
406 | devices with RAID superblocks. Each line can contain mul- | |
407 | tiple device names, and there can be multiple DEVICE | |
408 | lines. For example: | |
409 | ||
410 | DEVICE /dev/hda* /dev/hdc* | |
411 | DEV /dev/sd* | |
412 | DEVICE /dev/discs/disc*/disc | |
413 | ||
414 | The ARRAY lines identify actual arrays. The second word | |
415 | on the line should be the name of the device where the | |
416 | array is normally assembled, such as /dev/md1. Subsequent | |
417 | words identify the array. If multiple identities are | |
418 | given, then the array much match ALL identities to be con- | |
419 | sidered a match. Each identity word has a tag, and equals | |
420 | sign, and some value. The options are: | |
421 | ||
422 | ||
423 | uuuuiidd== The value should be a 128 bit uuid in hexadecimal, | |
424 | with punctuation interspersed if desired. This | |
425 | must match the uuid stored in the superblock. | |
426 | ||
427 | ssuuppeerr--mmiinnoorr== | |
428 | The value is an integer which indicates the minor | |
429 | number that was stored in the superblock when the | |
430 | array was created. When an array is created as | |
431 | /dev/mdX, then the minor number X is stored. | |
432 | ||
433 | ddeevviicceess== | |
434 | The value is a comma separated list of device | |
435 | names. Precisely these devices will be used to | |
436 | assemble the array. Note that the devices listed | |
437 | there must also be listed on a DEVICE line. | |
438 | ||
439 | lleevveell== The value is a raid level. This is normally used | |
440 | to identify an array, but is supported so that the | |
441 | output of mmddaaddmm ----eexxaammiinnee ----ssccaann can be use | |
442 | directly in the configuration file. | |
443 | ||
444 | ddiisskkss== The value is the number of disks in a complete | |
445 | active array. As with lleevveell== this is mainly for | |
446 | compatibility with the output of mmddaaddmm ----eexxaammiinnee | |
447 | ----ssccaann. | |
448 | ||
449 | ||
450 | TTOODDOO | |
451 | Finish and document Follow mode. | |
452 | ||
453 | ||
454 | SSEEEE AALLSSOO | |
455 | For information on the various levels of RAID, check out: | |
456 | ||
457 | ||
458 | http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/ | |
459 | ||
460 | for new releases of the RAID driver check out: | |
461 | ||
462 | ||
463 | ftp://ftp.kernel.org/pub/linux/kernel/peo- | |
464 | ple/mingo/raid-patches | |
465 | ||
466 | or | |
467 | ||
468 | http://www.cse.unsw.edu.au/~neilb/patches/linux- | |
469 | stable/ | |
470 | ||
471 | _r_a_i_d_t_a_b(5), _r_a_i_d_0_r_u_n(8), _r_a_i_d_s_t_o_p(8), _m_k_r_a_i_d(8) | |
472 | ||
473 | ||
474 | ||
475 | mdadm(8) |
0 | Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) | |
1 | Name: mdadm | |
2 | Version: 0.7.1 | |
3 | Release: 1 | |
4 | Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz | |
5 | URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/ | |
6 | Copyright: GPL | |
7 | Group: Utilities/System | |
8 | BuildRoot: /var/tmp/%{name}-root | |
9 | Packager: Danilo Godec <danci@agenda.si> | |
10 | ||
11 | %description | |
12 | mdadm is a single program that can be used to control Linux md devices. It | |
13 | is intended to provide all the functionality of the mdtools and raidtools | |
14 | but with a very different interface. | |
15 | ||
16 | mdadm can perform all functions without a configuration file. There is the | |
17 | option of using a configuration file, but not in the same way that raidtools | |
18 | uses one. | |
19 | ||
20 | raidtools uses a configuration file to describe how to create a RAID array, | |
21 | and also uses this file partially to start a previously created RAID array. | |
22 | Further, raidtools requires the configuration file for such things as | |
23 | stopping a raid array, which needs to know nothing about the array. | |
24 | ||
25 | ||
26 | %prep | |
27 | %setup -q | |
28 | ||
29 | %build | |
30 | # This is a debatable issue. The author of this RPM spec file feels that | |
31 | # people who install RPMs (especially given that the default RPM options | |
32 | # will strip the binary) are not going to be running gdb against the | |
33 | # program. | |
34 | make CFLAGS="$RPM_OPT_FLAGS" | |
35 | ||
36 | %install | |
37 | #rm -rf $RPM_BUILD_ROOT | |
38 | mkdir -p $RPM_BUILD_ROOT/sbin | |
39 | install -m755 mdadm $RPM_BUILD_ROOT/sbin/ | |
40 | mkdir -p $RPM_BUILD_ROOT/etc | |
41 | install -m644 mdadm.conf-example $RPM_BUILD_ROOT/etc/mdadm.conf | |
42 | mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man4 | |
43 | mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man5 | |
44 | mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8 | |
45 | install -m644 md.4 $RPM_BUILD_ROOT/%{_mandir}/man4/ | |
46 | install -m644 mdadm.conf.5 $RPM_BUILD_ROOT/%{_mandir}/man5/ | |
47 | install -m644 mdadm.8 $RPM_BUILD_ROOT/%{_mandir}/man8/ | |
48 | ||
49 | %clean | |
50 | rm -rf $RPM_BUILD_ROOT | |
51 | ||
52 | %files | |
53 | %defattr(-,root,root) | |
54 | %doc TODO ChangeLog mdadm.man mdadm.conf-example | |
55 | /sbin/mdadm | |
56 | /etc/mdadm.conf | |
57 | %{_mandir}/man*/md* | |
58 | ||
59 | %changelog | |
60 | * Wed Mar 12 2002 NeilBrown <neilb@cse.unsw.edu.au> | |
61 | - Add md.4 and mdadm.conf.5 man pages | |
62 | * Fri Mar 08 2002 Chris Siebenmann <cks@cquest.utoronto.ca> | |
63 | - builds properly as non-root. | |
64 | * Fri Mar 08 2002 Derek Vadala <derek@cynicism.com> | |
65 | - updated for 0.7, fixed /usr/share/doc and added manpage | |
66 | * Tue Aug 07 2001 Danilo Godec <danci@agenda.si> | |
67 | - initial RPM build |
0 | Summary: mdadm is used for controlling Linux md devices (aka RAID arrays) | |
1 | Name: mdadm | |
2 | Version: 0.5 | |
3 | Release: 1 | |
4 | Source0: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz | |
5 | URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/ | |
6 | Copyright: GPL | |
7 | Group: Utilities/System | |
8 | BuildRoot: /var/tmp/%{name}-root | |
9 | Packager: Danilo Godec <danci@agenda.si> | |
10 | ||
11 | %description | |
12 | mdadm is a single program that can be used to control Linux md devices. It | |
13 | is intended to provide all the functionality of the mdtools and raidtools | |
14 | but with a very different interface. | |
15 | ||
16 | mdadm can perform all functions without a configuration file. There is the | |
17 | option of using a configuration file, but not in the same way that raidtools | |
18 | uses one. | |
19 | ||
20 | raidtools uses a configuration file to describe how to create a RAID array, | |
21 | and also uses this file partially to start a previously created RAID array. | |
22 | Further, raidtools requires the configuration file for such things as | |
23 | stopping a raid array, which needs to know nothing about the array. | |
24 | ||
25 | ||
26 | %prep | |
27 | %setup -q -n mdadm | |
28 | ||
29 | %build | |
30 | make | |
31 | ||
32 | %install | |
33 | rm -rf $RPM_BUILD_ROOT | |
34 | mkdir -p $RPM_BUILD_ROOT/sbin | |
35 | install -m755 mdadm $RPM_BUILD_ROOT/sbin/ | |
36 | ||
37 | %clean | |
38 | rm -rf $RPM_BUILD_ROOT | |
39 | ||
40 | %files | |
41 | %doc TODO testconfig testconfig2 | |
42 | /sbin/* | |
43 | ||
44 | %changelog | |
45 | * Tue Aug 07 2001 Danilo Godec <danci@agenda.si> | |
46 | - initial RPM build |
411 | 411 | int calc_sb_csum(mdp_super_t *super) |
412 | 412 | { |
413 | 413 | unsigned int oldcsum = super->sb_csum; |
414 | unsigned long long newcsum = 0; /* FIXME why does this make it work?? */ | |
414 | unsigned long long newcsum = 0; | |
415 | 415 | unsigned long csum; |
416 | 416 | int i; |
417 | 417 | unsigned int *superc = (int*) super; |
424 | 424 | return csum; |
425 | 425 | } |
426 | 426 | |
427 | char *human_size(long kbytes) | |
427 | char *human_size(long long bytes) | |
428 | 428 | { |
429 | 429 | static char buf[30]; |
430 | ||
431 | if (kbytes < 2000) | |
430 | ||
431 | ||
432 | if (bytes < 5000*1024) | |
432 | 433 | buf[0]=0; |
433 | else if (kbytes < 2*1024*1024) | |
434 | sprintf(buf, " (%d MiB)", kbytes>>10); | |
434 | else if (bytes < 2*1024LL*1024LL*1024LL) | |
435 | sprintf(buf, " (%d.%02d MiB %d.%02d MB)", | |
436 | (long)(bytes>>20), | |
437 | (long)(bytes&0xfffff)/(0x100000/100), | |
438 | (long)(bytes/1000/1000), | |
439 | (long)((bytes%1000000)/10000) | |
440 | ); | |
435 | 441 | else |
436 | sprintf(buf, " (%d GiB)", kbytes>>20); | |
442 | sprintf(buf, " (%d.%02d GiB %d.%02d GB)", | |
443 | (long)(bytes>>30), | |
444 | (long)((bytes>>10)&0xfffff)/(0x100000/100), | |
445 | (long)(bytes/1000LL/1000LL/1000LL), | |
446 | (long)(((bytes/1000)%1000000)/10000) | |
447 | ); | |
437 | 448 | return buf; |
438 | 449 | } |