How to convert existing disk to raid1 in debian

1

I have 1Tb drive with LVM on it. Now I've installed another 1Tb hard drive. And I want to make RAID1 without losing data on the first disk. Is there any way to do that without backing up data and then restoring it? OS: Debian 5

ehpc

Posted 2012-05-30T09:31:12.517

Reputation: 123

I would recommend you back up the disk drive if you have anything important on it that you can't afford loosing. – Samir – 2012-06-13T22:51:09.337

Just did that, following these instructions: http://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-debian-squeeze

– starblue – 2013-01-19T21:13:34.733

Answers

1

Yes.

Create a new RAID1 specifying your new disk device and "missing" for the second disk device. This will start up a degraded RAID1 which will be fully working. You can the configure LVM on the resulting md device and get it all working how you like, copy your data across onto it.

Once convinced that you have everything working just right, and have backups of your data just in case, blow away your old drive (unmount it, vgchange -an to deactivate LVM, may need to overwrite the disk with dd or similar to obliterate any LVM metadata..). Now add your old drive into the RAID1, thus healing it.

grifferz

Posted 2012-05-30T09:31:12.517

Reputation: 676