|
Starting and Stopping RAID Arrays |
|
|
|
|
Written by Tom Hirt
|
|
Monday, 15 June 2009 19:20 |
|
How-to Start and Stop Linux Software RAID Devices
If you have followed along in our Linux RAID How-to, your RAID array should start and stop automatically as your system boots and shuts down. However, should you want to reconfigure the array or remove it all together, you will need to know how to start and stop the array manually. In this KB we will show how to start and stop the array, you can refer to the Linux RAID How-to for configuration references and links to other RAID KB articles. Let's get started!
Starting the RAID Array
Assuming you have added the DEVICE and ARRAY entries to the /etc/mdadm.conf as specified in the Linux RAID How-to, starting the array can be accomplished with a single command:
- Use mdadm to start the RAID device
[root@Linux01 /]# mdadm --assemble --scan mdadm: /dev/md0 has been started with 3 drives. [root@Linux01 /]# |
For those who have not added the array configuration information to the /etc/mdadm.conf file there is still hope yet. Starting the array without a /etc/mdadm.conf file is a two step process. You must first find the UUID of the array you wish to start, and then start the array with the UUID qualifier.
- Assuming we know one of the devices that make up the array, we can examine the device and extract the UUID with the mdadm tool
[root@Linux01 ~]# mdadm --query /dev/sdb1 /dev/sdb1:
|
| Magic |
: |
a92b4efc
|
Version
|
: |
00.90.00 |
UUID
|
: |
25ab199d:9cf31f9d:5fefdf2f:865b1a2e |
Creation Time
|
: |
Tue Jun 16 13:24:49 2009 |
Raid Level
|
: |
raid5 |
Used Dev Size
|
: |
4192832 (4.00 GiB 4.29 GB) |
Array Size
|
: |
8385664 (8.00 GiB 8.59 GB) |
| Raid Devices |
: |
3 |
Total Devices
|
: |
3 |
| Preferred Minor |
: |
0 |
|
:
|
|
Update Time
|
: |
Tue Jun 16 13:32:17 2009 |
State
|
: |
clean |
Active Devices
|
: |
3 |
Working Devices
|
: |
3 |
Failed Devices
|
: |
0 |
Spare Devices
|
: |
0 |
Checksum
|
: |
e6c5297b - correct |
Events
|
: |
0.2 |
|
:
|
|
Layout
|
: |
left-symmetric |
Chunk Size
|
: |
64K |
|
:
|
|
|
|
Number |
Major
|
Minor
|
RaidDevice
|
State
|
this
|
0
|
8
|
17 |
0
|
active sync /dev/sdb1 |
| . |
0
|
0
|
8
|
17 |
0
|
active sync /dev/sdb1 |
1
|
1
|
8 |
33 |
1 |
active sync /dev/sdc1 |
2
|
2
|
8 |
49 |
2 |
active sync /dev/sdd1 |
|
|
- Use the UUID from step #1 to start the array
[root@Linux01 /]# mdadm /dev/md0 --assemble -u 25ab199d:9cf31f9d:5fefdf2f:865b1a2e mdadm: /dev/md0 has been started with 3 drives. [root@Linux01 /]# |
- Add the array configuration information to /etc/mdadm.conf so you do not have to reference this KB again ;-)
[root@Linux01 /]# mdadm --detail --scan >> /etc/mdadm.conf [root@Linux01 /]# |
Stopping the RAID array
Stopping the RAID array is fairly straight forward, unmount the array and then issue the mdadm stop command.
- Check to see if the RAID device is mounted
| [root@Linux01 TCPDumpLV]# df -kh |
Filesystem
|
Size
|
Used |
Avail |
Use% |
Mounted on |
/dev/mapper/VolGroup00-LogVol04
|
3.9G |
2.2G |
1.6G |
59% |
/ |
| /dev/sda1 |
99M
|
12M
|
82M
|
13% |
/boot |
| tmpfs |
1006M
|
0
|
1006M
|
0% |
/dev/shm |
| /dev/mapper/VolGroup00-LogVol00 |
992M
|
41M
|
901M
|
5%
|
/home |
| /dev/mapper/VolGroup00-LogVol02 |
992M
|
69M
|
872M
|
8%
|
/tmp |
| /dev/mapper/VolGroup00-LogVol03 |
2.0G
|
152M
|
1.7G
|
9%
|
/var |
| /dev/md0 |
7.9G
|
147M
|
7.4G
|
2%
|
/RAID5 |
|
Note: You can see /dev/md0 is mounted on /RAID5
- Unmount the RAID device
[root@Linux01 ~]# umount /dev/md0 [root@Linux01 ~]#
|
- Stop the RAID device
[root@Linux01 /]# mdadm -S /dev/md0 mdadm: stopped /dev/md0 [root@Linux01 /]#
|
Nice work, you now know how to start and stop a Linux RAID Array. Good luck!
Add this page to your favorite website
|
|
Last Updated on Thursday, 18 June 2009 12:42 |