Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I currently have a file server with 3 1.5TB disks in a RAID5 array. Since it's pretty much full, I got three additional disks (also 1.5TB each).

Now I'd like to switch to RAID6 since 6TB space is enough and I'd like to have the increased safety of raid6. While I do have a full backup - i.e. I could simply create a new array and restore the backup - I'd prefer to switch without having to restore a backup. Is this possible and if yes, how?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

The terminology you are looking for is a "RAID level migration".

According to this, it's possible. I haven't done it, but the procedure looks like you should add the new drive as a hotspare to the existing array, then use mdadm to update the raid level and the number of raid devices..

You'll need a recent mdadm to do this: mdadm-2.6.9 (eg, centos 5.x) doesn't seem to support it, but mdadm-3.1.4 (eg ubuntu 11.10) does:

   Grow   Grow (or shrink) an array, or otherwise reshape it in some way.  Currently supported growth options including changing the active size of component devices and
          changing the number of active devices in RAID levels 1/4/5/6, changing the RAID level between 1, 5, and 6, changing the chunk size and  layout  for  RAID5  and
          RAID5, as well as adding or removing a write-intent bitmap.

EG, add a new hotspare device, /dev/sdg, to the RAID5 array first:

$ sudo mdadm --manage /dev/md/md0 --add /dev/sdg

Then convert into a RAID6 array and make it rebuild to a clean state. The --raid-devices 4 tells you how many drives you have in total in the new array.

$ sudo mdadm --grow /dev/md/md0 --raid-devices 4 --level 6

I have no idea how quick this will be though. In my experience with doing raid level migrations on hardware RAID controllers, it's been quicker to create the new array from scratch and recover your backup to it.

share|improve this answer
1  
Migrating a RAID 5 to RAID 6 has two slow operations - re-striping the data across the disks and calculating the second parity value for the extra parity disk. Wipe/restore will probably take the same amount of time as the resize. –  Andrew Jan 19 '12 at 1:38
1  
It also requires a certain kernel version. Found this out the hard way. –  Sirex Jan 19 '12 at 13:27
    
Since I'm on gentoo both my kernel and mdadm are pretty recent versions - so that shouldn't be a problem. –  ThiefMaster Jan 19 '12 at 14:54
    
--raid-devices 4? Are you sure it's not 6? From what I read in the manpage, it's the number of active non-spare devices and in RAID6 there is no "spare" device. –  ThiefMaster Jan 19 '12 at 14:55
    
@ThiefMaster: If you added three disks, it will be 6, not 4. –  SvW Jan 19 '12 at 17:59
show 3 more comments

Obligatory warning: Plan for failure. Keep a backup ready and take possible downtime into account.

Also, test it in a VM or something similar before, this is from my notes and I haven't done this in a long time. This might be incomplete.

  1. You will need to add the disks to the array:

    mdadm --manage /dev/md0 --add /dev/sdf  
    

    Do this for each of the three disks and replace the device names accordingly.

  2. Grow the array:

    mdadm --grow /dev/md0 --level 6 --raid-devices 6 
    
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.