cannot resize ext4 once GDT blocks exhausted
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
e2fsprogs (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
With an ext4 filesystem, you can shrink and expand a filesystem until you run out of GDT blocks. After that the filesystem cannot be resized, neither shrunk nor expanded, even if unmounted.
Although this issue is most relevant in an LVM environment, here's some code to demonstrate the issue using a loopback device. The code needs to be run as root.
dd if=/dev/zero of=ext4.img bs=1M count=10000
dev=$(losetup -vf ext4.img| cut -d" " -f4)
mkfs.ext4 ${dev} 5M
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 2G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 5G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
At this point resize2fs returns an error:
resize2fs: /dev/loop0: The combination of flex_bg and
This means the filesystems is 5GB forever. It cannot be resized,
expanded or shrunk.
In contrast, ext3 does not have this issue.
mkfs.ext3 ${dev} 5M
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 2G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 5G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
Workaround: when creating an ext4 filesystem, use the extended option resize=. For example:
mkfs.ext4 -E resize=100000000000 ${dev} 5M
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 5G
tune2fs -l ${dev} | grep -i gdt
resize2fs ${dev} 3G
This option can be added to /etc/mke2fs.conf.
This is on Ubuntu Lucid 10.04 with the latest updates.
# lsb_release -rd
Description: Ubuntu 10.04.1 LTS
Release: 10.04
# dpkg -l | awk '/e2fsprogs/ {print $2, $3}'
e2fsprogs 1.41.11-1ubuntu2
# uname -rvmpio
2.6.32-25-generic #44-Ubuntu SMP Fri Sep 17 20:26:08 UTC 2010 i686 unknown unknown GNU/Linux
# cat /proc/version_
Ubuntu 2.6.32-
Regards,
- Robert
Most likely e2fsprogs as tune2fs, mkfs.ext3, mkfs.ext4, and resize2fs are all components of that package.