[parted-devel] [PATCH included] EXT2 FS code in parted

Otavio Salvador otavio at debian.org
Mon Jun 11 13:51:43 UTC 2007


Jim Meyering <jim at meyering.net> writes:

> FYI, I spent some time looking at the resize bug for which Matt provided a
> test case a couple weeks ago.  Along the way, I found that the ext2
> FS-*creation* code is not up to snuff.  For example, creating an EXT2
> partition of certain unfortunate sizes fails unnecessarily.  For example,
> here's a demonstration using one of the smallest sizes:
>
> Run this:
>
>     dev=F
>     dd if=/dev/null of=$dev bs=1 seek=20M
>     ./parted -s $dev mklabel gpt
>     ./parted -s $dev mkpartfs primary ext2 0 16796160B
>
> It fails with this diagnostic:
>
>     Error: Attempt to write sectors 32772-32773 outside of partition on /t/F.
>
> But if you choose a size that's one byte smaller, it works:
>
>     ./parted -s $dev mkpartfs primary ext2 0 16796159B
>
> The difference is in how ext2_mkfs_write_meta computes
> the number of block groups.  In the former case, it computes
> numgroups = 3.  In the latter, numgroups = 2.
> The trouble with the first case is that there isn't enough
> space for 3 full block groups in a file system of that size.
> Hence the eventual attempt to write beyond the initially-
> established end-of-file-system mark.
>
> Not too keen on the state of parted's bit-rotting FS code
> in the first place, now I'm looking at e2fsprogs with an eye
> to replacing all ext2-related code right away.  e2fsprogs is
> obviously well maintained, with an extensive test suite and
> an existing library/API, so it looks like it'd be a fine
> replacement for what's in parted.
>
> Is anyone already working on this?

Not that I know.

>>From f0cbb9129a2a9af6d282963f2d072719273915e9 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <jim at meyering.net>
> Date: Mon, 11 Jun 2007 14:34:39 +0200
> Subject: [PATCH] Add a test to record the current EXT2 mkpartfs failure for some sizes.
>
> Run this:
>
>     dev=F
>     dd if=/dev/null of=$dev bs=1 seek=20M
>     ./parted -s $dev mklabel gpt
>     ./parted -s $dev mkpartfs primary ext2 0 16796160B
>
> It fails with this diagnostic:
>
>     Error: Attempt to write sectors 32772-32773 outside of partition on /t/F.
>
> But if you choose a size that's one byte smaller, it works:
>
>     ./parted -s $dev mkpartfs primary ext2 0 16796159B
>
> The difference is in how ext2_mkfs_write_meta computes
> the number of block groups.  In the former case, it computes
> numgroups = 3.  In the latter, numgroups = 2.
> The trouble with the first case is that there isn't enough
> space for 3 full block groups in a file system of that size.
> Hence the eventual attempt to write beyond the initially-
> established end-of-file-system mark.
>
> Signed-off-by: Jim Meyering <jim at meyering.net>

Ack.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list