Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to parse group descriptor: EOF #8

Closed
haykbaluyan opened this issue Jun 22, 2023 · 1 comment · Fixed by #11
Closed

failed to parse group descriptor: EOF #8

haykbaluyan opened this issue Jun 22, 2023 · 1 comment · Fixed by #11

Comments

@haykbaluyan
Copy link

This is directly related to the issue raised in dsoprea/go-ext4#7

Essentially for ext4 filesystems for which featureInCompat64bit is false (64 bit feature is not set), getGroupDescriptor call will result in the below error.

2023-06-22T05:26:59.664+0400    WARN    Partition error: filesystem error: unexpected fs error: new ext4 filesystem error: failed to get group Descriptor: failed to parse group descriptor: EOF

Unfortuanately i do not have AMI from which the volume was created but the fix is essentially what was articulated in the above raised issue.

You need to read only half of that struct if the 64-bit feature is not set and not use the rest of the fields. For the next entry you only increment offset by 32, not 64.

So the fix is literally to have 32 byte equivalent of GroupDescriptor and read to it when 64-bit feature is not set.

// GroupDescriptor32 is 32 byte
type GroupDescriptor32 struct {
	BlockBitmapLo     uint32 `struc:"uint32,little"`
	InodeBitmapLo     uint32 `struc:"uint32,little"`
	InodeTableLo      uint32 `struc:"uint32,little"`
	FreeBlocksCountLo uint16 `struc:"uint16,little"`
	FreeInodesCountLo uint16 `struc:"uint16,little"`
	UsedDirsCountLo   uint16 `struc:"uint16,little"`
	Flags             uint16 `struc:"uint16,little"`
	ExcludeBitmapLo   uint32 `struc:"uint32,little"`
	BlockBitmapCsumLo uint16 `struc:"uint16,little"`
	InodeBitmapCsumLo uint16 `struc:"uint16,little"`
	ItableUnusedLo    uint16 `struc:"uint16,little"`
	Checksum          uint16 `struc:"uint16,little"`
}

Here is the dump from my ext4 formatted volume.

$ sudo dumpe2fs -f /dev/xvdf1
dumpe2fs 1.46.5 (30-Dec-2021)
Filesystem volume name:   /
Last mounted on:          /
Filesystem UUID:          8cd9967e-f9c0-438f-bebd-a0a7c5886ebc
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:              524288
Block count:              2096635
Reserved block count:     20966
Overhead clusters:        70281
Free blocks:              1395708
Free inodes:              473043
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      511
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 15 18:42:02 2018
Last mount time:          Wed Jun 21 23:10:14 2023
Last write time:          Wed Jun 21 23:10:14 2023
Mount count:              4
Maximum mount count:      -1
Last checked:             Mon Jan 15 18:42:02 2018
Check interval:           0 (<none>)
Lifetime writes:          455 GB
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:      71949b1b-7e27-4206-a570-d27984b3cd37
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Total journal size:       128M
Total journal blocks:     32768
Max transaction length:   32768
Fast commit length:       0
Journal sequence:         0x006fd961
Journal start:            1
@masahiro331
Copy link
Owner

@haykbaluyan

Thank you for your issue.

Could you provide how to make ext4-filesystem-32bit ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants