附錄:把11顆raid6 reshaped為10顆

使用參數 --grow 把原本11顆組成的 raid6 改成10顆組成

dadm --grow --raid-devices=10 /dev/md0
#須先把大小做調整
mdadm: this change will reduce the size of the array.
       use --grow --array-size first to truncate array.
       e.g. mdadm --grow /dev/md0 --array-size 46883123200
#調整大小後,才能變更磁碟數量
mdadm --grow /dev/md0 --array-size 46883123200
resize2fs /dev/md0
#... and run a file system check again:
e2fsck -f /dev/md0
resize2fs /dev/md0

#變更數量,要有--backup,並且不能存在陣列磁區
mdadm --grow --raid-devices=10 /dev/md0 --backup=/root/reshapedRaid6.img
#再次執行,顯示已經進入reshaped模式
mdadm --grow --raid-devices=10 /dev/md0
mdadm: /dev/md0 is performing resync/recovery and cannot be reshaped

重塑後由49T變成43T

mdadm -D /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Mon Sep  2 17:01:57 2019
        Raid Level : raid6
        Array Size : 46883123200 (44711.23 GiB 48008.32 GB)
     Used Dev Size : 5860390400 (5588.90 GiB 6001.04 GB)
      Raid Devices : 10
     Total Devices : 10
       Persistence : Superblock is persistent

mount /dev/md0 /mnt mount: /mnt: wrong fs type, bad option, bad superblock on /dev/md0, missing codepage or helper program, or other error.

e2fsck /dev/md0
e2fsck 1.45.3 (14-Jul-2019)
The filesystem size (according to the superblock) is 13185878400 blocks
The physical size of the device is 11720780800 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? no
data contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes

^[[AInode 410550458 extent tree (at level 1) could be narrower.  Optimize<y>? yes
Inode 410550626 extent tree (at level 1) could be narrower.  Optimize<y>? yes
Inode 410550851 extent tree (at level 1) could be narrower.  Optimize<y>? yes to all
Inode 410550985 extent tree (at level 1) could be narrower.  Optimize? yes

Inode 410551192 extent tree (at level 1) could be narrower.  Optimize? yes

Inode 410551435 extent tree (at level 1) could be narrower.  Optimize? yes

Last updated