Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In my current Ubuntu server, I have 2x 2TB Western Digital RED hard drives in a RAID 1, using mdadm. I would like to add 2 more 2TB RED drives, and convert it to a RAID 10. I realize I would have to wipe the data most likely, but is there any way that I wouldn't need to? I have the 2TB volume almost completely filled up

share|improve this question
    
I believe the level option of mdadm --grow will allow this. I have used it to go from raid5 to raid6 but not from raid1 to raid10 so I have not tested that. –  drescherjm Jun 21 '13 at 18:32
    
BTW before you would grow you would add the 2 other drives as spares. –  drescherjm Jun 21 '13 at 19:32
    
Similar question: serverfault.com/questions/43677/… –  Kevin Panko Feb 6 at 17:29
    
@KevinPanko Exact duplicate! Oh well, he got my upvote –  Canadian Luke Feb 6 at 17:35
add comment

2 Answers

up vote 1 down vote accepted

This took some strategy, and unfortunately, was a little while ago, so bear with me; I'm going by memory.

Essentially, I shut down the server, and installed the two new drives. I did a backup beforehand to an External 4TB HDD (much faster since it had USB3!), just in case. I didn't need to use it thankfully, but I'm happy I at least had it. I took note of what the partition sizes were on the disk (by block size), and what each disk was. At the time, sda and sdb were the drives with the current array loaded. sdc and sdd were the new drives. I copied the partition layout to the two new disks, using fdisk as root. I then created a new array, with two failed members:

mdadm -v --create /dev/md1 --level=raid10 --raid-devices=4 /dev/sdc1 missing /dev/sdd2 missing

This command creates the array, called /dev/md1, sets the RAID type to 10, and says that there should be 4 devices, in a perfect world. The devices I added were /dev/sdc1 and /dev/sdd1 for the first partition. Once it was up, I mounted the array (as /mnt/raid), and did an rsync -avP /mnt/data/ /mnt/raid/, and waited a day for everything to copy.

Once it was copied over, you need to fail the hard drives in the array, and remove them: mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1. You can then add that hard drive to the new array, and wait for it to rebuild. Then, remove the last drive from the array (using /deb/sdb instead), and add it back (mdadm /dev/md1 --add /dev/sda1).

Finally, to remove the old array from starting up or giving warnings, run mdadm --stop /dev/md0. At this point, the old array is gone! I would suggest double-checking that the boot loader is installed correctly on the array (or, depending on your scheme, the boot sector of the hard drives). Give it a test reboot; if everything comes up, great! If not, that's why we have a backup!

As a bonus, I learned a new useful command: watch cat /proc/mdstat to automatically update the screen every 2 seconds with the rebuilding status of your drives.

share|improve this answer
    
+1 for the watch command –  rob Mar 7 at 17:29
add comment

If the RAID controller supports restructuring RAID 1 -> RAID 10, yes, possible loss of data.

Software RAID ...

Add the empty net RAID 1 on two new HDD. Will Raid c similar reliability and without the risk of losing data.

share|improve this answer
    
Uhhh... What? 15 character minimum –  Canadian Luke Jun 21 '13 at 18:52
    
@Luke Software RAID to me about it ... youtube.com/… –  STTR Jun 21 '13 at 19:34
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.