Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 '10 at 12:47
    
LVM, or MD RAID? –  David Mackintosh Jan 16 '10 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 '10 at 15:22

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.