Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:… – Kevin Panko Feb 6 '14 at 17:29
@KevinPanko Exact duplicate! Oh well, he got my upvote – Canadian Luke Feb 6 '14 at 17:35
up vote 4 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 missing 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 '14 at 17:29
ServerFault has a very similar procedure, with one notable suggestion: try to boot your new array before destroying the old one (it's okay to fail one of the drives in the old array beforehand, but not both). – Jonathan Y. Oct 3 '15 at 20:06
@Jonathan already posted as a comment to the question – Canadian Luke Oct 3 '15 at 21:31
Oh, right. Although, I believe it bears mentioning that specific difference explicitly. – Jonathan Y. Oct 3 '15 at 21:40

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 ...… – STTR Jun 21 '13 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .