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.
Related videos on Youtube
Daniel
Updated on September 18, 2022Comments
-
Daniel over 1 year
OK, so I've got three image files in
/home/
, and they each reside on different physical drives:image1.img image2.img image3.img
Each image is the same size, and I want to put the images themselves into RAID0.
How should I go about RAIDing them?
EDIT: Using mdadm I get this error:
EDIT: Output of
cat /proc/mdstat
EDIT: Output of
sudo gparted /dev/md0
-
lemonslice over 8 yearsIf I understand correctly, you want to have a RAID-0 drive which has thrice the size of the image files and is stripped between the three image files?
-
Daniel over 8 yearsYes. The idea is to be able to create a RAID unit that can span multiple drives without actually placing the drives in RAID.
-
lemonslice over 8 yearsWhat does
cat /proc/mdstat
say about this error? -
Daniel over 8 yearsSee edit to question
-
lemonslice over 8 yearsWhat are the media below the image files? Based on the error message they do not support seek...
-
Daniel over 8 yearsThey are blank. I'm trying to create a completely new and blank RAID disk
-
Daniel over 8 yearsI literally just did
touch image#.img
for each one. Is there something else I should do? -
Daniel over 8 yearsAnd how should I do that?
-
lemonslice over 8 yearsLet us continue this discussion in chat.
-
-
Daniel over 8 years"E: Unable to locate package ubuntu-zfs"
-
Daniel over 8 yearsAnd this should also work with iso files, right?
-
Niclas Börlin over 8 yearsForgot to add instructions on how to add the repo. Have edited now.
-
Niclas Börlin over 8 yearsI'm not sure what you mean with iso files... The instructions will create a blank file system striped over the 3 files in question. Do you have data in your iso files that you somehow wish to access on a striped partition?
-
Daniel over 8 yearsNo, I was just curious as to whether or not it could be done with, say a DVD-RW for instance, or something like that.
-
Daniel over 8 yearsStill the same unable to find the package.
-
Niclas Börlin over 8 yearsI guess it could be done with a DVD-RW, but I fail to see the point.
-
Niclas Börlin over 8 yearsI forgot to add an update step. Have done so now.
-
Daniel over 8 yearsAha! I'll try that.
-
Daniel over 8 yearscommand mdadm not found
-
lemonslice over 8 yearsYou have to install the package
mdadm
. -
Daniel over 8 yearsSee edit to question
-
Daniel over 8 yearsThat's with a fresh install of mdadm.