Converting a single system disk to RAID1

I wish to convert a server (openSuse v11.4, soon to be 12.3) with a single system disk drive to a two-disk RAID1 array. The current single disk is 250GB; the replacement RAID disks are 500GB.

Here is my plan for preparing the array. The first part creates the enlarged partitions on the array, and copies the original disk data to the new disks. The second part creates the RAID.

----Part 1----
Boot to a “Live CD”, e.g.: Knoppix

Existing (single) disk:

/dev/sdb2 on / type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/sdb3 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/sda1 on /data01 type ext3 (rw,relatime,errors=continue,user_xattr,acl,commit=15,barrier=1,data=ordered)

/dev/sda1 230G   97G  121G  45% /data01

/dev/sdb1   2G                  swap
/dev/sdb2  20G   14G  5.6G  71% /
/dev/sdb3 130G  1.1G  122G   1% /home

Partition and format the two new disks, 500GB (say they are mounted as /dev/sdj and /dev/sdk)

  • Create with “linux RAID” file system ID (0xfd)
  • Create to mount at boot time
/dev/sdj1   2G swap
/dev/sdj2  98G /
/dev/sdj3 400G /home

/dev/sdk1   2G swap
/dev/sdk2  98G /
/dev/sdk3 400G /home

Then

dd if=/dev/sdb1 of=/dev/sdj1
dd if=/dev/sdb2 of=/dev/sdj2
dd if=/dev/sdb3 of=/dev/sdj3

dd if=/dev/sdj of=/dev/sdk

----Part 2----
Here is where it starts to get fuzzy. I have searched for methods to do this. The several tutorials conflict in a number of ways. For instance, is </dev/md0> all that is needed? Or should there be a </dev/mdX> for each disk in the array? I suspect the conflicting information is due to when each article was published, some in 2008, others in 2011.

From <raid.wiki.kernel.org/index.php/RAID_setup>:

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2
mdadm --scan --assemble --uuid=uuid-of-sdj:uuid-of-sdk
mdadm --monitor /dev/md0

where the uuid-of-sdX is of the form “86055940-90ad-4009-8fc9-3215bf2cf751”

Questions:
Is that above correct? And in the correct order?
Can these RAID steps be performed with the YAsT Partition (graphical) editor?
I presume Part 2 is performed before booting the system? Does it matter?
Is /dev/md0 entered in /etc/fstab in some way?

How to boot from /dev/md0?

jimoe666 wrote:
> I wish to convert a server (openSuse v11.4, soon to be 12.3) with a
> single system disk drive to a two-disk RAID1 array. The current single
> disk is 250GB; the replacement RAID disks are 500GB.
>
> Here is my plan for preparing the array. The first part creates the
> enlarged partitions on the array, and copies the original disk data to
> the new disks. The second part creates the RAID.

No.

You create the RAID first. Then create a filesystem inside it (or more
commonly, put LVM on the RAID and then create one or more filesystems
inside that). Then copy data into the filesystem(s).

And if you’re using openSUSE, you use YaST to do most or all of that.

But first, it’s probably better to stop thinking about the
technicalities of how, and explain the why of what your goal is.

The why is to have a reliable system drive. Rather than a crash and burn when the disk unit fails, I’d prefer an alert and replacement.

Your mostly on the right track, but missing a few steps.

Check out this Arch guide: https://wiki.archlinux.org/index.php/Convert_a_single_drive_system_to_RAID

Similarly, there is this tool which can help migrate Convert a single drive system to RAID - RAIDER

Those both suppose you are adding a new drive that is the same capacity as your existing drive. They create a single disk raid on the newly added drive with the second member marked as missing, then copy data onto it, then added the second member and rebuild. There are lots of little details along the way.

I think the easiest route would be to first migrate your 250GB drive onto one of the 500GB drives, this should be very easy. Clonezilla can do so and can automatically increase the partition size on the new drive and automatically extend the fs on it, however you can’t fine tune how much to extend which partition. In your case though, its pretty straight forward, so Clonezilla might be perfectly acceptable.

Once you running with sda on one of the new 500GB drives you should be able to use raider (or manually) to add the other 500GB drive and convert to RAID1