Operating System - Linux
1819804 Members
3308 Online
109607 Solutions
New Discussion юеВ

Software Raid device destruct/remove

 
SOLVED
Go to solution
Adam Garsha
Valued Contributor

Software Raid device destruct/remove

I was playing around with raidtools/mdadm. I created a raid 1 device "/dev/md0" using two partitions (hda1,hda2).

Now, I am done playing and I want to get rid of any notion of /dev/md0. After, I plan to put hda1 and hda2 back into service as regular partitions.

If I do a "raidstop /dev/md0" and then a "lsraid -p", I see that the raid device is "offline".

How do I "rmraid /dev/md0"?... i.e. I want to erase my toying and get rid of /dev/md0... how do I do this?

Seems there are plenty of docs for building a raid set (Suse 9.3), but nothing about how to undo/remove your raid sets once you've decided that you don't want to use software raid.
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: Software Raid device destruct/remove

Shalom Adam,

You can use the tools to break the raid, then rmsf should remove the device. If not, you may have to live with it sitting out there. It won't do anything.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matti_Kurkela
Honored Contributor
Solution

Re: Software Raid device destruct/remove


(SEP: you gave a HPUX answer to a Linux question... :-)

When you created the RAID1 device, you probably set the partition type of /dev/hda1 and /dev/hda2 to 0xfd (Linux raid autodetect), right?

When the RAID1 device is offline, you can use fdisk to modify the partition type of /dev/hda1 and /dev/hda2 to any value you prefer. Then you can mkfs the partition(s) if necessary. After that they will no longer be detected as RAID at next reboot.

If you have the RAID1 functionality as a kernel module and all software RAID1 devices are offline, you can make the system forget the RAID1 device without a reboot by just unloading the kernel module:
rmmod raid1
If your kernel has RAID1 functionality statically built in (not as a module), you cannot do that. In that case, booting is unavoidable.

There is also mdadm -r (remove) command, which might help. The "raidstart/raidstop" commands are the old way of handling software RAID on Linux, while "mdadm" is the new way. If your distribution is old enough to have the raid* commands, it might not have the newest mdadm with all the options.
MK
Adam Garsha
Valued Contributor

Re: Software Raid device destruct/remove

Matt nailed it.