xbianonpi / xbian-package-initramfs

4 stars 2 forks source link

USB mirror #18

Open CurlyMoo opened 11 years ago

CurlyMoo commented 11 years ago

I was wondering if it is possible to use a USB drive as mirror. My experience with ZFS is that you can easily add a device to a ZFS mirror. ZFS will than automatically use the fastest device and sync the other device in the background. This means in ZFS,

1) that it will primarily use the fastest device 2) balance the load of the devices, so when the fastest device is busy, it will use the second device in the mirror. 3) real-time backups 4) live replacing of a failed USB / SD device

I don't know a lot about BTRFS, so i don't now if the same things are possible with BTRFS.

CurlyMoo commented 11 years ago

I did some benchmarks and the results are as follows (SD card + USB stick):

                                                         random  random
           KB  reclen   write rewrite    read    reread    read   write
RAID1 : 51200       4     493     518     4578     4346    4440     649
RAID0 : 
- USB : 51200       4     730    1092     3788     2979    3691     281
- SD  : 51200       4     992     788     5558     4706    4974     732

             -33%    -35%     +20%     +50%    +20%   +130%

RAID1 : 51200     512    3748    4475    18705    11533   18672    4521
RAID0 : 
- USB : 51200     512    3157    3488    23652    17815   24158    2918
- SD  : 51200     512    4849    4182    17513    17537   17443    4198
                         +20%    +28%      +6%    -35%      +7%    +55%

RAID1 : 51200   16384    5572    5456    25016    24991   24994    3247
RAID0 :
- USB : 51200   16384    4151    4492    27078    27682   27621    3114
- SD  : 51200   16384    7632    9915    22041    22032   22050    9801
                         +31%    +21%     +13%     +13%    +13%     +4%

The percentages were calculated like this: Increase: How much faster than the slowest of the USB/SD Decrease: How much slower than the slowest of the USB/SD

Conclusion:

*With the slowest device as the reference

I used a fairly slow and generic USB stick. However, the results show that the performance of the USB stick can be increased fairly well by a fast SD card. The ideal solution would of course be, adding a USB stick that is faster than the SD card so we get a overall performance gain instead of decrease.

The only problem is that you can't simply go back to the RAID0 situation. If you want to remove the USB drive from the mirror, you need to boot degraded mode.

mk01 commented 11 years ago

not sure about creating raid1 from single disk after it was created. needs to be tested. what I remember is, that raid1 conf was needed from time of creating the fs, with "dummy" - not existing - device. then, it was possible to add the mirror later.

but there are more options to investigate: move /home to another device (so dbs, thumbs, add ons & data) will unload system device.

or using other device as cache device (similar to ZFS L2ARC), which is now build in linux kernel, not dependent on fstype.

if only would RPI have at least two cores :))

CurlyMoo commented 9 years ago

if only would RPI have at least two cores :))

Is now has four :))