Skip to content

            Lost ?  |  Need an account:
 
Home >> Knowledge Base >> Operating Systems >> Linux >> Removing RAID Devices
Removing RAID Devices PDF Print E-mail
(6 votes, average 5.00 out of 5)
Written by Tom Hirt   
Monday, 15 June 2009 12:29

 

How-to Remove RAID Devices


Continuing with our Linux RAID How-to series, in this KB, we will show you how to remove a Linux software RAID device.

Typically, we remove devices from a RAID array because we want to re-purpose the device(s) for other use.  Removing a device from an array is destructive and will destroy the entire array so proceed with caution.

Note: If you are trying to remove a failed device from an array, see our Removing Failed RAID Devices KB.

  1. Backup your data!  Ensure you have a full backup of your data before proceeding.  Any data on the array will be lost once we remove a device from the array.

  2. If the array is mounted, unmount the array before proceeding

    [root@Linux01 TCPDumpLV]# df -kh
    Filesystem
    Size
    Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol04
    3.9G 2.2G 1.6G 59% /
    /dev/sda1 99M
    12M
    82M
    13% /boot
    tmpfs 1006M
    0
    1006M
    0% /dev/shm
    /dev/mapper/VolGroup00-LogVol00 992M
    41M
    901M
    5%
    /home
    /dev/mapper/VolGroup00-LogVol02 992M
    69M
    872M
    8%
    /tmp
    /dev/mapper/VolGroup00-LogVol03 2.0G
    152M
    1.7G
    9%
    /var
    /dev/md0 7.9G
    147M
    7.4G
    2%
    /RAID5
    Note: You can see /dev/md0 is mounted on /RAID5

    [root@Linux01 ~]# umount /dev/md0
    [root@Linux01 ~]#

  3. Note the devices that make-up the array

    [root@Linux01 ~]# mdadm --detail /dev/md0
    /dev/md0:

    Version : 00.90.03
    Creation Time
    : Mon Jun 15 14:28:48 2009
    Raid Level
    : raid5
    Array Size
    : 8385664 (8.00 GiB 8.59 GB)
    Used Dev Size
    : 4192832 (4.00 GiB 4.29 GB)
    Raid Devices
    : 3
    Total Devices
    : 3
    Preferred Minor : 0
    Persistence
    : Superblock is persistent
    :
    Update Time
    : Mon Jun 15 15:26:40 2009
    State
    : clean
    Active Devices
    : 3
    Working Devices
    : 3
    Failed Devices
    : 0
    Spare Devices
    : 0
    :
    Layout
    : left-symmetric
    Chunk Size
    : 64K
    :
    UUID
    : 9a37eac9:0525c02f:cf141ece:af0de2a7
    Events
    : 0.2
    Number Major
    Minor
    RaidDevice
    State
    0
    8
    17 0
    active sync   /dev/sdb1
    1
    8 33 1 active sync   /dev/sdc1
    2
    8 49 2 active sync   /dev/sdd1
    Note: /dev/sdb1, /dev/sdc1 and /dev/sdd1 makeup /dev/md0

  4. Stop the array

    [root@Linux01 /]# mdadm -S /dev/md0
    mdadm: stopped /dev/md0
    [root@Linux01 /]#

  5. Zero out each of the superblock's of the devices that belongs to the RAID array

    [root@Linux01 /]# mdadm --zero-superblock /dev/sdb1
    [root@Linux01 /]# mdadm --zero-superblock /dev/sdc1
    [root@Linux01 /]# mdadm --zero-superblock /dev/sdd1
    [root@Linux01 /]#
    Note: Zeroing the superblocks will destroy all the data on the array

  6. Remove the  DEVICE and ARRAY entry's associated with the array from /etc/mdadm.conf

    DEVICE /dev/sdb1 /dev/sdc1 /dev/sdd1
    ARRAY /dev/md0 level=raid5 num-devices=3 devices=/dev/sdb1,/dev/sdc1,/dev/sdd1

  7. Remove the array from /etc/fstab

    /dev/md0 /RAID5
    ext3 defaults 0 0
Nice work!  You now know how to remove a RAID device.  Good luck!

Add this page to your favorite website
AddThis Social Bookmark Button
Comments
Add New Search
Chris Edwards  - fstab |26/09/2009 04:54:30
Can I add one of the drives back into fstab after step 7. and boot off of it? Do I need to reinstall GRUB?

Thanks!

Chris
thirt |28/09/2009 09:41:47
Hi Chris,

There would certainly be nothing preventing you from adding another device to the fstab. I'm not sure entirely what you are attempting to do, but you don't necessarily have to install grub on the new device to boot from it. Assuming you already have a /boot filesystem that contains your kernel initrd etc., so long as your new RAID device contains your system files, you could just add another entry in your grub.conf to be a target for your root filesystem.

Hope that helps.
Tom
Chris Edwards |28/09/2009 14:00:45
I am attempting to break software RAID1 and install the same drives on hardware RAID1 with a new controller card.
mike |16/01/2010 14:54:07
Nice tut problem is im getting this error "mdadm: fail to stop array /dev/md1: Device or resource busy""
thirt |24/01/2010 17:31:01
Mike - Make sure your working directory isn't the filesystem /dev/md1 is mounted on. Also, try using fuser to see what process(s) are in use on the filesystem. i.e: fuser /raid_filesystem

Best,
Tom
Jason  - busy |14/12/2011 10:56:12
I too am getting this:
"mdadm: fail to stop array /dev/md0: Device or resource busy"

When using fuser, it doesn't show anything running. I was able to unmount the array, but I can't get it to stop. So I am stuck at step 4. Ideas? Thanks
Arun Khan  - RE: Removing RAID Devices |02/06/2010 23:07:36
Great Tutorial. Thanks very much for the clear instructions.

With newer kernels I have noticed that it detects the raid devices from the meta data present in the devices itself and hence file /etc/mdadm.conf may not exist.
nagu  - RAID devices |18/01/2012 01:16:35
Thanku ..
for giving good sugession.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
:D:):(:0:shock::confused:8):lol::x:P:oops::cry::evil::twisted::roll::wink::!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

Last Updated on Tuesday, 16 June 2009 13:28
 

Forum Activity

Author:
Author: kenny22
Jan.24.12
Author: AaronRiley
Jan.15.12

Online Stats

Guests Online: 79
Members Online: 0



We thank you for visiting TcpDump and hope you find our knowledge base articles helpful. However, we need your support!!

If you found the content on our site useful, please help support us and visit one of our sponsors sites. Your support pays for the electric, servers and bandwidth required to run TcpDump and we can’t do it without your help!

Thank you again for all your support!

Best Regards,
-Tom Hirt