How to destroy md0 raid device

658 views
Skip to first unread message

nmcar

unread,
Apr 13, 2014, 3:09:03 PM4/13/14
to al...@googlegroups.com
Hi Joao. I am starting a new topic to know how to destroy md0, that has been degraded. I copy the basic information about my configuration. I actually want to keep md1 and md2. I don't know what sda4 and sdb4 filesystems are. I followed the wizard and selected to leave the discs untouched.



You are using a very odd setup, with swap over a RAID1. Nothing really wrong, but a waste of CPU resources.
You said "since I am a noobie with linux", who set up the box for you?

You have three RAID devices: md0 (RAID1, 530MB, swap), md1 (RAID1, 267BG, ext3), md2 (JBOD, 1.3T, ext3)
plus two non RAID filesystems:  sda4 (474MB, ext3) and sdb4 (470MB, ext3)

I guess that most, if not all of your data is on md2.

The reason why md0 is degraded (it is swap, no data is at risk) is related with the following, from the log you attached:

md: kicking non-fresh sda1 from array!
md/raid1:md0: active with 1 out of 2 mirrors
Adding 530044k swap on /dev/md0.  Priority:1 extents:1 across:530044k 

I would destroy the md0 RAID1 array and let swap work on disk partitions, as it is usually done. As swap uses two disk partitions (sda1 and sdb1), it already behaves as a kind of RAID0.

If you want to change that, please open a new topic, as that is not related with this topic subject.


How could I get rid of md0? 

Thank you

João Cardoso

unread,
Apr 16, 2014, 10:54:13 AM4/16/14
to al...@googlegroups.com


On Sunday, April 13, 2014 8:09:03 PM UTC+1, nmcar wrote:
Hi Joao. I am starting a new topic to know how to destroy md0, that has been degraded. I copy the basic information about my configuration. I actually want to keep md1 and md2. I don't know what sda4 and sdb4 filesystems are. I followed the wizard and selected to leave the discs untouched.

Then I don't know how swap appears over a RAID1 device. A D-Link leftover?
 



You are using a very odd setup, with swap over a RAID1. Nothing really wrong, but a waste of CPU resources.
You said "since I am a noobie with linux", who set up the box for you?

You have three RAID devices: md0 (RAID1, 530MB, swap), md1 (RAID1, 267BG, ext3), md2 (JBOD, 1.3T, ext3)
plus two non RAID filesystems:  sda4 (474MB, ext3) and sdb4 (470MB, ext3)

I guess that most, if not all of your data is on md2.

The reason why md0 is degraded (it is swap, no data is at risk) is related with the following, from the log you attached:

md: kicking non-fresh sda1 from array!
md/raid1:md0: active with 1 out of 2 mirrors
Adding 530044k swap on /dev/md0.  Priority:1 extents:1 across:530044k 

I would destroy the md0 RAID1 array and let swap work on disk partitions, as it is usually done. As swap uses two disk partitions (sda1 and sdb1), it already behaves as a kind of RAID0.

If you want to change that, please open a new topic, as that is not related with this topic subject.


How could I get rid of md0? 

In the first place, there is nothing wrong having swap over a RAID, it's only resource wasteful, and even that only when swap starts being used, i.e., when the Swap graph in the Status page shows that some swap is being used.

As you have already tried the obvious, Disk->RAID, on the md0 line select the Destroy option on the "RAID Operations" and it did not worked (why? something peculiar to swap over RAID?), you have to resort to the command line after logging as the 'root' user.

Be sure that you don't make any mistakes, especially when naming the RAID devices or disk partitions, or you might loose your data. Double check what you typed before pressing the <enter> key. The following commands assume that md0 is the RAID device where swap is, that its components are sdb1, and that sda1 is not part of other RAID devices.

First, verify that swap is really using md0, you don't want to destroy yours data RAID.
The following command shows you how swap is currently working:

cat /proc/swaps


In my system I get:

Filename                                Type            Size    Used    Priority
/dev/sda1                               partition       524408  0       1
/dev/sdb1                               partition       524408  0       1

What do you get in your system? You should get /dev/md0 as the Filename.
Do you get any other line? such as /dev/sda1?

Then you must check that md0 is build from sdb1 and that sda1 is not being used by any other RAID.
Using the following command:

mdadm --examine --scan --verbose

In my system I get:

ARRAY /dev/md/0 level=raid1 (...)  devices=/dev/sdb2,/dev/sda2
ARRAY /dev/md/1 level=raid0 (...)  devices=/dev/sdb3,/dev/sda3
ARRAY /dev/md/2 level=linear (...) devices=/dev/sdb4,/dev/sda4

You should see in your system that md0 devices are /dev/sdb1 and that /dev/sda1 does not appears in any other RAID

You should then stop swap on *all* devices as seen in the 'cat /proc/swaps' command output.
Assuming that only /dev/md0 is being used as swap, use the following command, 

swapoff /dev/md0

Then you should stop the md0 RAID device using the following command:

mdadm --stop /dev/md0

and then you should destroy the RAID information from the md0 device components.
Assuming that the only md0 component devices, as seen in the 'mdadm --examine --scan --verbose' are /dev/sdb1, and that /dev/sda1 does not appears as other RAID device components,

mdadm --zero-superblock --force /dev/sda1
mdadm
--zero-superblock --force /dev/sdb1

You might get an error on the /dev/sda1 command, as it appears to not be part of the md0 array.

You now need to recreate and activate swap using the sda1/sdb1 disk partitions:

mkswap /dev/sda1
swapon
/dev/sda1

mkswap
/dev/sdb1
swapon
/dev/sdb1

That's it. Changes take place immediately, no need to reboot (and should survive a reboot).
The md0 RAID array should not appear anymore, the amber leds should turn off, and ~1000MB of swap will appear in the Status page.

Worked?
 

Thank you

Chris

unread,
Oct 4, 2014, 1:13:05 PM10/4/14
to
Hello,

i am running the latest Alt-F 0.1RC4 on an DNS-320L Rev. A1 and i had the same degraded Raid1 as a swap.
Your instructions for removing it through ssh have worked perfectly for me.

Thank You 
Reply all
Reply to author
Forward
0 new messages