Forum

Full Version: Psuedo Mirroring
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Currently I have a 4Gb SD card and a 8Gb USB flash drive with Xbian booting off of the USB drive.

The SD card is only used to boot from, so the rest of the space is wasted.

Would it be possible to have a “mirror” function that would mirror the USB drive so that I have Xbian (and all updates) on both the USB and the SD card – so they are mirrored (to an extent) so if the USB fails I still have a working copy on the SD card (by just altering cmdline.txt)

Just a thought!
The problem is that btrfs doesn't (normally) allow you to boot from a degraded mirror. If that's not a problem you can.

https://github.com/xbianonpi/xbian-package-initramfs/issues/18#issuecomment-20597109

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

Code:
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:
- 4k write performance dropped by about 33%
- 4k read performance has increased for about 33%*
- All other IO show an increase of a about 20%*, except for the 512k reread.

*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.
@IriDium

you want online mirror or offline mirror? cause offline mirror is simply a clone, or cp, or rsync, or what ever - so as we have xbianclone(copy) I would use this to make daily copy (actually if I implement incremental snapshots copy then we will even not push hardware by copying all content daily).
cron record would look like this
Code:
btrfs-auto-snapshot xbiancopy /dev/root /dev/mmcblk0p2

online mirror you can do with sw raid, or with device mapper layer, or easiest with btrfs. but online multidisk solutions have some drawbacks (for user). for example writes. by default system will wait for all devices to finish a block write (so if you add slower device, you will slow down on writes to level of slowest device).
Reference URL's