[parted-devel] [PATCH] libparted detects ext4 without journal as ext2

Pascal Hambourg pascal at plouf.fr.eu.org
Sat Apr 19 07:56:42 BST 2025


References: Debian bug#1103454, GNU bug#77887

Dear maintainers,

libparted wrongly detects ext4 without journal as ext2 instead of ext4.
Steps to reproduce:

truncate -s 1G blob
mkfs.ext4 -O ^has_journal blob
blkid blob -> ext4
parted blob print -> ext2
mount -t ext2 blob /mnt -> "couldn't mount as ext2 due to feature 
incompatibilities"
mount -t ext4 blob /mnt -> ok

In libparted/fs/ext2/interface.c, _ext2_generic_probe() considers ext4 
as a subset of ext3 which is ext2 with journal. IMO this is wrong 
because ext4 without journal may have other incompatible features.

I did very basic testing with the attached patch applied on Debian [1], 
now parted detects ext* filesystems as expected:

mkfs.ext2 -> ext2
mkfs.ext3 -> ext3
mkfs.ext4 -> ext4
mkfs.ext4 -O ^has_journal -> ext4

However I am neither a developer nor an ext4 expert so not sure I did 
things properly.

[1] 
<https://salsa.debian.org/pham/parted/-/commit/a27db8d317c71dbaacd51475721361bfb404152b>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: detect-ext4-nojournal.patch
Type: text/x-patch
Size: 2321 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/parted-devel/attachments/20250419/ba4604ef/attachment.bin>


More information about the parted-devel mailing list