Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 14th February 2009, 07:36 PM
cruiseoveride Offline
Registered User
 
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.
__________________
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

Last edited by cruiseoveride; 14th February 2009 at 10:01 PM.
Reply With Quote
  #2  
Old 16th February 2009, 12:21 AM
cruiseoveride Offline
Registered User
 
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
Reply With Quote
Reply

Tags
linux, lvm, mdadm, raid5, raid6

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


Current GMT-time: 07:33 (Monday, 01-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat