Filesystems
調整底層分區大小後組裝 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
我最終設法組建了我的團隊。這就是你的做法:
mdadm --assemble --update=devicesize /dev/md2