我试图从2磁盘raid1大小的差异很大(ec2提供基于磁盘大小的iops,所以我想有更多的iops,但不关心失去一些自由空间)。
然而,当我手动设置大小,我得到的is smaller than given size错误, 但我可以设置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,只有在成长后?