LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Create a RAID-1 of the boot disk and a new disk (https://www.linuxquestions.org/questions/linux-server-73/create-a-raid-1-of-the-boot-disk-and-a-new-disk-586358/)

Oskare100 09-21-2007 10:52 AM

Create a RAID-1 of the boot disk and a new disk
 
Hello,
I had one disk before (/dev/sda) with two partitions, one swap and one ext3 where all the files are located. Now I've added a second disk (/dev/sdb) and want to create a RAID-1 disk of the two disks (based on the current /dev/sda disk). How can I do that? I've installed mdadm but I can't figure out how to create the RAID-1 since I'm running the system on /dev/sda.

Best Regards
Oskar R

Micro420 09-21-2007 11:23 AM

partition your /dev/sdb similar to /dev/sda. I personally would use fdisk
Code:

fdisk /dev/sdb
Another user on here, i_grok, helped me and also mentioned that you could use the sfdisk command, but I haven't tried it. It's suppose to replicate the partitions to the other drive. For example,
Code:

sfdisk -d /dev/sda1 | sfdisk /dev/sdb1
After, create the initial /dev/md0, /dev/md1, etc...

Code:

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1
mdadm --create --verbose /dev/md1 --level=1 --raid-devices=2 /dev/sda2
etc...

Now sync up /dev/sdb with /dev/sda
Code:

mdadm /dev/md0 --add /dev/sdb1
mdadm /dev/md1 --add /dev/sdb2
etc...

check the progress of the syncing
Code:

cat /proc/mdstat
You can always find more information
Code:

man mdadm
I could be wrong about all this, though. I've only done the software RAID once or twice and am recalling this from memory.

You can also google up this question as there are tons of articles online that will explain this

Oskare100 09-21-2007 04:45 PM

OK, I'll try that, however, I created /dev/md0 and /dev/md1 now by misstake when I tried another guide and now I can't remove them... They are (or should be) based on /dev/sdb1 and /dev/sdb2. How can I remove /dev/md0 and /dev/md1 now to be able to continue without reinstalling the system again?

Micro420 09-21-2007 07:45 PM

try
Code:

mdadm /dev/md0 --manage --stop
mdadm /dev/md0 --manage --remove
etc...



All times are GMT -5. The time now is 12:39 AM.