Ubuntu on VirtualBox with Windows 10 Pro: Configuring RAID1+0 on Two External USB Disks
Setting up a RAID1+0 array on two external USB disks in Ubuntu, running on VirtualBox with Windows 10 Pro, can be a complex process. This article will guide you through the necessary steps to achieve this setup. Unfortunately, the author's server suddenly restarted, causing the disks to get repartitioned. However, this misfortune can be turned into an opportunity to learn about RAID arrays and how to set them up in Ubuntu.
What is RAID?
RAID stands for Redundant Array of Independent Disks. It is a technology that combines multiple physical disks into a single logical unit to improve performance, reliability, or both. There are several RAID levels, each with its own advantages and disadvantages. In this article, we will focus on RAID1+0, also known as RAID10.
RAID1+0: The Best of Both Worlds
RAID1+0, also known as RAID10, combines the advantages of RAID1 and RAID0. RAID1 is a mirroring technique that provides redundancy by writing the same data to two disks. RAID0 is a striping technique that provides increased performance by writing data across multiple disks. RAID1+0 combines these two techniques to provide both redundancy and increased performance.
Setting Up RAID1+0 in Ubuntu
To set up RAID1+0 in Ubuntu, we need to create a RAID1 array with two disks and then create a RAID0 array with the two RAID1 arrays. The following steps will guide you through this process:
- Connect the two external USB disks to the Ubuntu system.
- Identify the disks using the
lsblkcommand. For example:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 24M 1 loop /snap/canonical-livepatch/95
loop1 7:1 0 88.8M 1 loop /snap/core/9066
loop2 7:2 0 43.2M 1 loop /snap/gnome-calculator/406
loop3 7:3 0 43.2M 1 loop /snap/gnome-calculator/446
loop4 7:4 0 43.2M 1 loop /snap/gnome-characters/296
loop5 7:5 0 43.2M 1 loop /snap/gnome-characters/317
loop6 7:6 0 43.2M 1 loop /snap/gnome-logs/61
loop7 7:7 0 43.2M 1 loop /snap/gnome-logs/70
loop8 7:8 0 43.2M 1 loop /snap/gnome-system-monitor/141
loop9 7:9 0 43.2M 1 loop /snap/gnome-system-monitor/149
loop10 7:10 0 43.2M 1 loop /snap/gnome-terminal/170
loop11 7:11 0 43.2M 1 loop /snap/gnome-terminal/173
loop12 7:12 0 43.2M 1 loop /snap/gnome-terminal/180
loop13 7:13 0 43.2M 1 loop /snap/gnome-terminal/185
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 16G 0 part [SWAP]
└─sda3 8:3 0 914.9G 0 part /
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part
sdc 8:32 0 931.5G 0 disk
└─sdc1 8:33 0 931.5G 0 part
sdd 8:48 0 931.5G 0 disk
└─sdd1 8:49 0 931.5G 0 partIn this example, the two external USB disks are /dev/sdb and /dev/sdc.
- Create a RAID1 array with the two disks using the
mdadmcommand. For example:
$ sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdc
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
create a bootable array, use --metadata=1.6 instead.
mdadm: size set to 1953517952K
mdadm: automatically enabling write-ahead log for level 1
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.This command creates a RAID1 array with two disks, /dev/sdb and /dev/sdc, and names it /dev/md0.
- Format the RAID1 array using the
mkfs.ext4command. For example:
$ sudo mkfs.ext4 /dev/md0
mke2fs 1.45.5 (07-Jan-2020)
Discarding device blocks: done
Creating filesystem with 244198912 4k blocks and 61055488 inodes
Filesystem UUID: 5b5d6f0b-2e0e-4b6c-86f1-34f028c8c8f4
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: doneThis command formats the RAID1 array with the ext4 filesystem.
- Create a RAID0 array with the two RAID1 arrays using the
mdadmcommand. For example:
$ sudo mdadm --create /dev/md1 --level=0 --raid-devices=2 /dev/md0 /dev/md2
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md1 started.This command creates a RAID0 array with two RAID1 arrays, /dev/md0 and /dev/md2, and names it /dev/md1.
Setting up RAID1+0 in Ubuntu can be a complex process, but it provides both redundancy and increased performance. By following the steps outlined in this article, you can create a RAID1+0 array on two external USB disks in Ubuntu, running on VirtualBox with Windows 10 Pro. The author's misfortune of a suddenly restarted server can be turned into an opportunity to learn about RAID arrays and how to set them up in Ubuntu.