Free Hosting Online for WorkStations

< Previous | Contents | Next >

for details, or copy important data to another machine due to major hardware failure. 5.1.5. RAID Maintenance

The mdadm utility can be used to view the status of an array, add disks to an array, remove disks, etc:

• To view the status of an array, from a terminal prompt enter:


sudo mdadm -D /dev/md0


The -D tells mdadm to display detailed information about the /dev/md0 device. Replace /dev/md0 with the appropriate RAID device.

• To view the status of a disk in an array:


sudo mdadm -E /dev/sda1


The output if very similar to the mdadm -D command, adjust /dev/sda1 for each disk.

• If a disk fails and needs to be removed from an array enter:



sudo mdadm --remove /dev/md0 /dev/sda1


Change /dev/md0 and /dev/sda1 to the appropriate RAID device and disk.

• Similarly, to add a new disk:


sudo mdadm --add /dev/md0 /dev/sda1


Sometimes a disk can change to a faulty state even though there is nothing physically wrong with the drive. It is usually worthwhile to remove the drive from the array then re-add it. This will cause the drive to re-sync with the array. If the drive will not sync with the array, it is a good indication of hardware failure.


The /proc/mdstat file also contains useful information about the system's RAID devices:


cat /proc/mdstat

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sda1[0] sdb1[1]

10016384 blocks [2/2] [UU]


unused devices: <none>


The following command is great for watching the status of a syncing drive:


watch -n1 cat /proc/mdstat


Press Ctrl+c to stop the watch command.


If you do need to replace a faulty drive, after the drive has been replaced and synced, grub will need to be installed. To install grub on the new drive, enter the following:


sudo grub-install /dev/md0


Top OS Cloud Computing at OnWorks: