resize2fs 崩溃并出现错误:尝试添加组时不允许操作

resize2fs 崩溃并出现错误:尝试添加组时不允许操作

在向硬件 RAID 添加新磁盘后,我尝试扩展 /dev/sda3/ 分区,但在 resize2fs 之后失败:

[root@server5 ~]# resize2fs -f /dev/sda3
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/sda3 is mounted on /; on-line resizing required
old desc_blocks = 47, new_desc_blocks = 93
Performing an on-line resize of /dev/sda3 to 388385366 (4k) blocks.
resize2fs: Operation not permitted While trying to add group #6016

但让我们从头开始

我使用 fdisk 成功重新创建了分区(原始大小约为 800gb RAID1,现在约为 1.5tb RAID5)

Disk /dev/sda: 1600.3 GB, 1600264691712 bytes
255 heads, 63 sectors/track, 194554 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0006ce84

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         128     1024000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2             128        1148     8192000   82  Linux swap / Solaris
/dev/sda3            1148      194555  1553541464   83  Linux

之后我在 /dev/sda3 上使用 partprobe 并且一切似乎都成功了(至少通过 lsblk )

[root@server5 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  1.5T  0 disk 
├─sda1   8:1    0 1000M  0 part /boot
├─sda2   8:2    0  7.8G  0 part [SWAP]
└─sda3   8:3    0  1.5T  0 part /

之后我尝试使用 resize2fsk,但失败了。我还在重启时运行了 forcefsck,但没什么帮助。似乎有足够的 GDT 块

[root@server5 ~]# tune2fs -l /dev/sda3
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          790fa126-9bf9-41d6-90e1-f720dfbc4663
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              49283072
Block count:              197132288
Reserved block count:     9856614
Free blocks:              21290170
Free inodes:              49192326
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      977
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Mon Jan 29 00:08:33 2018
Last mount time:          Wed Jan 19 05:28:55 2022
Last write time:          Wed Jan 19 09:54:25 2022
Mount count:              1
Maximum mount count:      -1
Last checked:             Wed Jan 19 05:28:47 2022
Check interval:           0 (<none>)
Lifetime writes:          228 TB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:           256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       16121861
Default directory hash:   half_md4
Directory Hash Seed:      dff51d0c-ebe2-444e-9262-ffe391307277
Journal backup:           inode blocks
Seems like there is enough GDT blocks 

DF -h 输出

[root@server5 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3       741G  659G   44G  94% /
tmpfs            48G     0   48G   0% /dev/shm
/dev/sda1       969M   38M  881M   5% /boot
tmpfs           1.0G     0  1.0G   0% /ramdrive_session

FS 允许调整大小,

[root@server5 ~]# dumpe2fs /dev/sda3 | grep -i features
dumpe2fs 1.41.12 (17-May-2010)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Journal features:         journal_incompat_revoke

日志大小看起来不错:

[root@server5 ~]# dumpe2fs /dev/sda3 |  grep ^Journal
dumpe2fs 1.41.12 (17-May-2010)
Journal inode:            8
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0xc8213ff3
Journal start:            2327
    

所以我完全陷入困境并寻求你的帮助。如何正确地向 /dev/sda3 分区添加空间?谢谢你的关注

答案1

鉴于这是 resize2fs 1.41.12,我猜你运行的是 CentOS 6。除了查找可用的 GDT 块之外,还有其他事情需要检查:

简而言之:

检查你的 FS 是否允许调整大小:

dumpe2fs /dev/vg_test/lv_ext3 | grep -i features

您应该会发现“调整 inode 大小“ 在输出中。

另外,您的 FS 日志大小可能太小,无法进行在线调整,因此您需要离线并执行以下步骤:https://access.redhat.com/solutions/2723901

相关内容