This is a proof of concept HOWTO on how to build a RAID array out of USB sticks. This has no real practical application in the real world, but it's pretty cool that you can do it. USB does not make the best transfer method for a speedy filesystem.
Install all the USB sticks you want to build a RAID array on, and verify that the kernel sees
all of them. Running
fdisk -l should list all available paritions. In my situation I have four
USB sticks installed:
Create a partition on the smallest disk. Since all the pieces of the RAID array have to be the same size
we'll start with the smallest piece. Use fdisk to make the first partition (in my case
Copy the partition scheme to the other USB sticks with sfdisk. You can use sfdisk to dump the partition scheme of the first stick and then use that as a template for the other sticks.
sfdisk -d /dev/sdl | sfdisk /dev/sdi
sfdisk -d /dev/sdl | sfdisk /dev/sdj
sfdisk -d /dev/sdl | sfdisk /dev/sdk
Create the RAID device. In my case I'm creating a RAID5 device (
--level 5) with the four partitions that we
created in the previous step.
mdadm --create /dev/md8 --raid-devices=4 --level=5 /dev/sdi1 /dev/sdj1 /dev/sdk1 /dev/sdl1
Create a filesystem on your newly created RAID device.
Mount your newly created RAID array so we can copy some files over to it.
mount /dev/md8 /mnt/tmp
Test the new RAID by creating some files on the array.
dd if=/dev/urandom of=/mnt/tmp/100mb.bin bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 60.9338 s, 1.7 MB/s
mdadm -a /dev/md8 /dev/sdk1
mdadm --detail /dev/md8
firstname.lastname@example.org - 2009-08-21