Change a disk from a RAID software before it dies.
Check disks health
Useful commands:
# dmesg | grep sd* // Display kernel system logs |
TL;DR How to change a RAID disk
Change a disk from a RAID before it crash procedure:
# cat /proc/mdstat // Display disks and RAID |
➜ CHANGE HARDEWARELLY THE DISK
# dmesg // Check the NEW letter of the new disk |
Somme exemples
Here, some exemples that show a future crash:
Display kernel system logs:
# dmesg | grep sd* |
Display informations about SCSI devices:
# lsscsi -s |
Display informations about disks partitions:
# lsblk |
Display disks and RAID:
# cat /proc/mdstat |
Display S.M.A.R.T. disks informations (here sdc
):
# smartctl -a /dev/sdc -d cciss,2 |
Manage RAID:
# mdadm --detail /dev/md127 |
How to change a RAID disk ?
Procedure to change un RAID disk before it chrash:
# cat /proc/mdstat |
Highligh the disk to find where is it:
# badblocks -vs /dev/sdc (for highligh) |
Remove the disk fron RAID and wait a litle:
# mdadm --detail /dev/md127 |
➜ CHANGE THE DISK
Check the new letter of the new disk (in general it is the same), you can do that with these commands :
# cat /proc/mdstat |
Here with dmesg
:
# dmesg |
Then copy the partition from a healthy disk from the RAID to the new one:
# sfdisk -d /dev/sdd | sfdisk /dev/sdc |
And add it to the RAID:
# mdadm --add /dev/md127 /dev/sdc |
If ok you will see sonething like that:
# cat /proc/mdstat |
And finaly:
Personalities : [raid1][raid10] |
Documentation
MAN & Internet