Create RAID array of image files

Solution 1:

To install the Linux software RAID you need to install the mdadm package.

sudo apt-get install mdadm

If you want to make a software RAID-0 from the three image files, you need to create loop devices for each image files:

sudo losetup /dev/loop1 image1.img
sudo losetup /dev/loop2 image2.img
sudo losetup /dev/loop3 image3.img

After you can create a RAID-0 array from them:

sudo mdadm --create /dev/md0 --level=0 --raid-devices=3 /dev/loop1 /dev/loop2 /dev/loop3

Solution 2:

If your system matches the basic requirements you could use zfs (8 GB RAM, 64-bit system):

Add repo and update package list:

sudo add-apt-repository ppa:zfs-native/stable
sudo apt-get update

Install package:

sudo apt-get install ubuntu-zfs

Create a striped vdev (with no redundancy, but you asked for RAID0):

sudo zpool create vol0 ~/image[1-3].img

This creates the stripe and mounts it at /vol0.

sudo zfs create vol0/filesystem

This creates a zfs file system on the stripe and mounts it at /vol0/filesystem. Use

sudo zfs set mountpoint=/mnt/filesystem vol0/filesystem

if you want to change the mount point.

You can also add automatic compression:

sudo zfs create vol0/filesystem/compressed
sudo zfs set compression=on vol0/filesystem/compressed

Now everything you put into /mnt/filesystem/compressed will automatically be compressed.