• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

linux raid question

Red Squirrel

No Lifer
I have a raid 1 with 2 1TB drives in my curent server. I want to move that to a raid 5 to my new server, tricky part is I want to use those drives AND keep the data.

So what I'm thinking of doing is:

1: Remove one drive from the raid 1, as it will still function with 1 drive,

2: Build the raid 5 with 2 drives as it will still function

3: Transfer the data over

4: get the drive from the raid 1 to finish off the raid 5.


Step 4 is the part that is tricky. Last time I tried something similar, it wiped the whole raid array when I added an extra drive to it. Is there a way to do this without it wiping the data? I'll be backing it up before doing this but I'm hoping to not need to use those backups.
 
Now, I haven't done this, so I don't know the exact commands, but this sounds completely doable.

Take disk 1 and 3 (drive 3 being the new one), and create the RAID 5 and mark the last drive as being missing (mdadm definitely allows this, but not recommended obviously). Then transfer the data, and add the last drive. You will then need to get mdadm to rebuild, to spread the data across the disks, but this should work fine without losing anything, just make sure the computer doesn't shut down during that time.

I'm just not sure how mdadm handles an incomplete RAID 5 array, if you will have enough disk to load up all the data.
 
Yeah thats what I tried last time, but think what the issue was is with only 2 drives it thought it was a raid 0 and not a raid 5. If I specify raid 5 then it will only let me continue if I specify 3 hard drives. Unless I can like, use /dev/null as the 3rd one then change it after, but doubt that would work.
 
No, you can specify 3 drives, but that one of them is missing. I think (but not sure, needs testing) that you can set -n 3 (3 devices), but specify 2 of them, and it will assume the last one is missing. you may have to --force it..

I am going to try this in a VM, see what I find. going to take a few minutes though.

http://man-wiki.net/index.php/8:mdadm all the info you should need.

Ok, this *seems* to work:

mdadm --create /dev/md0 -n 3 --level 5 /dev/sd[bc]1 missing

**creates degraded RAID 5 array. change device names as necessary. also, add things like chunk sizes and so on, as required for your environment.

then you create the FS, probably on LVM I guess, and transfer data across

Then:

mdadm --add /dev/md0 /dev/sdd1

**add the last drive

Obviously there are some steps missing here, which I assume you can handle, in terms of using fdisk to create the software raid partitions on each drive. If you need more detail about any steps, let me know.
 
Oh ok that seems to make sense, I'm backing up data atm and I'll give it a try when I'm ready to start the migration to the new server. 2TB raid array here we come, this should be fun.
 
Good luck, hope it all works.

EDIT: Never asked, exactly what OS is this? I tested on CentOS 5.2, so pretty recent. if yours is older, let me know and I will try and test it on something similar.
 
Back
Top