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

My home network is changing and I am moving my file storage solution away from my Ubuntu server and onto a Drobo FS.

I currently have 6 500GB hard drives in a RAID 6 array providing 2TB of capacity. All important data on the existing RAID 6 array has been copied to the Drobo and thus the array can be rebuilt without thought as to data loss.

Here is the description of the RAID setup:

marcus@vhost:~$ cat /proc/mdstat 
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid6 sda1[0] sdf1[5] sde1[4] sdd1[3] sdc1[2] sdb1[1]
      1953535744 blocks level 6, 64k chunk, algorithm 2 [6/6] [UUUUUU]

unused devices: <none>

The End Result

I wish to end up with 2 500GB drives left in a RAID 1 array providing 500GB capacity, and as a result 4 free 500GB hard drives (some of which will be added to the Drobo).

What is the best way to achieve this, does it involve shrinking the array and then changing the RAID level?

Thanks for any help,

Marcus.

share|improve this question

5 Answers 5

up vote 4 down vote accepted

Since you don't care about any data now on the disks, just destroy the array and create another one. Let's see: stop the array, remove all the disks (I'm not sure this step is necessary), zero out the superblocks to avoid any warning down the line, and create a RAID1 array. This should look like (obviously I'm not going to test this...):

mdadm /dev/md0 --stop
mdadm /dev/md0 --fail /dev/sd{a,b,c,d,e,f}1
mdadm /dev/md0 --remove failed
mdadm --zero-superblock /dev/sd{a,b,c,d,e,f}1
mdadm --create /dev/md0 --level=1 -n 2
mdadm /dev/md0 --add /dev/sd{a,b}1
share|improve this answer

I'm not sure I completely understand your issues here. If all the data has already been copied, you can just delete the RAID device, remove all the disks from the box you want to use elsewhere and re-create a new RAID 1 device with the remaining two disks. You can't shrink a 6 disk RAID 6 down to 2 disks without data loss anyway.

If you still want to copy some data to the new device, you could fail two disks from the old one and create a new RAID 1 from them. Since it's RAID 6 it will tolerate the loss of two disks (but you won't have the redundancy anymore). Then you can copy the data and remove the RAID 6 afterwards.

share|improve this answer

The simplest solution is probably to just disassemble the array and delete it, then build a RAID1 from scratch with the two drives you want in it.

share|improve this answer

Gilles: Last time I zeroed out the superblock, it took about 12 hours on each 750GB drive (I was using a command involving 'dd'). How long does the command

mdadm --zero-superblock /dev/sd{a,b,c,d,e,f}1

take?

share|improve this answer

As of version 3.1, mdadm actually supports quite complex level changing, as explained in Converting RAID5 to RAID6 and other shape changing in md/raid - so in this case:

A RAID6 can change the number of devices, the size of the individual devices, the chunk size and the layout. And RAID6 can be converted to RAID5 by first changing the layout to be similar to RAID5, then changing the level.

A RAID5 can change the number of devices, the size of the individual devices, the chunk size and the layout. A 2 drive RAID5 can be converted to RAID1, and a 3 or more drive RAID5 can be converted to RAID6.

You'll need Ubuntu 11.04 (Natty) to get mdadm up to version 3.1 though.

share|improve this answer

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.