5

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

4
  • 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, 2013 at 18:32
  • BTW before you would grow you would add the 2 other drives as spares.
    – drescherjm
    Jun 21, 2013 at 19:32
  • Similar question: serverfault.com/questions/43677/… Feb 6, 2014 at 17:29
  • @KevinPanko Exact duplicate! Oh well, he got my upvote Feb 6, 2014 at 17:35

2 Answers 2

11

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. I also wrote a blog entry about my experience, including pictures.

14
  • 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). Oct 3, 2015 at 20:06
  • @Jonathan already posted as a comment to the question Oct 3, 2015 at 21:31
  • Oh, right. Although, I believe it bears mentioning that specific difference explicitly. Oct 3, 2015 at 21:40
  • 1
    @Gaia Yes, as long as at least one of the disks stays online. However, if the system is a very busy one, it may be worthwhile (and, actually, recommended) to do it offline with a LiveCD or similar. You don't want to be pounding against both copies of your data while trying to recover Dec 2, 2019 at 1:45
  • 1
    @Gaia Make sure you have good working backups first! Last thing I want is someone blaming me if they mistype a command and break something they didn't mean to Dec 2, 2019 at 4:42
-1

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.

2
  • 1
    Uhhh... What? 15 character minimum Jun 21, 2013 at 18:52
  • @Luke Software RAID to me about it ... youtube.com/…
    – STTR
    Jun 21, 2013 at 19:34

You must log in to answer this question.

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