Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

Mdadm - Linux software RAID
https://forum.ivorde.com/mdadm-linux-software-raid-t83.html
Page 1 of 1

Author:  designeru [ Mon May 17, 2010 6:08 pm ]
Post subject:  Mdadm - Linux software RAID

I'm not going to explain what a software RAID is. There is google for this.
However, i will try to summarize here how to remove a failed disk and add a new one instead of it. Follow the steps and ask if somethig failes...

1. Set the drive (in my example /dev/sda) as faulty
Code:
# mdadm --manage --set-faulty /dev/md0 /dev/sda


2. Remove the faulty disk from the array
Code:
# mdadm /dev/md0 -r /dev/sda


3. Stop the array
Code:
# mdadm -S /dev/md0


4. Re-assemble the RAID device
Code:
# mdadm --assemble --force /dev/md0 /dev/sda /dev/sdb /dev/sdc


You should have something like this now (sizes and name may be different)
Code:
storage:~# mdadm --detail /dev/md0   
/dev/md0:
        Version : 00.90
  Creation Time : Mon May 17 16:49:05 2010
     Raid Level : raid5
     Array Size : 1953524992 (1863.03 GiB 2000.41 GB)
  Used Dev Size : 976762496 (931.51 GiB 1000.20 GB)
   Raid Devices : 3
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Mon May 17 16:50:04 2010
          State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 32K

           UUID : 4fbf11f1:d86da25c:0d590f16:adff46fb
         Events : 0.2

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb
       2       0        0        2      removed

storage:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid5 sdb[1] sda[0]
      1953524992 blocks level 5, 32k chunk, algorithm 2 [3/2] [UU_]


5. Add the new good disk to the raid array
Code:
# mdadm /dev/md0 -a /dev/sdc
mdadm: re-added /dev/sdc


You should have it like this now:
Code:
storage:~# mdadm --detail /dev/md0   
/dev/md0:
        Version : 00.90
  Creation Time : Mon May 17 16:49:05 2010
     Raid Level : raid5
     Array Size : 1953524992 (1863.03 GiB 2000.41 GB)
  Used Dev Size : 976762496 (931.51 GiB 1000.20 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Mon May 17 16:52:10 2010
          State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 32K

Rebuild Status : 0% complete

           UUID : 4fbf11f1:d86da25c:0d590f16:adff46fb
         Events : 0.6

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb
       [color=#FF0000]3       8       32        2      spare rebuilding   /dev/sdc[/color]

Author:  Darwin [ Mon Nov 28, 2011 3:44 am ]
Post subject:  Re: Mdadm - Linux software RAID

I have a software raid 1 with mdadm and two 1 TB disks. Today I booted and I saw the the message that the raid activated normal but with only one out of two disks. So I I got the following output form this command:
mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Sat Apr 16 00:30:53 2011
Raid Level : raid1
Array Size : 976758841 (931.51 GiB 1000.20 GB)
Used Dev Size : 976758841 (931.51 GiB 1000.20 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent

Update Time : Tue Oct 18 18:33:39 2011
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

Name : archiso:0
UUID : 96ad7277:0da83ae5:25ef36da:cb4596d3
Events : 880419

Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 0 0 1 removed
So I tried to re-add the disk with this command:
sudo mdadm --re-add /dev/sdc1 /dev/md0
but I got this error:
mdadm: /dev/sdc1 does not appear to be an md device
In gparted I also can see the disk and in the BIOS, too, so it's there and the disk seems to work.
Can anyone tell me what to do and I don't want to loose data and too much time and just re-add the disk. (Of course I do have backups!!)

Author:  admin [ Tue Dec 06, 2011 8:32 am ]
Post subject:  Re: Mdadm - Linux software RAID

Try:
Code:
sudo mdadm /dev/md0 -a /dev/sdc1

Author:  jacob6580 [ Fri Feb 24, 2012 6:35 am ]
Post subject:  Re: Mdadm - Linux software RAID

mdadm can handle anything which presents to the kernel as a block device . This can encompass whole disks (/dev/sda), partitions (/dev/sda1) and USB flash drives

Author:  jacob6580 [ Tue Feb 28, 2012 6:15 am ]
Post subject:  Re: Mdadm - Linux software RAID

I tried to re-add the disk with this command:
sudo mdadm --re-add /dev/sdc1 /dev/md0
but I got this error:
mdadm: /dev/sdc1 does not appear to be an md device
In gparted I also can see the disk and in the BIOS, too, so it's there and the disk seems to work.
Can anyone tell me what to do and I don't want to loose data and too much time and just re-add the disk. (Of course I do have backups!!)

Author:  bealee08 [ Tue Jun 05, 2012 5:31 am ]
Post subject:  Re: Mdadm - Linux software RAID

I have been googling about software RAID and I just land to this post right on time, exactly just when I needed some of this knowledge and tutorials. Free demo's is raining in this forum and I'm liking it here.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/