File: QuickStart.RAID

package info (click to toggle)
raidtools 0.42-16
  • links: PTS
  • area: main
  • in suites: slink
  • size: 392 kB
  • ctags: 128
  • sloc: ansic: 2,056; makefile: 134; sh: 107
file content (199 lines) | stat: -rw-r--r-- 5,510 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199

Setting up your RAID-1 devices.
(C) 1997 Ingo Molnar, Gadi Oxman, Miguel de Icaza.

Send comments and suggestions to:

	linux-raid@vger.rutgers.edu

First of all, make sure you read the INSTALL file for details on how 
to install the userland utilties for managing the Linux/RAID code.

1a. Setting up a 2 way mirrored RAID-1 array:
    (you may setup an n-way mirrored array by just adding more devices
    to the MD device).

a)  Get two partitions of equal size, say /dev/hda1 and /dev/hdb1.

    If they have different sizes, the RAID-1 code won't be able to use
    the difference, but besides wasting that space, there is nothing
    bad with this.  If you have two disks with different sizes, you
    may probably want to partition the bigger one to have one
    partition with the same size as the small disk and use the other
    partition to put other information.

b)  Copy the configuration from raid1.conf.sample into
    /etc/raid1.conf.  Edit the file according to your system.
    
c)  run:

	$ mkraid /etc/raid1.conf

    This creates the RAID-1 superblocks and *ERASES* both paritions.
    Might take a long time for big arrays.

    Be careful, this will *wipe* all the information on your composing
    devices. 

1b. Setting up a software RAID-4/RAID-5:

a)  Get n-partitions of equal size, say /dev/sda1, /dev/sdb1,
    /dev/sdc1, /dev/sdd1.

    If the partitions are of different size, the driver will not be
    able to use the difference in disk space.

b)  Copy the configuration from raid4.conf.sample or raid5.conf.sample
    into /etc/raid4.conf or /etc/raid5.conf.  Edit the file according
    to your setup.

    The configurable things you want to change in this file:

	nr-raid-disks: 	the number of disks in your disk array
                       	(this includes the parity disk).
	
	the device/raid-disk pairs.

2. Creating your MD device:

    run: 

	# mdadd /dev/md0 /dev/hda1 /dev/hdb1

    Those two devices should be the same devices that are specified in
    your raidX.conf file.

3. Activating your MD device:

   Activate your disk array, choose one according to the setup you selected:

	For RAID-1 setups:

	# mdrun -p1 /dev/md0

	For RAID-4 setups:

    	# mdrun -p4 /dev/md0

	For RAID-5 setups:
	
	# mdrun -p5 /dev/md0

    With this instruction you tell the kernel that you want to use the
    /dev/md0 device as a specific RAID personality.

4. Using your MD device:

    Now you can mount /dev/md0 as if it was a normal disk
    partition. You can do:

	# mke2fs /dev/md0
	# mount /dev/md0 /mnt

	[ work, work, work ]

	# umount /mnt

5. Shutting down:

    Before shutdown (but after umount) you should run:

	# mdstop /dev/md0

6. Checking the disk array:

    If mdrun reports that the array couldn't be activated because the
    mirrors were out of sync, you should run:

	For a RAID-1 setup:

	# ckraid /etc/raid1.conf

	For a RAID-4 setup:

	# ckraid /etc/raid4.conf

	For a RAID-5 setup:

	# ckraid /etc/raid5.conf

    This checks your disk array and marks it 'clean'.  It might take
    longer time for big arrays as it has to check every block on the
    mirrors.

7. Mirroring over stripping:

    You might desire to run the mirroring personality on top of the
    stripping personality or the linear personality for various
    reasons: 

    a) too improve the performance of your disk array.  The idea here
       is that you want to have a mirror, but have the speed benefits of the
       stripping personality, or

    b) you want to concatenate some smaller devices as one side of the
       mirror.

       For example: you have two 100meg disks, and one 200meg disk, so
       you concatenate the two 100meg disks with the linear
       personality and then you create a mirror from this new composed
       device and the 200meg disk.

Sample setup mirror over stripping setup:

	(/dev/sda + /dev/sdb) mirrored with (/dev/sdc + /dev/sdd).
  	the '$' is the shell prompt, comments are indented.

$ mdadd /dev/md0 /dev/sda /dev/sdb
	This adds devices /dev/sda and /dev/sdb to /dev/md0

$ mdadd /dev/md1 /dev/sdc /dev/sdd
	This adds devices /dev/sdc and /dev/sdd to /dev/md1

$ mdrun -p0 /dev/md0
	This tells the kernel that you want to use /dev/md0 in
	stripping mode (RAID-0).

$ mdrun -p0 /dev/md1
	This tells the kernel that you want to use /dev/md1 in
	stripping mode (RAID-0).

	Now, create the configuration file for this setup, very
	simple, we just changed the devices to be the md0 and md1
	devices:

$ cat > stripped-raid1.conf << EOF
# Sample raid-1 on top of linear/stripped devices configuration
raiddev                 /dev/md2
raid-level              1
nr-raid-disks           2
nr-spare-disks          0
device                  /dev/md0
raid-disk               0
device                  /dev/md1
raid-disk               1
EOF
$ mkraid stripped-raid1.conf 
	This creates the superblocks on /dev/md0 and /dev/md1 and
	*wipes* the contents of it.  It might take a long time to run.

$ mdadd /dev/md2 /dev/md0 /dev/md1	
	This adds the stripped devices to the mirroring device

$ mdrun -p1 /dev/md2
	Now we actuall tell the kernel to use /dev/md2 as a mirroring
	device.  Note that you can't use stripping over stripping.

Ready!  Now you have a mirror over stripping device in /dev/md2

At shutdown time, don't forget to mdstop your devices:

$ mdstop /dev/md2
	This stops the mirroring personality

$ mdstop /dev/md0
	This stops the first stripping component

$ mdstop /dev/md1
	This stops the second stripping component