How to create a mirror (raid-1) of an already setup and running ubuntu 12.04 system?

1

2

I have a fully setup ubuntu 12.04 installed on a single drive and formatting it just to setup raid-1 is not an option

Unlike other answers like this one: Ubuntu 12.04 - Add RAID 1 Array on existing device?

I am trying to have a mirror of the entire disk to another secondary drive, not just a folder.

Note that the second drive is the exact same model ssd drive as the first one, and currently is empty

I would like to have a mirror drive so in case any of the two drives fail the system will continue to be working. I could not find a decent tutorial on how to do that on an already running system.

Thank you!

George Pligoropoulos

Posted 2012-12-04T12:47:40.023

Reputation: 83

1How is that different from the post you linked to, except for leaving off the partion number and selecting a whole drive? (mdadm --create /dev/md0 -n 2 -l 1 /dev/sda missing, move to /dev/md0, boot that and mdadm --manage /dev/md0 -a /dev/sda ?) – Hennes – 2012-12-04T12:55:52.293

Well I am trying to be a little cautious for obvious reasons. What I am still missing is how to setup ubuntu to boot from the raid-1 and if one the drives fails to boot from the working one. Thanks for clarifying – George Pligoropoulos – 2012-12-04T13:01:12.743

How to set up U to boot from the RAID: 1) Create the RAID. 2) point GRUB to the next device (change sdaX to md0x).---- If one of the drives fails.. so what. That is why you have a mirror. You should will still be able to boot from a degraded mirror ---- And not asked, but before doing anything you are not comfortable with, step 0 is always a backup. – Hennes – 2012-12-04T13:20:07.693

@Hennes: I tried your solution but I got this error: mdadm: cannot open /dev/sda: Device or resource busy.
Should I try to execute these from a live cd? (I tried from the terminal of the installed ubuntu)
– George Pligoropoulos – 2012-12-04T19:03:34.720

Create the mirror starting with the drive which is not already in use. If you booted from sdb, then use the mdadm to create sda. If booted from sda, create the initial mirror with sdb. (or hda/hdb if your kernel names them thusly). – Hennes – 2012-12-04T22:42:46.873

No answers