Втыкаем флэшки
# dmesg
scsi 19:0:0:0: Direct-Access Sony MSAC-UAM1 1.00 PQ: 0 ANSI: 0 CCS
sd 19:0:0:0: [sdc] 124416 512-byte hardware sectors: (63.7 MB/60.7 MiB)
...
scsi 20:0:0:0: Direct-Access KINGMAX USB Flash Disk 2.00 PQ: 0 ANSI: 2
sd 20:0:0:0: [sdd] 512000 512-byte hardware sectors: (262 MB/250 MiB)
Создаём RAID-1
# mdadm --create /dev/md0 --level 1 --raid-devices 2 /dev/sdc /dev/sdd
mdadm: largest drive (/dev/sdd) exceed size (62144K) by more than 1%
Continue creating array? y
mdadm: array /dev/md0 started.
Форматируем
# mke2fs /dev/md0
mke2fs 1.41.8 (11-July-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
15552 inodes, 62144 blocks
3107 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=63700992
8 block groups
8192 blocks per group, 8192 fragments per group
1944 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Монтируем
# mount /dev/md0 /mnt/tmp/
Смотрим
# dmesg
md: bind
md: bind
md: md0: raid array is not clean -- starting background reconstruction
raid1: raid set md0 active with 2 out of 2 mirrors
md: resync of RAID array md0
md: minimum _guaranteed_ speed: 1000 KB/sec/disk.
md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for resync.
md: using 128k window, over a total of 62144 blocks.
md0:
md: md0: resync done.
RAID1 conf printout:
--- wd:2 rd:2
disk 0, wo:0, o:1, dev:sdc
disk 1, wo:0, o:1, dev:sdd
Пишем, отключаем, останавливаем
# touch /mnt/tmp/test
# umount /mnt/tmp
# mdadm --stop /dev/md0
Приводим флешки в чувство
# mdadm --zero-superblock /dev/sdc
# mdadm --zero-superblock /dev/sdd
Обе флэшки содержат ext2 с файлом test и могут теперь использоваться по отдельности