RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1669772 - Grub does not support ext4 meta_bg flag. unbootable system after FS resize
Summary: Grub does not support ext4 meta_bg flag. unbootable system after FS resize
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: grub2
Version: 7.6
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Bootloader engineering team
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-27 00:52 UTC by Logan V
Modified: 2021-03-15 07:33 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-03-15 07:33:08 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
CentOS 15749 0 None None None 2019-01-27 00:52:40 UTC

Description Logan V 2019-01-27 00:52:40 UTC
Description of problem:
When a filesystem containing /boot is resized to >1024 times its original size, such as on a cloud image that is deployed to the disk and then growpart used, grub2-install can no longer read the filesystem. This is because grub reserves GDT blocks to allow growing the filesystem to 1024 times its original size by default, and when resizing past that point, a filesystem flag (meta_bg) is added which makes the filesystem unrecognizable to CentOS 7's grub.

In my case, I have a <1GB CentOS image containing a single partition, and when deploying to a 2TB or larger volume this occurs every time.

This occurs because the GDT reserved blocks are exhausted due to resizing past 1024x the original filesystem size. When this happens, the resize_inodes flag is removed, the meta_bg flag is added, and a kernel message is logged "Converting file system to meta_bg". See https://www.spinics.net/lists/linux-ext4/msg33898.html

After this change from resize_inodes -> meta_bg flag on the ext4 FS, grub-install can no longer read the filesystem. It fails with "grub2-install: error: unknown filesystem."

According to a changelog, grub2 added support for meta_bg in 2015, however it seems like this support does not exist in CentOS 7:
https://fossies.org/linux/grub/ChangeLog
2015-02-16 Vladimir Serbinenko <phcoder>
ext2: Support META_BG.
This fixes bug that system would become unbootable after ext*
online resize if no resize_inode was created at ext* format time.

Version-Release number of selected component (if applicable):
As shown in the output below for e2fstools 
grub2-pc-2.02-0.76.el7.centos.x86_64 is the grub version

How reproducible:
always

Steps to Reproduce:
Create a small ext4 filesystem containing boot
Run grub2-install with the path to the filesystem and see that it works
Resize the filesystem to > 1024 times its original size
Note the kernel message logged:
kernel: EXT4-fs (sda2): Converting file system to meta_bg
Attempt to grub-install the resized filesystem and see that grub fails with "unknown filesystem"

Actual results:
--------------------------------------------------------------------------------
BEFORE RESIZE
--------------------------------------------------------------------------------
bash-4.2# parted /dev/sda print
Model: ATA WDC WD3000FYYZ-0 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
 1 1049kB 9437kB 8389kB BSP bios_grub
 2 9437kB 1368MB 1359MB ext4 root
 3 3001GB 3001GB 67.1MB fat16 primary

bash-4.2# tune2fs -l /dev/sda2
tune2fs 1.42.9 (28-Dec-2013)
Filesystem volume name: cloudimg-rootfs
Last mounted on: /
Filesystem UUID: 94feb0b3-cc60-448e-b101-e68c7b0bdae6
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: 331936
Block count: 331776
Reserved block count: 16588
Free blocks: 80668
Free inodes: 301701
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 80
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 30176
Inode blocks per group: 1886
Flex block group size: 16
Filesystem created: Thu Jan 24 03:21:20 2019
Last mount time: Sat Jan 26 13:08:51 2019
Last write time: Sat Jan 26 13:08:51 2019
Mount count: 3
Maximum mount count: -1
Last checked: Thu Jan 24 03:21:20 2019
Check interval: 0 (<none>)
Lifetime writes: 1337 MB
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
Default directory hash: half_md4
Directory Hash Seed: de9623cb-c755-4ca3-94ec-1b651d8994f9
Journal backup: inode blocks
bash-4.2# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

--------------------------------------------------------------------------------
RESIZE OPERATION
--------------------------------------------------------------------------------
bash-4.2# growpart /dev/sda 2
CHANGED: disk=/dev/sda partition=2: start=18432 old: size=2654207,end=2672639 new: size=5860383663,end=5860402095
bash-4.2# resize2fs /dev/sda2
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 175
The filesystem on /dev/sda2 is now 732547958 blocks long.

--------------------------------------------------------------------------------
AFTER RESIZE
--------------------------------------------------------------------------------
Kernel log:
[Sat Jan 26 13:16:02 2019] EXT4-fs (sda2): resizing filesystem from 331776 to 732547958 blocks
[Sat Jan 26 13:16:03 2019] EXT4-fs (sda2): resizing filesystem from 339738624 to 732547958 blocks
[Sat Jan 26 13:16:03 2019] EXT4-fs (sda2): Converting file system to meta_bg
[Sat Jan 26 13:16:03 2019] EXT4-fs (sda2): resizing filesystem from 339738624 to 732547958 blocks
[Sat Jan 26 13:16:05 2019] EXT4-fs (sda2): resized filesystem to 732547958

bash-4.2# parted /dev/sda print
Model: ATA WDC WD3000FYYZ-0 (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
 1 1049kB 9437kB 8389kB BSP bios_grub
 2 9437kB 3001GB 3001GB ext4 root
 3 3001GB 3001GB 67.1MB fat16 primary

 bash-4.2# tune2fs -l /dev/sda2
tune2fs 1.42.9 (28-Dec-2013)
Filesystem volume name: cloudimg-rootfs
Last mounted on: /
Filesystem UUID: 94feb0b3-cc60-448e-b101-e68c7b0bdae6
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr dir_index filetype needs_recovery meta_bg 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: 674614656
Block count: 732547958
Reserved block count: 29303361
Free blocks: 690108140
Free inodes: 674584421
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 30176
Inode blocks per group: 1886
First meta block group: 81
Flex block group size: 16
Filesystem created: Thu Jan 24 03:21:20 2019
Last mount time: Sat Jan 26 13:08:51 2019
Last write time: Sat Jan 26 13:08:51 2019
Mount count: 3
Maximum mount count: -1
Last checked: Thu Jan 24 03:21:20 2019
Check interval: 0 (<none>)
Lifetime writes: 1337 MB
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
Default directory hash: half_md4
Directory Hash Seed: de9623cb-c755-4ca3-94ec-1b651d8994f9
Journal backup: inode blocks

bash-4.2# grub2-install /dev/sda
Installing for i386-pc platform.
grub2-install: error: unknown filesystem.

Comment 4 RHEL Program Management 2021-03-15 07:33:08 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


Note You need to log in before you can comment on or make changes to this bug.