How to Convert a Linux RAID 0 Disk Array to a RAID 1?
If for some reason, you've decided to move away from RAID0 in favor of RAID1, the following How To is based on my experience making the switch.
Boot using some sort of Live CDI prefer KnoppixWH.performance.mark('step1_rendered');
Mount your RAID0 arraymdadm --assemble /dev/md5 /dev/sda5 /dev/sdb5mount /dev/md5 /media/md5I was modifying array md5 so that's what I'll use for this articleKnoppix uses /media instead of /mnt so you will see this path occur throughout this HOWTO
Mount the drive you'll be saving your backup toI was using an external hard drive with an NTFS file systemntfs-3g /dev/sdc1 /media/ext
Backup your data to your backup drivefind -depth -print0 /media/md5 -print | cpio --null -o -Hnewc > /media/ext/linux-md5.cpio
Create your new RAID1 arraymdadm --create --verbose -e 0.90 /dev/md5 --level=1 --raid-devices=2 /dev/sda5 /dev/sdb5Press "y", "Enter" to allow to create the array even though there is already an array on these drives.The "-e 0.90" switch enables the old-style super block for those who do not want to have to deal with an initrd. If you're comfortable with initrd, this switch is unnecessary.
Watch the progress of the workwatch -n 5 cat /proc/mdstat
Create a file system on the new arrayI like ReiserFSmkreserfs /dev/md5
Mount the new filesystemmount /dev/md5 /media/md5
Copy the backup back to the drivecpio -i < /media/ext/linux-md5.cpio
Update your system's /etc/mdadm.confmdadm --detail --scan >> mdadm.conf>The location of the mdadm.conf is left to the reader as it may/may not be on the new array.
Use an editor to replace the old array description from /etc/mdadm.conf with the new one just echoed into the file.
If the newly created array contained /boot, you might consider setting up grub or lilo on the MBR again while you're on the LiveCD: nothing will be harmed by doing it again if it isn't necessary.
Reboot!
View more
Comments
Post a Comment