1820879 Members
5101 Online
109628 Solutions
New Discussion юеВ

mdadm -- plz help

 
SOLVED
Go to solution
Maaz
Valued Contributor

mdadm -- plz help

Dear Gurus

#mdadm -C /dev/md0 -l 1 -n 2 /dev/hda2 /dev/hdb2
#mkfs -t ext3 /dev/md0

1) Now i want to disable/finish Raid-1 Array(/dev/md0), I did the following
#mdadm --manage /dev/md0 -f /dev/hdb2
#mdadm --manage /dev/md0 -f /dev/hda2
then,
#mdadm --manage /dev/md0 -S.
when I reboot my system, /dev/md0 automatically becomes active.
#mdadm --detail /dev/md0, shows me the complete statistics/status.

Now i want to disable/finish Raid-1 Array(/dev/md0).

2) I have created two raid-1 arrays
#mdadm -C /dev/md0 -l 1 -n 2 /dev/hda2 /dev/hdb2
#mdadm -C /dev/md1 -l 1 -n 2 /dev/hda3 /dev/hdb3
Now i want to configure 'raid10' what command should i issue ?

Regards
Maaz
9 REPLIES 9
Ivan Ferreira
Honored Contributor
Solution

Re: mdadm -- plz help

Use

mdadm /dev/md0 -f /dev/hdb2 -r /dev/hdb2
mdadm /dev/md0 -f /dev/hda2 -r /dev/hda2

To create a RAID 10 use:

dadm -C /dev/md2 -l 0 -n 2 /dev/md0 /dev/md1
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: mdadm -- plz help

Thanks Dear Ivan Ferriera for the help.
I m not in a trouble, infact i m preparing to configure Software Raid.

Dear, but linux doesnt allow me to remove the last partition/disk from raid-1 array
i can set faulty both partitions but can only remove one partition, bcause when I try to remove the second partition, system says "device or source is busy"

#mdadm --manage /dev/md0 -f /dev/hdb2
#mdadm --manage /dev/md0 -r /dev/hdb2
#mdadm --manage /dev/md0 -f /dev/hda2
Now but when
#mdadm --manage /dev/md0 -r /dev/hda2
mdadm: Device or source is busy

2)mdadm -C /dev/md2 -l 0 -n 2 /dev/md0 /dev/md1
I have tried this, but when i tried to mount /dev/md2, linux ask me to provide Correct Filesystem
#mount -t ext3 /dev/md2 /mnt .. fails
so I did the following
#mkfs -t ext3 /dev/md2
Now i can mount the /dev/md2, and can work, ok.
But now i cant remove /dev/md0 nor /dev/md1 from /dev/md2
#mdadm --manage /dev/md2 -f /dev/md0
#mdadm --manage /dev/md2 -r /dev/md0
mdadm: Device or source is busy

#mdadm --manage /dev/md2 -f /dev/md1
#mdadm --manage /dev/md2 -r /dev/md1
mdadm: Device or source is busy

thats why i did the following
#mdadm --manage /dev/md2 -S
and then try to mount /dev/md0 and/or /dev/md1, linux says me to provide Correct Filesystem.

Plz help
Ivan Ferreira
Honored Contributor

Re: mdadm -- plz help

1) Try running mdadm /dev/md0 -S before removing the disks.

2) Create a file system before you try to mount it:

mkfs -t ext3 /dev/md2
tune2fs -i0 -c0 -m0 /dev/md2
mount /dev/md2 /mnt/disk
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: mdadm -- plz help

>Try running mdadm /dev/md0 -S before >removing the disks.
It also doesnt works

>Create a file system before you try to mount it.
yes I do the same.
--
After trying several times what I found is that both partitions/disks can set as "faulty", but only a single partition/disk can be removed from raid-1 array(say /dev/md0)
#mdadm -C /dev/md0 -l 1 -n 2 /dev/hda2 /dev/hdb2
#mkfs -t ext3 /dev/md0
#mdadm --manage /dev/md0 -f /dev/hda2 -r /dev/hda2
But
#mdadm --manage /dev/md0 -f /dev/hdb2 -r /dev/hdb2
mdadm: set /dev/hdb2 faulty in /dev/md0
md: Cannot remove active disk /dev/hdb2 from md0...
mdadm:hot remove failed for /dev/hdb2: Device or resource busy
then
#mdadm --manage /dev/md0 -S
Now
#mdadm --detail /dev/md0
mdadm: Cannot get array info for /dev/md0
I just reboot the machine and then
#mdadm --detail /dev/md0
.
.
.
.
Number Major Minor RaidDevice State
0 3 5 -1 removed
1 0 0 1 active sync /dev/hdb2
So the only way I found to completely stop the raid1 array(persistent accros reboot), is to perform the following steps
1) set the partitions/disks as faulty
2) Stop the array #mdadm --manage /dev/md0 -S
3 run fdisk and delete the raid(0xfd) partition

Any Comments/help will be highly appreciated

Regards
Maaz
Ivan Ferreira
Honored Contributor

Re: mdadm -- plz help

These are the commands that I executed on my test system and worked perfectly for creating a RAID 1+0.

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd1 /dev/sde1
mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/md0 /dev/md1
mkfs -t ext3 /dev/md2
mount /dev/md2 /mnt/disk

The raid device was sucessfully mounted.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Ivan Ferreira
Honored Contributor

Re: mdadm -- plz help

What I have noted is that md2 (the 0+1 array) won't start after a reboot unless you create the /etc/mdadm.conf file. To do that use:

mdadm --detail --scan > /etc/mdadm.conf

Edit the file, and at the very top add:

DEVICE /dev/sd* /dev/md*

Replace /dev/sd* with /dev/hd* if you use IDE devices.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Maaz
Valued Contributor

Re: mdadm -- plz help

Thanks for GUIDING me.
I m following ur instructions and success.
I just want to let u know that I cant stop raid1 arrays, because only 1 partition/disk can be removed from the array(raid1), the other can set as faulty but cant be removed, and if u stop the raid1 array by "--manage device -S" it will stop for the current session only and will be available aftr a reboot.(see my third post)
But raid5 array is a different story.. In raid5 array all of the partitions/disk can b set faulty, and then removed. and if "--manage device -S", then raid5 will gone completely.

Regards
Maaz
Maaz
Valued Contributor

Re: mdadm -- plz help

One more question
1)
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd1 /dev/sde1

mdadm --create /dev/md2 --level=0 --raid-devices=2 /dev/md0 /dev/md1
/dev/md2 is a raid10 array ?

2)
mdadm --create /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/sdd1 /dev/sde1

mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/md0 /dev/md1
/dev/md2 is a raid01 array ?

Regards
Maaz
Ivan Ferreira
Honored Contributor

Re: mdadm -- plz help

Yes, sometimes, the naming convention may vary, for example, the first can be a RAID 1+0 or 10, and the second would be a RAID 0+1. But is preferred the first one, because in the second option, if one disk fails, your md device, md0 or md1, will fail, and you will have to create again. In the first case, if one disk fails, md0 or md1 will be only reduced, and you only need to recover the damaged disk.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?