How-to Convert RAID5 to RAID6
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Canada
    Posts
    644

    Post How-to Convert RAID5 to RAID6

    Note: This how-to assumes you are using LVM on top of the RAID5

    Example scenario:
    VG0 <-> md0 = RAID5(3x500GB) = sda1, sdb1, sdc1
    Volume Group VG0 is made up of a single Physical Volume (md0), which is made up of 3x500GB hard drives in RAID5.

    You want to add 2 more drives (sdd1, sde1) and convert the underlying RAID5 to RAID6, thus giving you a 5x500GB RAID6

    Methodology
    Because mdadm does not currently support converting a RADI5 into RAID6, we need to dance around this problem by:
    1. Taking offline one of the drives in md0
    2. Using this drive, plus the 2 new drives and creating a fully degraded RAID6 (md1), ie consisting of 5 drives but 2 drives are missing
    3. Create a PV on md1,
    4. Add md1 to VG0,
    5. Ask LVM to move md0 out of VG0
    6. Shutdown md0
    7. Add the drives from md0 into md1 to complete the RAID6

    Ok this does sound long and complicated. It IS long. It is NOT complicated. It IS 100% safe and can be done without taking LVM offline. ie Data stays online during conversion.

    Lets begin:

    1. Take offline one of the drives in md0

    Code:
    mdadm /dev/md0 --fail /dev/sdc1 --remove /dev/sdc1
    - where sdc is the drive we want to remove

    2. Using this removed drive, plus the 2 new drives, create a fully degraded RAID6 (md1)

    Code:
    mdadm --create /dev/md1 --level=6 --raid-devices=5 missing missing /dev/sdc1 /dev/sdd1 /dev/sde1
    - Note the word "missing:" for each drive we are not adding now.
    - Also note you may receive a warning about sdc1 already being part of a RAID5 (we already know this)
    Code:
    mdadm: /dev/sdc1 appears to contain an ext2fs file system
        size=17414428K  mtime=Tue Apr 29 22:53:23 2008
    mdadm: /dev/sdc1 appears to be part of a raid array:
        level=raid5 devices=3 ctime=Wed Apr 30 15:41:15 2008
    Continue creating array? yes
    mdadm: array /dev/md1 started.
    3. Create a Physical Volume out of the new degraded RAID6 (md1)
    Code:
    pvcreate /dev/md1
    4. Add md1 to VG0
    Code:
    vgextend /dev/VG0 /dev/md1
    5. Setup md0 for removal from VG0 (ie Ask LVM to copy all the extents currently allocated on md0 to other physical volumes)
    Code:
    pvmove -v /dev/md0
    Note: This can take a LOOOONG time. It took 24hrs for me. Dont worry if this process gets aborted. It can be resumed using the same command.

    5.1 Remove md0 from VG0
    Code:
    vgreduce VG0 /dev/md0
    5.2 Wipe the LVM label from md0 (not really essential)
    Code:
    pvremove /dev/md0
    6. Shutdown md0
    Code:
     mdadm --stop /dev/md0

    7. Add the drives from md0 into md1, thus completing the RAID6

    Code:
     mdadm /dev/md1 --add /dev/sda1 /dev/sdb1
    Ta da! You have now successfully migrated from a 3 drive RAID5 to a 5 drive RAID6 without stopping the music for even a second.

    The reason I did this was, I swear by Western Digital Hard drives, but i couldnt afford them anymore, so I bought some el-cheapo Seagates, which i dont trust for ****, and decided I needed to up the redundancy a level.

    BE CAREFUL - During this procedure, md0 is in a very critical condition. If the two remaining drives dont come back up after a mid-step crash. You are ****ed. If the system crashes, there is a 1% chance that mdadm will not be able to bring back the degraded RAID5 (md0).

    God Speed.
    Last edited by cruiseoveride; 14th February 2009 at 11:01 PM.
    Registered Linux User no. 335484 :cool:
    An RHCE guy, and wannabe RHCA :cool:
    --------------------------------------------------------
    Get Counted at http://counter.li.org/
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    AMD X3 710, ASUS M4N78-Pro, Visiontek ATi HD4870, Corsair 2GB Dual Channel Kit, 6x500Gb Western Digital Disks LVM2+RAID5

  2. #2
    Join Date
    Mar 2005
    Location
    Canada
    Posts
    644
    Remember pvmove doesnt really "move" anything, so in case something happens during the pvmove, you can use vgcfgrestore --list and pick an old automatic backup file and use it to restore the VG.
    Registered Linux User no. 335484 :cool:
    An RHCE guy, and wannabe RHCA :cool:
    --------------------------------------------------------
    Get Counted at http://counter.li.org/
    ---------------------------------------------------------------------------------------------------------------------------------------------------------
    AMD X3 710, ASUS M4N78-Pro, Visiontek ATi HD4870, Corsair 2GB Dual Channel Kit, 6x500Gb Western Digital Disks LVM2+RAID5

Similar Threads

  1. Is this my software raid5??
    By seabird in forum Using Fedora
    Replies: 0
    Last Post: 13th March 2009, 11:36 PM
  2. FC4 Installation with Raid5
    By Brett3rThanU in forum EOL (End Of Life) Versions
    Replies: 0
    Last Post: 12th September 2006, 04:19 PM
  3. Migrating a software RAID6.
    By Deicide in forum Using Fedora
    Replies: 1
    Last Post: 11th September 2006, 06:35 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •