调整底层分区大小后组装 mdadm RAID1 时出错

调整底层分区大小后组装 mdadm RAID1 时出错

我想将 mdadm RAID1 从 2TB 缩小到 80GB。这是缩小之前的设置的样子。

root@rescue ~ # lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda       8:0    0   3.7T  0 disk  
├─sda1    8:1    0     4G  0 part  
│ └─md0   9:0    0     4G  0 raid1 
├─sda2    8:2    0   512M  0 part  
│ └─md1   9:1    0 511.4M  0 raid1 
├─sda3    8:3    0     2T  0 part  
│ └─md2   9:2    0     2T  0 raid1 
└─sda5    8:5    0     1M  0 part  
sdb       8:16   0   3.7T  0 disk  
├─sdb1    8:17   0     4G  0 part  
│ └─md0   9:0    0     4G  0 raid1 
├─sdb2    8:18   0   512M  0 part  
│ └─md1   9:1    0 511.4M  0 raid1 
├─sdb3    8:19   0     2T  0 part  
│ └─md2   9:2    0     2T  0 raid1 
└─sdb5    8:21   0     1M  0 part  
loop0     7:0    0     2G  1 loop 

我想调整 /dev/md2 的大小。以下是我遵循的步骤:

--resize filesystem / md2 raid
e2fsck -f /dev/md2
resize2fs /dev/md2 70G
e2fsck -f /dev/md2 # check
mdadm --grow /dev/md2 --size=83886080 #80GB
resize2fs /dev/md2 # expand size
e2fsck -f /dev/md2 # check

--stop md2 raid
mdadm --detail /dev/md2
mdadm --stop /dev/md2


# We checked with mdadm --examine --scan that /etc/mdadm/mdadm.conf was correct

--resize partition
parted /dev/sda
#p
#resizepart 3 80GB
#align-check optimal 3

parted /dev/sdb
#p
#resizepart 3 80GB
#align-check optimal 3


--assemble md2 raid
mdadm -A --scan

md2 raid 无法组装并显示以下输出:

root@rescue ~ # mdadm -A --scan
mdadm: failed to add /dev/sdb3 to /dev/md/2: Invalid argument
mdadm: failed to add /dev/sda3 to /dev/md/2: Invalid argument
mdadm: failed to RUN_ARRAY /dev/md/2: Invalid argument

dmesg 输出为:

[Fri Jul  8 10:56:45 2016] md: sdb3 does not have a valid v1.2 superblock, not importing!
[Fri Jul  8 10:56:45 2016] md: md_import_device returned -22
[Fri Jul  8 10:56:45 2016] md: sda3 does not have a valid v1.2 superblock, not importing!
[Fri Jul  8 10:56:45 2016] md: md_import_device returned -22

答案1

我最终成功地组织了我的突袭。您可以这样做: mdadm --assemble --update=devicesize /dev/md2

相关内容