我正在尝试用 2 个大小差别很大的磁盘组成 raid1(ec2 根据磁盘大小提供 iops,因此我希望拥有更多的 iops,但不介意丢失一些可用空间)。
但是当我手动设置尺寸时,出现is smaller than given size
错误,但我可以把尺寸调低,然后再调大达到我最初想要的尺寸:
[~]# size=$( cat /proc/partitions | grep xvd[mb] | awk '{print $3}' | sort -n | head -n1 )
[~]# size=$(( size - 8192 ))
[~]# echo $size
15988224
[~]# yes | mdadm --create /dev/md0 --metadata=1.2 --level=1 --raid-devices=2 --size=$size --bitmap=internal --write-behind=1024 --assume-clean /dev/xvdb --write-mostly /dev/xvdm
mdadm: /dev/xvdb is smaller than given size. 15988152K < 15988224K + metadata
mdadm: /dev/xvdm appears to be part of a raid array:
level=raid1 devices=2 ctime=Wed May 6 07:35:37 2015
mdadm: create aborted
[~]# size=$(( size - 18192 ))
[~]# yes | mdadm --create /dev/md0 --metadata=1.2 --level=1 --raid-devices=2 --size=$size --bitmap=internal --write-behind=1024 --assume-clean /dev/xvdb --write-mostly /dev/xvdm
mdadm: /dev/xvdb appears to contain an ext2fs file system
size=15996416K mtime=Thu Jan 1 00:00:00 1970
mdadm: /dev/xvdb appears to be part of a raid array:
level=raid1 devices=2 ctime=Wed May 6 07:35:37 2015
mdadm: /dev/xvdm appears to be part of a raid array:
level=raid1 devices=2 ctime=Wed May 6 07:35:37 2015
mdadm: largest drive (/dev/xvdm) exceeds size (15970032K) by more than 1%
Continue creating array? mdadm: array /dev/md0 started.
[~]# mdadm --grow /dev/md0 --size=max
mdadm: component size of /dev/md0 has been set to 15988224K
那么为什么它不允许我从一开始就将大小设置为 15988224,而只能在增长之后才设置呢?