Create a software RAID1 with mdadm on an active Ubuntu 13.04 till 16.10 hard drive
LinuxToday we want to create a RAID1 array with an active Ubuntu 13.04 till 16.10 hard drive. I installed my server without a RAID array on a single hard drive. And now, after spending a lot of hours configuring it, I want to create a RAID1 array to have a security if one of the hard drives fail. Create a simple RAID1 array is easy with mdadm, but creating it with a hard drive that has data on it isn't that simple.
I created the following howto with the help of this older blog post about the same problem: http://feeding.cloud.geek.nz/posts/setting-up-raid-on-existing
Use this article with caution because this is the solution for my machine and I don't know if it works on other machines, but I gave my best to test everything in a virtual machine and on my server with the UEFI boot mechanism. Also create a backup of your hard disk first: Create a CloneZilla disk image
Ok let's start and we first need to install the following packages:
If you havent already installed postfix, set the option 'no configuration' for the postfix installation dialog.
First attach your new hard drive (best to have one with the same size or bigger) and then execute the following commands to copy the partitions of /dev/sda to the second drive (in my case /dev/sdb):
If you have a GPT partition table you need to install gdisk and copy the partition table with the following commands:
The first command here copies the partition table from /dev/sda to...
/ 23/