In the last days, I encountered a strange issue^Wlimitation with Ext4 that I wouldn't have thought of. I've used ext2/ext3/ext4 for quite some time and so I've been used to resize the filesystem "online" (while "mounted"). In the past you had to use ext2online for that, then it was integrated into resize2fs itself.
The logic is simple and always the same : extend your underlaying block device (or add another one), then modify the LVM Volume Group (if needed), then the Logical Volume and finally the resize2fs operation, so something like
lvextend -L +${added_size}G /dev/mapper/${name_of_your_logical_volume}
resize2fs /dev/mapper/${name_of_your_logical_volume}
I don't know how much times I've used that, but this time resize2fs wasn't happy :
resize2fs: Operation not permitted While trying to add group #16384
I remember having had in the past an issue because of the journal size not being big enough. But this wasn't the case here.
FWIW, you can always verify your journal size with dumpe2fs /dev/mapper/${name_of_your_logical_volume} |grep "Journal Size"
Small note : if you need to increase the journal size, you have to do it "offline" as you have to remove the journal and then add it back with a bigger size (and that also takes time) :
umount /$path_where_that_fs_is_mounted
tune2fs -O ^has_journal /dev/mapper/${name_of_your_logical_volume}
# Assuming we want to increase to 128Mb
tune2fs -j -J size=128 /dev/mapper/${name_of_your_logical_volume}
But in that case, as said, it wasn't really the root cause : while the resize2fs: Operation not permitted
doesn't give much informations, dmesg
was more explicit :
EXT4-fs warning (device dm-2): ext4_group_add: No reserved GDT blocks, can't resize
The limitation is that when the initial Ext4 filesystem is created, the number of reserved/calculated GDT blocks for that filesystem will allow to grow it by a factor of 1000.
Ouch, that system (CentOS 6.7) I was working on had been provisioned in the past for a certain role, and that particular fs/mount point was set to 2G (installed like this through the Kickstart setup ). But finally role changed and so the filesystem has been extended/resized some times, until I tried to extend it to more than 2TiB, which then caused resize2fs to complain ...
So two choices :
- you do it "offline" through
umount, e2fsck, resize2fs, e2fsck, mount
(but time consumming) - you still have plenty of space in the VG, and you just want to create another volume with correct size, format it, rsync content, umount old one and mount the new one.
That means that I learned something new (one learns something new every day !), and also the fact that you then need to take that limitation in mind when using a kickstart (that doesn't include the --grow option, but a fixed size for the filesystem).
Hope that it can help