LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   mdadm RAID5 when one of your drives contains your data? (http://www.linuxquestions.org/questions/linux-hardware-18/mdadm-raid5-when-one-of-your-drives-contains-your-data-729387/)

1veedo 05-29-2009 03:01 PM

mdadm RAID5 when one of your drives contains your data?
 
I have three drives and want to put them in RAID5. The problem is, one of the drives currently contains the data I want on the raid array.

I was thinking that maybe I could create a RAID0 out of the other two, move my data over, and somehow add the other drive and turn it into RAID5? The harddrive is encrypted so it wont be able to tell that any of the drives contain data.


edit -- Is it possible to build a partial RAID5 array from two drives and then add the third drive and have it "rebuild" the data, almost as if you had a drive die on you??

blacky_5251 05-29-2009 06:48 PM

RAID5 arrays have the data striped across all disks, so you can't build an array with the existing disk partitions.

Is there any spare space on your current disk? If there is (even if you need to use GParted to shrink your existing partition sizes) you could create a new RAID array using the spare space on your current disk together with the other disks, and then repeatedly migrate data, shrink the original disk partitions, and increase the array size using the freed space. If you did this incrementally you should be able to get there, but it could depend on what your current disk holds.

Does it store your Op/Sys or just data? If it is just data, then you can do it. If it is Op/Sys, you might want to boot from a LiveCD to achieve your aims.

1veedo 05-29-2009 09:04 PM

Currently it holds my OS but I'm moving that to another HD soon. I think I can manager about 400GB free on my 1TB (931GB) drive (if I move some other files over as well).

I was hoping to not have any partitions though. Ie be able to create a RAID5 device node directly from sdb sdc sdd. If I do what you're suggesting I'll probably need a partition table and everything.

Is it possible to migrate any RAIDs at all? Like is it possible to go from RAID0 to RAID4?

blacky_5251 05-30-2009 01:59 AM

Not without using partitions...as far as I know anyway. Migrating RAID levels isn't something I've ever done, so perhaps you should ask Google instead ;) They might know more about it :)

1veedo 05-31-2009 07:36 AM

What if I do RAID10 using 6 partitions?

___ ___ ___
a |1| |2| |3|
--- --- ---
b |2| |3| |1|
--- --- ---

Make RAID0s out of row a and row b, then raid1 them. I think this is more adaptable than raid 5. I've already worked on paper how to expand that array. Even if I were to add a 2GB drive it's possible to have a RAID10 with full data redundancy. The only thing I dont know about is if partition b2 is going to be identicle to partition a2. If they're not exactly the same it would be a waste, and seeing as how the partitions are slightly different in size, the two RAID0 arrays could be off by a few blocks from each other... Maybe it's better to RAID1 each pair and put those pairs in RAID0...

I've been trying to create a RAID0 out of the top three though just to see how everything works but I've been getting errors.

edit --
Code:

mdadm --create --verbose -l 0 -n 3 /dev/sdb1 /dev/sdc1 /dev/sdd1
mdadm: You haven't given enough devices (real or missing) to create this array

Then sdb1 errors any time I try to do anything with it; "/dev/sdb1: can't read superblock". I have to reboot to access sdb1 again. sdc1 and sdd1 continue to work just fine.

I also get an md device.

"mount: special device /dev/md127 does not exist"
"mdadm: md device /dev/md127 does not appear to be active."

I dont understand why it doesn't work. I give it three devices, tell it I want to use three devices, then it tells me I didn't give it enough devices to make the array. I'm doing it exactly as I've seen in examples on the web, and these errors show up nowhere.

1veedo 05-31-2009 01:31 PM

Ok I got it working. Aftering reading some more and cleaning all the superblocks etc I got it to work with RAID0. Raid10 is is "experimental" in the kernel. Usually not something I worry about but I figure it would be just as easy to raid 1 all three partitions and then raid 0 that, to ensure that the "matching" partitions are compatible. I'm not sure how much that would slow down performance. I still have to encrypt everything as well, but right now hdparm is showing amazing results for the current raid0 array.
Code:

hdparm -t /dev/md0

/dev/md0:
 Timing buffered disk reads:  888 MB in  3.00 seconds = 295.94 MB/sec

Code:

hdparm -t /dev/sdb1 /dev/sdc1 /dev/sdd1

/dev/sdb1: [Western Digital Caviar Black WD1001FALS]
 Timing buffered disk reads:  306 MB in  3.00 seconds = 101.98 MB/sec

/dev/sdc1: [Seagate ST31000528AS]
 Timing buffered disk reads:  370 MB in  3.01 seconds = 122.96 MB/sec

/dev/sdd1: [SAMSUNG HD103UJ]
 Timing buffered disk reads:  300 MB in  3.00 seconds =  99.96 MB/sec

Once I get everything figured out I'll post some more benchmarks using encryption and everything.

1veedo 06-06-2009 01:41 AM

edit it's late I got it


All times are GMT -5. The time now is 08:57 AM.