
Creating a software raid of disks is quite easy in Ubuntu, I will assume the disks are attached (physically or virtually) to the guest operating system.
Currently Ubuntu supports the following raid levels:
- RAID level 0
- RAID level 1
- RAID level 2
- RAID level 3
- RAID level 4
- RAID level 5
- RAID level 6
- RAID level 10
- RAID level 50
- RAID level 0+1
In this example I am using sdb1 and sdc1 disks and settings the raid to a mirror (1) with a total mirrored size of 4TB (3906885440K)
- Install mdadm (if not already installed)
1 | apt-get update && apt-get install -y mdadm |
- Run mdadm to create the mirror
1 | mdadm --create --verbose /dev/md0 --raid-device=2 --level=1 /dev/sdb1 /dev/sdc1 |

- Run mkfs.ext3 to create a ext3 filesystem on the mirror volume
1 | mkfs.ext3 /dev/md0 |

- Mount the mirror by creating a mount point and running mount to mount the md0 volume
1 2 | mkdir /mnt/raid1 mount /dev/md0 /mnt/raid1 |

- Check to see if you can see the mirror
1 | df -h |

- Check the status of the build
1 | cat /proc/mdstat |

- Add to fstab to auto mount on startup
1 2 | vi /etc/fstab /dev/md0 /mnt/raid1 ext3 defaults 0 0 |
Leave a Reply