[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 786
  • Last Modified:

create raid 1 with OS already installed - Ubuntu

hi all,

i recently installed Ubuntu server edition and because i'm a total noob to Linix i needed a GUI so i installed ubuntu-desktop like so.

sudo apt-get install ubuntu-desktop

In this box i have 3 x 650GB HDs. What i'd like to do is have two disks in RAID 1 with the third disk as a hot spare.

can someone please give me some simple instructions on how to do this either by using a GUI or the CLI.

I've looked for some software to do this but i cant seem to find any.

many thanks

  • 5
  • 4
1 Solution
does your server/PC have a RAID controller in it? You will want to have a hardware RAID adapter and then configure the disks in the BIOS of the controller. Then you will need to reinstall Linux on the new RAID drive.
bede123Author Commented:
no i dont want to use hardware raid.
I would personally recommend NOT using software raid, but this looks like a decent guide;
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

bede123Author Commented:
many thanks jammypak,

in fact i used those instructions already when i was trying to setup raid but because it didnt work i gave up and installed just one to one disk as i thought i maybe able to set it afterwards.

the problem with those instructions is this bit:

6. Repeat steps 2 to 5 for the other hard drive

if i do this the setup wont allow me to continue because it says something about there being no file system set, but you can choose a file system like ext4 for example as well as choosing the raid option. also by booting from teh CD again it will reinstall the entire OS again and i'd like to avoid this is poss.
I don't think you'll have a choice but to reinstall either way. I've never seen taking an existing partition and making a RAID set out of it without destroying and recreating the partition.
bede123Author Commented:
yes it seems all the info online i can find agrees with you.

i will start te install process off again tonight when i go there.

can i ask you please:

I enter into the manual configuration section of the partition manager and i can see my three disks.

if i want RAID 1 + 1 spare should each disk be seperatly partitioned? if so what are the partitions that i require?
usually with a RAID controller you create the raid array once and it sets up the drives all at once , then you assign a hotspare afterward. Based on the ubuntu link, it look s like you have to partition the drives separately and then setup the SW raid afterwards. the link talks about specifying a drive as 'spare' but it 's not obvious whether it's actually a hotspare or not. It looks like you can do it with 'raidhotadd' command
bede123Author Commented:
ok thanks. what is SW please?
Here is instructions I used to build a RAID 5 with three drives, /dev/sdb[abc]

Create full disk partition on each drive using fdisk.  Partition type should be DA.

Build RAID:
# /sbin/mdadm --create /dev/raid0 -v --level raid5 --raid-devices 3 --metadata 1.2 --auto md /dev/sd[abc]1

# mdadm --examine --scan > /etc/mdadm.conf
  Edit to add "auto=md" and change /dev/md/raid0 to /dev/raid0.

I recommend that you use RAID 5, not RAID 1.  See Wikipedia for differences

I recommend that you use LVM on the RAID:
  Create physical volume:
  # /usr/sbin/pvcreate /dev/raid0

  Create volume group with 32Mb extents (OK for up to 2TB):
  # /usr/sbin/vgcreate -s 32M lvm-raid /dev/raid0

  Activate volume group:
  # /usr/sbin/vgchange -a y lvm-raid

  Create logical volume:
  # /usr/sbin/lvcreate -L 30G -n <volname> lvm-raid

  Format logical volume (ext3):
  # /sbin/mkfs.ext3 -v -m .1 -b 4096 -E stride=64 /dev/lvm-raid/<volname>
bede123Author Commented:
right, finally got this sorted.

id DID require me to reinstall the os but at least i got it working. the best  instructions i foound was these ones:


however where it says set the bootable flag to on from off you can forget this bit. there is not need to do. it wont let you do it anyway so dont waste time trying.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now