shutting down/removing a software RAID array? - Hardware

This is a discussion on shutting down/removing a software RAID array? - Hardware ; I've been looking for a solution but everyone seems to want to tell you how to set up a RAID array in Linux. I want to do the opposite. I was trying to install a RAID array on a running ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: shutting down/removing a software RAID array?

  1. shutting down/removing a software RAID array?

    I've been looking for a solution but everyone seems to want to tell you
    how to set up a RAID array in Linux. I want to do the opposite. I was
    trying to install a RAID array on a running Debian Etch system and
    things didn't work out. Now I want to back out of it and start again
    from scratch. That is easier said than done.

    I was following the HowtoForge howto on the subject (with some minor
    modifications). I started with 2 Western Digital Caviar 80G drives. They
    are both the same size but have different model numbers and geometries.
    My first pass was to dd if=/dev/hda of=/dev/hdc to clone the existing
    drive. Then in a fit of madness, I modified the partition table on
    /dev/hdc to have the partitions end on cylinder boundaries. Bad move,
    but not related to my current problem.

    Having eventually decided to go back and start from scratch, I can't get
    the RAID array to cease to exist. My current state after redoing the dd
    is shown by this:
    #cat /proc/mdstat
    Personalities : [raid1]
    md1 : active raid1 hdc[1]
    60696128 blocks [2/1] [_U]

    Somewhere along the line I must have inadvertently added /dev/hdc to the
    md1 array instead of /dev/hdc3. Even the dd to /dev/hdc didn't remove
    it. And after trying everything else I can think of to remove the
    software traces of the RAID array, a reboot still gives me md1
    containing hdc.

    Any ideas on how to get rid of md1 or at least get /dev/hdc out of it so
    it is empty?

  2. Re: shutting down/removing a software RAID array?

    Gary Dale staggered into the Black Sun and said:
    > I've been looking for [how to *stop*] a [softRAID] in Linux.


    "mdadm misc /dev/mdN --stop" . This won't work if /dev/mdN is mounted.

    > I can't get the RAID to cease to exist. My current state after redoing
    > the dd is shown by this:
    > #cat /proc/mdstat
    > Personalities : [raid1]
    > md1 : active raid1 hdc[1]
    > 60696128 blocks [2/1] [_U]
    >
    > Somewhere along the line I must have inadvertently added /dev/hdc to
    > the md1 array instead of /dev/hdc3.


    If you're sure that you don't want to have any softRAID at all, change
    the partition type of all former softRAID partitions to something other
    than 0xfd. And rm -rf /etc/mdadm* while you're at it. (You can
    regenerate that dir structure when you rebuild your softRAID setup
    properly.) And check /proc/cmdline to make sure that you're not passing
    "root=/dev/md1" or something to the kernel on boot. Also remember that
    the md superblock info is stored at the *end* of the partition, so
    efficiently erasing that info with dd will require a seek= .

    > And after trying everything else I can think of to remove the software
    > traces of the RAID array, a reboot still gives me md1 containing hdc.


    Expand on "everything else you can think of". What, precisely, were the
    commands you executed?

    --
    Jesus is the best radio producer in the beans. We need some saliva
    and pickles to get mad. --MegaHAL, "The Best of MegaHAL"
    =======Hire me! http://crow202.dyndns.org:8080/~mhgraham/resume/
    Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

  3. Re: shutting down/removing a software RAID array?

    Dances With Crows wrote:
    > Gary Dale staggered into the Black Sun and said:
    >> I've been looking for [how to *stop*] a [softRAID] in Linux.

    >
    > "mdadm misc /dev/mdN --stop" . This won't work if /dev/mdN is mounted.
    >
    >> I can't get the RAID to cease to exist. My current state after redoing
    >> the dd is shown by this:
    >> #cat /proc/mdstat
    >> Personalities : [raid1]
    >> md1 : active raid1 hdc[1]
    >> 60696128 blocks [2/1] [_U]
    >>
    >> Somewhere along the line I must have inadvertently added /dev/hdc to
    >> the md1 array instead of /dev/hdc3.

    >
    > If you're sure that you don't want to have any softRAID at all, change
    > the partition type of all former softRAID partitions to something other
    > than 0xfd. And rm -rf /etc/mdadm* while you're at it. (You can
    > regenerate that dir structure when you rebuild your softRAID setup
    > properly.) And check /proc/cmdline to make sure that you're not passing
    > "root=/dev/md1" or something to the kernel on boot. Also remember that
    > the md superblock info is stored at the *end* of the partition, so
    > efficiently erasing that info with dd will require a seek= .
    >
    >> And after trying everything else I can think of to remove the software
    >> traces of the RAID array, a reboot still gives me md1 containing hdc.

    >
    > Expand on "everything else you can think of". What, precisely, were the
    > commands you executed?
    >

    I've already done almost everything you suggested and more. I'd turned
    the partitions back to type 83 but that doesn't work on /dev/hdc - it's
    a device not a partition. Can you expand on the "seek=" however?
    Apparently the dd between devices didn't clobber whatever is making the
    computer think it's got RAID.

    I tried zeroing the superblocks but that gave problems because mdadm
    won't touch a running RAID volume, which /dev/hdc is part of.

    I uninstalled mdadm (with --purge) then removed everything that looked
    like an mdadm configuration file. There is nothing in
    /boot/grub/menu.lst that refers to /dev/md1. Still the RAID array show up.

  4. Re: shutting down/removing a software RAID array?

    Gary Dale staggered into the Black Sun and said:
    > Dances With Crows wrote:
    >> Gary Dale staggered into the Black Sun and said:
    >>> I've been looking for [how to *stop*] a [softRAID] in Linux.

    >> "mdadm misc /dev/mdN --stop" . This won't work if /dev/mdN is
    >> mounted.


    Was it mounted anywhere? You didn't make that clear.

    >>> #cat /proc/mdstat
    >>> md1 : active raid1 hdc[1]
    >>> 60696128 blocks [2/1] [_U]


    >>> Somewhere along the line I must have inadvertently added /dev/hdc to
    >>> the md1 array instead of /dev/hdc3.

    >> If you're sure that you don't want to have any softRAID at all,
    >> change the partition type of all former softRAID partitions to
    >> something other than 0xfd. And rm -rf /etc/mdadm* while you're at
    >> it. (You can regenerate that dir structure when you rebuild your
    >> softRAID setup properly.)
    >>> And after trying everything else I can think of to remove the software
    >>> traces of the RAID array, a reboot still gives me md1 containing hdc.

    >> Expand on "everything else you can think of". What, precisely, were
    >> the commands you executed?

    > I've already done almost everything you suggested and more.


    Were there any error messages or strange things in dmesg when you did
    those things? Reproduce those messages if they exist.

    > the partitions back to type 83 but that doesn't work on /dev/hdc -
    > it's a device not a partition. Can you expand on the "seek="?


    mallory:~# fdisk -l /dev/sda
    Disk /dev/sda: 250.0 GB, 250059350016 bytes

    ....the disk is 250 Marketing G or 238475 M in size. The softRAID
    superblock is on the last few M of the disk or partition. So if I'd put
    a softRAID superblock on /dev/sda by mistake, I could get rid of it by
    doing "dd if=/dev/zero of=/dev/sda bs=1M seek=238400" . That'd zorch
    the last 75 M of the disk, and any softRAID superblock would die.

    > I tried zeroing the superblocks but that gave problems because mdadm
    > won't touch a running RAID volume, which /dev/hdc is part of.


    I thought you said you'd stopped it with --stop.

    > I uninstalled mdadm (with --purge) then removed everything that looked
    > like an mdadm configuration file. There is nothing in GRUB that refers
    > to /dev/md1. Still, the RAID array [shows] up.


    It wouldn't surprise me if your distro's "emerge -C" attempts to keep
    you from shooting yourself in the foot by refusing to delete critical
    things. If /sbin/mdadm exists, the boot scripts almost certainly run it
    with -As to auto-assemble arrays. If a softRAID superblock exists on
    /dev/hdc , mdadm will probably find it and do its thing.

    --
    "Oh bother," said the Borg, "We've assimilated Pooh."
    --MHR on alt.fan.pratchett
    =======Hire me! http://crow202.dyndns.org:8080/~mhgraham/resume/
    Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

  5. Re: shutting down/removing a software RAID array?

    Dances With Crows wrote:
    > Gary Dale staggered into the Black Sun and said:
    >> Dances With Crows wrote:
    >>> Gary Dale staggered into the Black Sun and said:
    >>>> I've been looking for [how to *stop*] a [softRAID] in Linux.
    >>> "mdadm misc /dev/mdN --stop" . This won't work if /dev/mdN is
    >>> mounted.

    >
    > Was it mounted anywhere? You didn't make that clear.
    >
    >>>> #cat /proc/mdstat
    >>>> md1 : active raid1 hdc[1]
    >>>> 60696128 blocks [2/1] [_U]

    >
    >>>> Somewhere along the line I must have inadvertently added /dev/hdc to
    >>>> the md1 array instead of /dev/hdc3.
    >>> If you're sure that you don't want to have any softRAID at all,
    >>> change the partition type of all former softRAID partitions to
    >>> something other than 0xfd. And rm -rf /etc/mdadm* while you're at
    >>> it. (You can regenerate that dir structure when you rebuild your
    >>> softRAID setup properly.)
    >>>> And after trying everything else I can think of to remove the software
    >>>> traces of the RAID array, a reboot still gives me md1 containing hdc.
    >>> Expand on "everything else you can think of". What, precisely, were
    >>> the commands you executed?

    >> I've already done almost everything you suggested and more.

    >
    > Were there any error messages or strange things in dmesg when you did
    > those things? Reproduce those messages if they exist.
    >
    >> the partitions back to type 83 but that doesn't work on /dev/hdc -
    >> it's a device not a partition. Can you expand on the "seek="?

    >
    > mallory:~# fdisk -l /dev/sda
    > Disk /dev/sda: 250.0 GB, 250059350016 bytes
    >
    > ...the disk is 250 Marketing G or 238475 M in size. The softRAID
    > superblock is on the last few M of the disk or partition. So if I'd put
    > a softRAID superblock on /dev/sda by mistake, I could get rid of it by
    > doing "dd if=/dev/zero of=/dev/sda bs=1M seek=238400" . That'd zorch
    > the last 75 M of the disk, and any softRAID superblock would die.
    >
    >> I tried zeroing the superblocks but that gave problems because mdadm
    >> won't touch a running RAID volume, which /dev/hdc is part of.

    >
    > I thought you said you'd stopped it with --stop.
    >
    >> I uninstalled mdadm (with --purge) then removed everything that looked
    >> like an mdadm configuration file. There is nothing in GRUB that refers
    >> to /dev/md1. Still, the RAID array [shows] up.

    >
    > It wouldn't surprise me if your distro's "emerge -C" attempts to keep
    > you from shooting yourself in the foot by refusing to delete critical
    > things. If /sbin/mdadm exists, the boot scripts almost certainly run it
    > with -As to auto-assemble arrays. If a softRAID superblock exists on
    > /dev/hdc , mdadm will probably find it and do its thing.
    >


    Thanks. I either missed the --stop command the first time or it failed
    for some reason. I tried it last night and it worked. I rebooted and the
    RAID didn't start up this time.

+ Reply to Thread