9

I have a RAID1 currently operating on a single hard drive (yes, the mirror is absent). Is it possible to reorganize my system using the following algorithm?

  1. I set up another single-disk RAID1 (onto another HDD of the same type), partition it and install a new instance of Debian on it.
  2. I mount the old single-disk RAID1 setup and copy all the data from it to the new RAID.
  3. I then reformat the old disk and include it into the new RAID setup.

I mostly doubt the second point - how should I do it?

3
  • 2
    why not boot from your existing raid hdd and add the new one to the raid and let the raid software do the sync?
    – Christian
    Jan 16, 2010 at 12:47
  • LVM, or MD RAID? Jan 16, 2010 at 12:54
  • Because the existing RAID setup is made of a single ext3 partition, while I want to build an LVM-based system on top of it.
    – dpq
    Jan 18, 2010 at 15:22

2 Answers 2

4

Well, I did it, and it turned out to be quite painless: the old RAID setup was automatically detected as /dev/md0, so all I had to do was mount /dev/md0 /mnt, then copy all the data from it to whereever appropriate.

After that I issued:

mdadm --stop /dev/md0
mdadm --remove /dev/md0
sfdisk -d /dev/sda | sfdisk /dev/sdc
mdadm --add /dev/md1 /dev/sdc1
mdadm --add /dev/md2 /dev/sdc2
mdadm --add /dev/md3 /dev/sdc3

If I understand everything correctly, that was all I needed to do, since mdadm --detail now reports the drives to be actively synced.

2

You could do it the way you propose, but as Christian mentioned in the question comments, you can also just light up the existing drive as an existing RAID array and add another drive to it to re-establish redundancy. It all depends on whether you've got an existing system to play with, I guess, but if the existing disk has an OS on it, you can boot it (doing the grub dance might take a few minutes to work out, but it'll work).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .