Categories
Hardware Linux

Ubuntu Server-Reinstallation and re-configuring existing Raid1

Following on from my article on Setting up and Managing Raid1 on Ubuntu Server, I have been testing the raid using a VirtualBox VM.

Today, I took the VM, consisting of an OS drive (with Ubuntu Server installed) and 2 drives set up in raid 1 configuration and created a new OS drive, replacing the existing OS. The intention is to test inserting a new OS drive, re-installing the OS and getting the raid working again without loosing any data.

Useful Reference the mdadm man page

I installed the OS and installed mdadm as per the instructions in my previous post.

All commands are issued as root / sudo

So let’s see if can obtain any information about the raid, we’ll see what it knows about sdb1 which was part of the raid 1 with sdc1:

mdadm –examine /dev/sdb1

It successfully detects that the drive has a superblock and knows that it was part of a raid with /dev/sdc1. See the last two lines of the output.

So lets try to re-assemble the raid.

mdadm –assemble /dev/md0 /dev/sdb1 /dev/sdc1

It responds saying /dev/md0 has been started.

So now we only need to create a mount point

mkdir /raid

and mount it

mount /dev/md0 /raid

We have successfully mounted the raid so let’s now put an entry in fstab so it mounts at startup.

nano /etc/fstab

add

/dev/md0           /raid          auto     defaults        0      0

reboot and all should be working.