As I previously, written I’m trying to use the Olimex A20 as a web server and using a Usb key as mass storage.But you might not forget that an usb device is not a very reliable device, so I will show you how to set a raid system that will improve reliability.
A Raid system use at least two device and copy data on both of the (at least for Raid 1). It means that if one of them broke, you have a backup.
But I do not have idea, how it can impacts performance, it’s the subject of this article.
A friend of mine, gave me two inexpensive usb key, so I wll test them.
To have a reference, I test my two usb keys.
For my first key
For small file
dd bs=1K count=512000 if=/dev/zero of=test conv=fdatasync 512000+0 records in 512000+0 records out 524288000 bytes (524 MB) copied, 82.303 s, 6.4 MB/s
For big file (1M)
dd bs=1M count=4120 if=/dev/zero of=test conv=fdatasync 3720+0 records in 3719+0 records out 3900125184 bytes (3.9 GB) copied, 578.207 s, 6.7 MB/s
For my second key
root@a20-olimex:/mnt/sdb1# dd bs=1M count=3900 if=/dev/zero of=test conv=fdatasync 3720+0 records in 3719+0 records out 3900588032 bytes (3.9 GB) copied, 647.667 s, 6.0 MB/s root@a20-olimex:/mnt/sdb1# dd bs=1K count=812000 if=/dev/zero of=test conv=fdatasync 812000+0 records in 812000+0 records out 831488000 bytes (831 MB) copied, 140.967 s, 5.9 MB/s
It my second key seems a bit slower
Now we can create a raid 0 to see if it improves speed
There’s a special command to create a raid, it’s name is mdadm.
apt-get install mdadm umount /dev/sda1 umount /dev/sdb1 sudo mdadm --create /dev/md0 --level=1 --assume-clean --raid-devices=2 /dev/sda /dev/sdb
If you do
Now /dev/md0 is seen as a normal partition, now we just have to create a partition
Edit /etc/fstab and add the folowing line
/dev/md0 /media/raid ext2 defaults 0 1mount -aAnd normally you have a new mounted partion under /mnt/raid, wich « concatenate » sda et sdb wich capacity is lowest capacity
Now check the speed of the raid:
cd /mnt/raid dd bs=1K count=512000 if=/dev/zero of=test conv=fdatasync 512000+0 records in 512000+0 records out 524288000 bytes (524 MB) copied, 171.296 s, 3.1 MB/s root@a20-olimex:/mnt/raid# dd bs=1M count=2900 if=/dev/zero of=test conv=fdatasync 2900+0 records in 2900+0 records out 3040870400 bytes (3.0 GB) copied, 977.195 s, 3.1 MB/sThis result is normal, in raid1 data are copied on both usb key so performance divided by two is what we should expect.
Now we have several choice:
keeping good performance but have something less reliable. You have to know that if you plan to keep your A20 24 hours a day, your gonna facing because your hardware will be warm for a long time. For my point a view, if your not interested in performance, a USB raid can be a solution, but you can keep the solution with Hd disk if you want. In this case you gonna have better performance. But the in practical it is the same manipulation.As a result you have something like that: