Linux Shred Hard Drive

If there is a damaged hard drive in a RAID array that runs, the disk should be replaced as soon as possible so that the whole RAID is not damaged. Only allowing 1 RAID5 hard disk corrupted, if only 1 other harddrive which damaged then the whole array. Damaged hard drive raid6 allow 2, however if the third harddisk is also broken, so which the whole array.

In Linux, the command "mdadm" is used to manage the RAID array. RAID array device is "/dev/md0, md1" etc.

View the status of an array
mdadm --detail /dev/md0

(This command Should be done periodically and automatically pass scripts.)
Look at the lines output state. If its status:
State : clean, active

then the array is healthy. If its status:
State : clean, degraded, recovering

This means that one or more disks are not in sync and are synchronized, this condition sometimes occurs and is not critical. But if its status:
State : clean, degraded

This means that one or more disks are damaged/failed and can not be synchronized again. Then check the detailed status of each hard disk, if there is a harddrive status like this:
Number  Major  Minor   RaidDevice  State
x       x       x      x           faulty spare   /dev/sdb1

then it means the hard disk must be replaced.

Replace the hard drive
1. If not, record the serial number of all the harddisk. This can be done with the command "hdparm-I/dev/sdX" eg: "hdparm-I/dev/sdb". Make a note of the last digit of the course 2-3 to make it more practical.

2. Shutdown the computer (or the first important data, backup to another server, the new shutdown).

3. remove the hard drive fail from the slot. It will be easier if you have labeled each hard drive with serial number or label his device.

4. Replace with a new hard drive. If its hard drive size should be the same as the other disk in the array, but if larger capacity does nothing (smaller can't).

5. Turn on the system again.

6. Format and add the new hard drive into the array:
fdisk /dev/sdb

(create primary partition with type fd)
mdadm --add /dev/md0 /dev/sdb1

7. Then it should be after this, the status of the array are recovering back:
mdadm --detail /dev/md0

State : clean, degraded, recovering

Click here for Comments