Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Wed Aug 23, 2017 8:52 am


Discussions on RAM, DRAM, shared memory, NAS, SAN, RAID, backups, SCSI, IDE, UFS, UFS2, JFS, JFS2, EXT2, EXT3

Author Message
designeru
  Post  Post subject: Mdadm - Linux software RAID  |  Posted: Mon May 17, 2010 6:08 pm

Joined: Thu Dec 31, 2009 4:44 pm
Posts: 10

Offline
 

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]





Top
Darwin
Post  Post subject: Re: Mdadm - Linux software RAID  |  Posted: Mon Nov 28, 2011 3:44 am

Joined: Tue Nov 08, 2011 7:57 am
Posts: 3

Offline
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!!)


Top
admin
Post  Post subject: Re: Mdadm - Linux software RAID  |  Posted: Tue Dec 06, 2011 8:32 am
Site Admin

Joined: Mon Aug 03, 2009 8:43 am
Posts: 95

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

_________________
VPSie - SSD VPS servers in AMS-IX, LINX, DE-CIX
https://vpsie.com


Top
jacob6580
Post  Post subject: Re: Mdadm - Linux software RAID  |  Posted: Fri Feb 24, 2012 6:35 am
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


Top
jacob6580
Post  Post subject: Re: Mdadm - Linux software RAID  |  Posted: Tue Feb 28, 2012 6:15 am
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!!)


Top
bealee08
Post  Post subject: Re: Mdadm - Linux software RAID  |  Posted: Tue Jun 05, 2012 5:31 am

Joined: Fri Jun 01, 2012 9:54 am
Posts: 3

Offline
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.


Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "Mdadm - Linux software RAID"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. Mdadm - How can i destroy or delete an array

designeru

0

11439

Tue May 18, 2010 9:52 am

designeru View the latest post

There are no new unread posts for this topic. Linux: Show UUID of filesystem

mandrei99

0

720

Fri Feb 28, 2014 6:35 pm

mandrei99 View the latest post

There are no new unread posts for this topic. Linux LVM: Create LV(Logical Volume) using all available space in the volume group

mandrei99

0

1334

Wed Jan 29, 2014 6:57 am

mandrei99 View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO