2011-07-22 15:56:18

by Round Robinjp

[permalink] [raw]
Subject: flashing large eMMC partitions with ext4

Hi

I have a question regarding making ext4 image for
large eMMC partition.

We have a 4G partition in our embedded device
in which we want to use ext4 filesystem.
But for that we have to create a 4G image.
flashing this 4G image to the eMMC takes a long
time. Is there any way to reduce this time?

For vfat, you can truncate the image leaving only
non zero-filled blocks which makes the image very
short and the time for flashing is reduced.
Is something similar to that possible for ext4?

Thanks
Robin


2011-07-22 16:34:57

by Andreas Dilger

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

If you can wipe the MMC device to be all-zero efficiently, then you can format it quickly with "mke2fs -E lazy_itable_init,lazy_journal_init ..." and restore from a tarball.

Alternately, Lukas recently added support for QCOW2 sparse image format, and it should be possible to restore this to the device efficiently, if it is zeroed in advance. I don't know if his code skips all-zero blocks in the image, but that should be possible to add fairly easily.

Cheers, Andreas

On 2011-07-22, at 9:49 AM, Round Robinjp <[email protected]> wrote:

> Hi
>
> I have a question regarding making ext4 image for
> large eMMC partition.
>
> We have a 4G partition in our embedded device
> in which we want to use ext4 filesystem.
> But for that we have to create a 4G image.
> flashing this 4G image to the eMMC takes a long
> time. Is there any way to reduce this time?
>
> For vfat, you can truncate the image leaving only
> non zero-filled blocks which makes the image very
> short and the time for flashing is reduced.
> Is something similar to that possible for ext4?
>
> Thanks
> Robin
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-07-25 16:34:08

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

Many Thanks for the reply.

In both the ways you have shown, the eMMC device needs
to be zeroed in advance. But so far as I know, writing
4G bytes of zeros and writing 4G bytes of real data has
no difference. So this does not solve the problem.
Please correct me if I am wrong.
Any other options?

Thanks
Robin


--- Andreas Dilger wrote:
> If you can wipe the MMC device to be all-zero efficiently, then you can format it quickly with "mke2fs -E lazy_itable_init,lazy_journal_init ..." and restore from a tarball.
>
> Alternately, Lukas recently added support for QCOW2 sparse image format, and it should be possible to restore this to the device efficiently, if it is zeroed in advance. I don't know if his code skips all-zero blocks in the image, but that should be possible to add fairly easily.
>
> Cheers, Andreas
>
> On 2011-07-22, at 9:49 AM, Round Robinjp <[email protected]> wrote:
>
> > Hi
> >
> > I have a question regarding making ext4 image for
> > large eMMC partition.
> >
> > We have a 4G partition in our embedded device
> > in which we want to use ext4 filesystem.
> > But for that we have to create a 4G image.
> > flashing this 4G image to the eMMC takes a long
> > time. Is there any way to reduce this time?
> >
> > For vfat, you can truncate the image leaving only
> > non zero-filled blocks which makes the image very
> > short and the time for flashing is reduced.
> > Is something similar to that possible for ext4?
> >
> > Thanks
> > Robin

2011-07-25 16:55:42

by Andreas Dilger

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On 2011-07-25, at 10:34 AM, Round Robinjp wrote:
> Many Thanks for the reply.
>
> In both the ways you have shown, the eMMC device needs
> to be zeroed in advance. But so far as I know, writing
> 4G bytes of zeros and writing 4G bytes of real data has
> no difference. So this does not solve the problem.
> Please correct me if I am wrong.

I was hoping that MMC had some sort of "TRIM" or "UNMAP" command. It might also be possible to use/modify the QCOW2 tools so that they don't _save_ zero blocks in the image file, but write them out at restore time?

Alternately, with the "lazy_itable_init" option if you have a new enough kernel (maybe 2.6.38 or 2.6.39?), it will zero the inode table blocks for you.

> Any other options?
>
> Thanks
> Robin
>
>
> --- Andreas Dilger wrote:
>> If you can wipe the MMC device to be all-zero efficiently, then you can format it quickly with "mke2fs -E lazy_itable_init,lazy_journal_init ..." and restore from a tarball.
>>
>> Alternately, Lukas recently added support for QCOW2 sparse image format, and it should be possible to restore this to the device efficiently, if it is zeroed in advance. I don't know if his code skips all-zero blocks in the image, but that should be possible to add fairly easily.
>>
>> Cheers, Andreas
>>
>> On 2011-07-22, at 9:49 AM, Round Robinjp <[email protected]> wrote:
>>
>>> Hi
>>>
>>> I have a question regarding making ext4 image for
>>> large eMMC partition.
>>>
>>> We have a 4G partition in our embedded device
>>> in which we want to use ext4 filesystem.
>>> But for that we have to create a 4G image.
>>> flashing this 4G image to the eMMC takes a long
>>> time. Is there any way to reduce this time?
>>>
>>> For vfat, you can truncate the image leaving only
>>> non zero-filled blocks which makes the image very
>>> short and the time for flashing is reduced.
>>> Is something similar to that possible for ext4?
>>>
>>> Thanks
>>> Robin


Cheers, Andreas






2011-07-25 18:10:47

by Theodore Ts'o

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Sat, Jul 23, 2011 at 12:49:28AM +0900, Round Robinjp wrote:
> Hi
>
> I have a question regarding making ext4 image for
> large eMMC partition.
>
> We have a 4G partition in our embedded device
> in which we want to use ext4 filesystem.
> But for that we have to create a 4G image.
> flashing this 4G image to the eMMC takes a long
> time. Is there any way to reduce this time?
>
> For vfat, you can truncate the image leaving only
> non zero-filled blocks which makes the image very
> short and the time for flashing is reduced.
> Is something similar to that possible for ext4?

OK, so it's not obvious what problem you are trying to ask here.

It sounds like Andreas was trying to help you solve the problem of
minimizing the number of blocks written by mke2fs.

I'm guessing the problem is you've already created a file system image
which is 4G, and for which a large number of the blocks are not used,
and you're trying to optimize the amount of time it takes to flash the
image. Is that right?

The way to do that is to use a program like zerofree.c (google it, or
see attached) to make sure the non-used blocks are zero-filled, and
then use a program like make-sparse.c (see the e2fsprogs sources, in
the contrib directory) to only write the non-zero blocks to the flash
device.

Regards,

- Ted


Attachments:
(No filename) (1.29 kB)
zerofree.c (3.45 kB)
Download all attachments

2011-07-25 18:36:37

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Mon, Jul 25, 2011 at 9:10 PM, Ted Ts'o <[email protected]> wrote:
> On Sat, Jul 23, 2011 at 12:49:28AM +0900, Round Robinjp wrote:
>> Hi
>>
>> I have a question regarding making ext4 image for
>> large eMMC partition.
>>
>> We have a 4G partition in our embedded device
>> in which we want to use ext4 filesystem.
>> But for that we have to create a 4G image.
>> flashing this 4G image to the eMMC takes a long
>> time. Is there any way to reduce this time?
>>
>> For vfat, you can truncate the image leaving only
>> non zero-filled blocks which makes the image very
>> short and the time for flashing is reduced.
>> Is something similar to that possible for ext4?
>
> OK, so it's not obvious what problem you are trying to ask here.
>
> It sounds like Andreas was trying to help you solve the problem of
> minimizing the number of blocks written by mke2fs.
>
> I'm guessing the problem is you've already created a file system image
> which is 4G, and for which a large number of the blocks are not used,
> and you're trying to optimize the amount of time it takes to flash the
> image. ?Is that right?
>

I am going to make a 3rd guess and we will see who was closest ;-)
My guess is that Round wan't a "short" image, just like he wrote.
vfat image can simply be truncated, because all initial blocks are at the
beginning of the partition.

One could truncate the result of an ext4 image to quite less than 4G,
for example, if flex_bg is set to 32, all bitmaps are at the block group 0.
copies of the super block can be discarded, since one has the copy in
the image file.

The only important piece of information, not in the beginning of the partition
is the super block of the journal, which is usually in the middle of the fs,
so one needs do some tricks to allocate the journal from group 0.
Is there a mke2fs option to do that?

All-in-all, I think it should be easy to prepare a 4G image that could
be truncated
to one group (128M).

Amir.

> The way to do that is to use a program like zerofree.c (google it, or
> see attached) to make sure the non-used blocks are zero-filled, and
> then use a program like make-sparse.c (see the e2fsprogs sources, in
> the contrib directory) to only write the non-zero blocks to the flash
> device.
>
> Regards,
>
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Ted
>

2011-07-26 01:39:59

by Yongqiang Yang

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Jul 26, 2011 at 2:36 AM, Amir Goldstein <[email protected]> wrote:
> On Mon, Jul 25, 2011 at 9:10 PM, Ted Ts'o <[email protected]> wrote:
>> On Sat, Jul 23, 2011 at 12:49:28AM +0900, Round Robinjp wrote:
>>> Hi
>>>
>>> I have a question regarding making ext4 image for
>>> large eMMC partition.
>>>
>>> We have a 4G partition in our embedded device
>>> in which we want to use ext4 filesystem.
>>> But for that we have to create a 4G image.
>>> flashing this 4G image to the eMMC takes a long
>>> time. Is there any way to reduce this time?
>>>
>>> For vfat, you can truncate the image leaving only
>>> non zero-filled blocks which makes the image very
>>> short and the time for flashing is reduced.
>>> Is something similar to that possible for ext4?
>>
>> OK, so it's not obvious what problem you are trying to ask here.
>>
>> It sounds like Andreas was trying to help you solve the problem of
>> minimizing the number of blocks written by mke2fs.
>>
>> I'm guessing the problem is you've already created a file system image
>> which is 4G, and for which a large number of the blocks are not used,
>> and you're trying to optimize the amount of time it takes to flash the
>> image. ?Is that right?
>>
>
> I am going to make a 3rd guess and we will see who was closest ;-)
> My guess is that Round wan't a "short" image, just like he wrote.
> vfat image can simply be truncated, because all initial blocks are at the
> beginning of the partition.
>
> One could truncate the result of an ext4 image to quite less than 4G,
> for example, if flex_bg is set to 32, all bitmaps are at the block group 0.
> copies of the super block can be discarded, since one has the copy in
> the image file.
>
> The only important piece of information, not in the beginning of the partition
> is the super block of the journal, which is usually in the middle of the fs,
> so one needs do some tricks to allocate the journal from group 0.
> Is there a mke2fs option to do that?
Now the fs is clean, so we can delete journal. After the image is
flashed to the eMMC, we can add journal again. I think tune2fs can
add and delete journal. Am I rgiht?

Yongqiang.
>
> All-in-all, I think it should be easy to prepare a 4G image that could
> be truncated
> to one group (128M).
>
> Amir.
>
>> The way to do that is to use a program like zerofree.c (google it, or
>> see attached) to make sure the non-used blocks are zero-filled, and
>> then use a program like make-sparse.c (see the e2fsprogs sources, in
>> the contrib directory) to only write the non-zero blocks to the flash
>> device.
>>
>> Regards,
>>
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Ted
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>



--
Best Wishes
Yongqiang Yang

2011-07-26 04:07:22

by Andreas Dilger

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On 2011-07-25, at 7:39 PM, Yongqiang Yang wrote:
> On Mon, Jul 25, 2011 at 9:10 PM, Ted Ts'o <[email protected]> wrote:
>> On Sat, Jul 23, 2011 at 12:49:28AM +0900, Round Robinjp wrote:
>>> I have a question regarding making ext4 image for
>>> large eMMC partition.
>>>
>>> We have a 4G partition in our embedded device
>>> in which we want to use ext4 filesystem.
>>> But for that we have to create a 4G image.
>>> flashing this 4G image to the eMMC takes a long
>>> time. Is there any way to reduce this time?
>>>
>>> For vfat, you can truncate the image leaving only
>>> non zero-filled blocks which makes the image very
>>> short and the time for flashing is reduced.
>>> Is something similar to that possible for ext4?
>>
>> I'm guessing the problem is you've already created a file system image
>> which is 4G, and for which a large number of the blocks are not used,
>> and you're trying to optimize the amount of time it takes to flash the
>> image. Is that right?
>
> Now the fs is clean, so we can delete journal. After the image is
> flashed to the eMMC, we can add journal again. I think tune2fs can
> add and delete journal. Am I rgiht?

Yes, "tune2fs -O ^has_journal {dev}" will remove the journal (if clean).
That will save 32MB of space in your image.

Then, use "resize2fs -M {dev}" to shrink the image as small as possible,
and then after restoring the image, run "resize2fs {dev}" to grow the
image to fill the device again and "tune2fs -j {dev}" will add it again
with the default size.

Cheers, Andreas






2011-07-26 04:13:59

by Theodore Ts'o

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4


On Jul 25, 2011, at 2:36 PM, Amir Goldstein wrote:

> I am going to make a 3rd guess and we will see who was closest ;-)
> My guess is that Round wan't a "short" image, just like he wrote.
> vfat image can simply be truncated, because all initial blocks are at the
> beginning of the partition.

Sure, but why did he want a "short"/truncated image? Because it's faster
to load onto the flash device for mass production, right?

If you can do that with a specialized tool that writes the necessary blocks
and not the ones that are all zeros, it solves his high-level need.

> One could truncate the result of an ext4 image to quite less than 4G,
> for example, if flex_bg is set to 32, all bitmaps are at the block group 0.
> copies of the super block can be discarded, since one has the copy in
> the image file.

You could do that, but it's a lot more complicated, and you still need
to write a tool that determines the first block where it is safe to truncate
away the backup superblocks. And you have to hack mke2fs, and use
special options to make sure the flex bg size is large enough so that
all of the block group descriptors are the beginning of the disk.

It's much simpler to use a sparse image and then use a special tool
to write the file system image onto the MMC device. The approach
you outlined can work, but it's a lot more complicated and easy
to mess up.

-- Ted


2011-07-26 17:38:24

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

> I'm guessing the problem is you've already created a file system image
> which is 4G, and for which a large number of the blocks are not used,
> and you're trying to optimize the amount of time it takes to flash the
> image. Is that right?

Yes, exactly.

> The way to do that is to use a program like zerofree.c (google it, or
> see attached) to make sure the non-used blocks are zero-filled, and
> then use a program like make-sparse.c (see the e2fsprogs sources, in
> the contrib directory) to only write the non-zero blocks to the flash
> device.

I see.
The flash will then contain _random_ data in the non-used blocks.
That is not a problem, right?

One more thing.
Although I have very small amount of files in my 4G image,
I see that the image has almost no zero-filled blocks.
Is that normal for ext4?
Can zerofree.c recognize them as non-used blocks?

Many thanks to those who replied.
Round

2011-07-27 01:21:41

by Theodore Ts'o

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Wed, Jul 27, 2011 at 02:38:19AM +0900, Round Robinjp wrote:
>
> I see.
> The flash will then contain _random_ data in the non-used blocks.
> That is not a problem, right?

Nope. So long as the previously written (random) data on the card
doesn't contain anything security sensitive.

So for example, if someone used a microSD card to transfer credit card
numbers from their e-commerce website to their credit card processor,
and then afterwards, deciding they didn't need the card any more, and
dropped it into a bin at the production line where it got flashed and
put into a cell phone that was then shipped to Best Buy, then the
non-used blocks wouldn't get written and credit card numbers might get
exposed. But that's probably only something that folks who designed
the security systems at Sony would do, so there's nothing to worry
about. :-)

> One more thing.
> Although I have very small amount of files in my 4G image,
> I see that the image has almost no zero-filled blocks.
> Is that normal for ext4?

It depends on how you created the image.

> Can zerofree.c recognize them as non-used blocks?

Yes, it uses the block allocation bitmaps to understand what is used
and non-used.

- Ted

2011-07-27 16:40:50

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

> > The flash will then contain _random_ data in the non-used blocks.
> > That is not a problem, right?
>
> Nope. So long as the previously written (random) data on the card
> doesn't contain anything security sensitive.

I understood.

> > Although I have very small amount of files in my 4G image,
> > I see that the image has almost no zero-filled blocks.
> > Is that normal for ext4?
>
> It depends on how you created the image.

I create the image like this:

dd if=/dev/zero of=a.img bs=4096 count=1048576
mkfs.ext4 a.img
mount -t ext4 -o loop a.img /mnt
cp -a /foo/* /mnt/
umount /mnt

> > Can zerofree.c recognize them as non-used blocks?
>
> Yes, it uses the block allocation bitmaps to understand what is used
> and non-used.

Great.

Thanks
Round

2011-07-27 17:16:49

by Andreas Dilger

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

I still think that using resize2fs and removing/adding the journal provides the clearest way to create a small image. The only drawback is that this needs some post-processing steps after the image is written, so it may not be suitable for some workflows.

Cheers, Andreas

On 2011-07-27, at 10:40 AM, Round Robinjp <[email protected]> wrote:

>>> The flash will then contain _random_ data in the non-used blocks.
>>> That is not a problem, right?
>>
>> Nope. So long as the previously written (random) data on the card
>> doesn't contain anything security sensitive.
>
> I understood.
>
>>> Although I have very small amount of files in my 4G image,
>>> I see that the image has almost no zero-filled blocks.
>>> Is that normal for ext4?
>>
>> It depends on how you created the image.
>
> I create the image like this:
>
> dd if=/dev/zero of=a.img bs=4096 count=1048576
> mkfs.ext4 a.img
> mount -t ext4 -o loop a.img /mnt
> cp -a /foo/* /mnt/
> umount /mnt
>
>>> Can zerofree.c recognize them as non-used blocks?
>>
>> Yes, it uses the block allocation bitmaps to understand what is used
>> and non-used.
>
> Great.
>
> Thanks
> Round
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2011-07-27 18:05:58

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Wed, Jul 27, 2011 at 8:16 PM, Andreas Dilger <[email protected]> wrote:
> I still think that using resize2fs and removing/adding the journal provides the clearest way to create a small image. The only drawback is that this needs some post-processing steps after the image is written, so it may not be suitable for some workflows.
>

I must say this is a fun game to play :-)

I think it can be done without post processing.
If you know the estimated disk usage of the initial fs, say 1G:
1. mkfs a 1G ext4 fs with no journal, flex_bg=32, resize=4G
2. mount it and cp -a /foo/* /mnt/
3. use new online resize to resize fs to 4G (maintaining flex_bg layout)
4. add journal to mounted fs (.journal file should be allocated with goal 0??)

if my calculations are correct, the only blocks written beyond the 1G mark
are the super block backup copies, so truncating the resulting image to 1G
won't do any damage - even fsck shouldn't complain.

I have a task in my queue to test Yongqiangs new resize patches
(not the series that was just merged - the next series).
When I get to it I will try to play this game and let you guys know if
it worked.

Amir.

> Cheers, Andreas
>
> On 2011-07-27, at 10:40 AM, Round Robinjp <[email protected]> wrote:
>
>>>> The flash will then contain _random_ data in the non-used blocks.
>>>> That is not a problem, right?
>>>
>>> Nope. ?So long as the previously written (random) data on the card
>>> doesn't contain anything security sensitive.
>>
>> I understood.
>>
>>>> Although I have very small amount of files in my 4G image,
>>>> I see that the image has almost no zero-filled blocks.
>>>> Is that normal for ext4?
>>>
>>> It depends on how you created the image.
>>
>> I create the image like this:
>>
>> dd if=/dev/zero of=a.img bs=4096 count=1048576
>> mkfs.ext4 a.img
>> mount -t ext4 -o loop a.img /mnt
>> cp -a /foo/* /mnt/
>> umount /mnt
>>
>>>> Can zerofree.c recognize them as non-used blocks?
>>>
>>> Yes, it uses the block allocation bitmaps to understand what is used
>>> and non-used.
>>
>> Great.
>>
>> Thanks
>> Round
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
>> the body of a message to [email protected]
>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

2011-07-27 18:08:30

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

I have got some nice ideas from you.
I summarize them here and add some comments.

o Idea from Andreas
Create minimal image, flash write, then resize2fs

-> Very straight forward idea.
-> Post-processing after flash writing adds some difficulties.

o Idea from Ted
Zero-fill the non-used blocks.
Make the flash writer write only non-zero blocks.

-> Very straight forward idea.
-> Flash writer needs to support this.

o Idea from Amir
Set flex_bg to 32.
Set sparse_super.
Allocate journal from group 0 (feasibility unclear)
Truncate the image.

-> Feasibility and effectiveness is unclear.
-> Good side is legacy flash writer can be used.

o Idea from Yongqiang
Delete journal before flash write and later add it back.

-> Post-processing after flash writing adds some difficulties.

I will examine all of these to find out a suitable solution.
Thanks
Round

2011-07-27 20:20:51

by Andreas Dilger

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On 2011-07-27, at 12:08 PM, Round Robinjp wrote:
> I have got some nice ideas from you.
> I summarize them here and add some comments.
>
> o Idea from Andreas
> Create minimal image, flash write, then resize2fs
>
> -> Very straight forward idea.
> -> Post-processing after flash writing adds some difficulties.

It would be possible to do the post-processing inside the kernel
initrd at first boot. Adding the journal to the root filesystem
would need to be done before it is mounted, if your image does not
have the journal. Adding a call to "resize2fs" if the filesystem
is not as large as the partition it is in is easy, and can be done
while the root filesystem is mounted.

> o Idea from Ted
> Zero-fill the non-used blocks.
> Make the flash writer write only non-zero blocks.
>
> -> Very straight forward idea.
> -> Flash writer needs to support this.
>
> o Idea from Amir
> Set flex_bg to 32.

To be strictly correct, this should be (final_size / 128M). For your
case of 4GB final size, a flex_bg factor of 32 is indeed correct.

You may also want to reduce the number of inodes in the image, by using
"-i" to specify a larger average file size. Default is only 16kB average
file size, but if you know the usage model (e.g. MP3s or photos 4MB in
size) then you can create far fewer inodes (e.g. mke2fs -i 1048576).

> Set sparse_super.
> Allocate journal from group 0 (feasibility unclear)

If you are up for some coding to change mke2fs, being able to specify a
goal block for the journal is something that I've been interested in for
some time already. Adding an option like "-J goal=0" would tell mke2fs
to start searching for free blocks at block 0 instead of the new default
journal goal of (blocks_count / 2). I don't think this would be very
difficult to implement, and would very likely be accepted by Ted.

> Truncate the image.

You should verify with dumpe2fs to check that there are no blocks in
use beyond the truncate range.

I like Amir's new suggestion better - create a small filesystem, fill
it up, then resize to the final size, then truncate down to the original
small filesystem size. Depending on how the resize is done, it should
be possible to have all of the end groups be completely empty.

> -> Feasibility and effectiveness is unclear.
> -> Good side is legacy flash writer can be used.
>
> o Idea from Yongqiang
> Delete journal before flash write and later add it back.
>
> -> Post-processing after flash writing adds some difficulties.
>
> I will examine all of these to find out a suitable solution.
> Thanks
> Round


Cheers, Andreas






2011-07-29 19:05:10

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

> When I get to it I will try to play this game and let you guys know if
> it worked.

Thanks in advance. :-)
Meanwhile, with my limited knowledge about ext4, I am trying your
method. It seems it is working. But I am not sure about a few
things. Details below.

> If you know the estimated disk usage of the initial fs, say 1G:
> 1. mkfs a 1G ext4 fs with no journal, flex_bg=32, resize=4G

I did this: (hope you meant this)

dd if=/dev/zero of=a.img bs=4K count=256K
mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img

> 2. mount it and cp -a /foo/* /mnt/

I did this:

sudo mount -t ext4 -o loop a.img /mnt/
cp -a /foo/* /mnt/

> 3. use new online resize to resize fs to 4G (maintaining flex_bg layout)

I did this: (hope you meant this)

e2fsck -f a.img
resize2fs a.img 4G

> 4. add journal to mounted fs (.journal file should be allocated with goal 0??)

I skipped this because I am not sure how to allocate .journal with goal 0.

> if my calculations are correct, the only blocks written beyond the 1G mark
> are the super block backup copies, so truncating the resulting image to 1G
> won't do any damage - even fsck shouldn't complain.

I did this:

sudo umount /mnt
truncate -s 1G a.img
e2fsck -f a.img
# this complains about several illegal blocks
# but after fixing, a.img mounts okay and files
# inside it looks okay.


Full operation log below:

--------------------------------------
--------------------------------------
--------------------------------------
$ dd if=/dev/zero of=a.img bs=4K count=256K
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB) copied, 23.4067 s, 45.9 MB/s

$ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img
mke2fs 1.41.14 (22-Dec-2010)
a.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

$ sudo mount -t ext4 -o loop a.img /mnt/

$ du -sh /usr/src/
92M /usr/src/

$ cp -a /usr/src/* /mnt/

$ e2fsck -f a.img
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
a.img: 11/65536 files (0.0% non-contiguous), 4443/262144 blocks

$ resize2fs a.img 4G
resize2fs 1.41.14 (22-Dec-2010)
Resizing the filesystem on a.img to 1048576 (4k) blocks.
The filesystem on a.img is now 1048576 blocks long.

$ sudo umount /mnt

$ truncate -s 1G a.img

$ e2fsck -f a.img
e2fsck 1.41.14 (22-Dec-2010)
Pass 1: Checking inodes, blocks, and sizes
Inode 7 has illegal block(s). Clear<y>? yes

Illegal block #2064 (294914) in inode 7. CLEARED.
Illegal block #2065 (819202) in inode 7. CLEARED.
Illegal block #2066 (884738) in inode 7. CLEARED.
Illegal block #3088 (294915) in inode 7. CLEARED.
Illegal block #3089 (819203) in inode 7. CLEARED.
Illegal block #3090 (884739) in inode 7. CLEARED.
Illegal block #4112 (294916) in inode 7. CLEARED.
Illegal block #4113 (819204) in inode 7. CLEARED.
Illegal block #4114 (884740) in inode 7. CLEARED.
Illegal block #5136 (294917) in inode 7. CLEARED.
Illegal block #5137 (819205) in inode 7. CLEARED.
Too many illegal blocks in inode 7.
Clear inode<y>? yes

Restarting e2fsck from the beginning...
Resize inode not valid. Recreate<y>? yes

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong for group #0 (24746, counted=24747).
Fix<y>? yes

Free blocks count wrong (234383, counted=234384).
Fix<y>? yes


a.img: ***** FILE SYSTEM WAS MODIFIED *****
a.img: 20864/65536 files (0.0% non-contiguous), 27760/262144 blocks

$ tune2fs -l a.img
tune2fs 1.41.14 (22-Dec-2010)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: 56f4818f-ee66-4a30-a31c-917b0816f139
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags: signed_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 65536
Block count: 262144
Reserved block count: 13107
Free blocks: 234384
Free inodes: 44672
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Sat Jul 30 03:18:44 2011
Last mount time: Sat Jul 30 03:19:04 2011
Last write time: Sat Jul 30 03:28:39 2011
Mount count: 0
Maximum mount count: 31
Last checked: Sat Jul 30 03:28:39 2011
Check interval: 15552000 (6 months)
Next check after: Thu Jan 26 03:28:39 2012
Lifetime writes: 722 kB
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
Default directory hash: half_md4
Directory Hash Seed: 6d50d9cc-e370-4868-acaa-92f7414df164

$ sudo mount -t ext4 -o loop a.img /mnt/

$ sudo du -sh /mnt/
92M /mnt/

$ cat /mnt/linux-headers-2.6.38-8/Documentation/Makefile
obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \
pcmcia/ spi/ timers/ vm/ watchdog/src/

$ ls -la /mnt/
total 32
drwxr-xr-x 5 round round 4096 Jul 30 03:26 .
drwxr-xr-x 23 root root 4096 Jul 9 01:24 ..
drwxr-xr-x 24 round round 4096 Apr 26 08:08 linux-headers-2.6.38-8
drwxr-xr-x 7 round round 4096 Apr 26 08:08 linux-headers-2.6.38-8-generic
drwx------ 2 root root 16384 Jul 30 03:18 lost+found

$ sudo umount /mnt
-------------------------------------
-------------------------------------
-------------------------------------

2011-07-29 19:46:07

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Fri, Jul 29, 2011 at 10:05 PM, Round Robinjp
<[email protected]> wrote:
>> When I get to it I will try to play this game and let you guys know if
>> it worked.
>
> Thanks in advance. :-)
> Meanwhile, with my limited knowledge about ext4, I am trying your
> method. It seems it is working. But I am not sure about a few
> things. Details below.
>
>> If you know the estimated disk usage of the initial fs, say 1G:
>> 1. mkfs a 1G ext4 fs with no journal, flex_bg=32, resize=4G
>
> I did this: (hope you meant this)
>
> dd if=/dev/zero of=a.img bs=4K count=256K
> mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img
>
>> 2. mount it and cp -a /foo/* /mnt/
>
> I did this:
>
> sudo mount -t ext4 -o loop a.img /mnt/
> cp -a /foo/* /mnt/
>
>> 3. use new online resize to resize fs to 4G (maintaining flex_bg layout)
>
> I did this: (hope you meant this)

I meant using a newer version of resize2fs (which you do not have),
but running fsck on the flashed image can be a valid alternative.

>
> e2fsck -f a.img
> resize2fs a.img 4G
>
>> 4. add journal to mounted fs (.journal file should be allocated with goal 0??)
>
> I skipped this because I am not sure how to allocate .journal with goal 0.

So your fs has no journal...
I meant to run:
# tune2fs -O has_journal /dev/loop<N>
while the image is mounted.
I never tried it, but I think it should create a .journal file at the
beginning of the partition.

>
>> if my calculations are correct, the only blocks written beyond the 1G mark
>> are the super block backup copies, so truncating the resulting image to 1G
>> won't do any damage - even fsck shouldn't complain.
>
> I did this:
>
> sudo umount /mnt
> truncate -s 1G a.img
> e2fsck -f a.img
> ?# this complains about several illegal blocks

They are "illegal" because they are beyond the end of the device.
You need to truncate -s 4G (after truncate -s 1G) to simulate that you
flashed to image to a 4G partition.

Please try that and send the post truncate/extend fsck report.
Please also send the 'dumpe2fs' of the pre-truncate and
post-truncate/extend image.

> ?# but after fixing, a.img mounts okay and files
> ?# inside it looks okay.

Yes, those files would look OK, but trying to write new files to the
'phantom' 3G, can cause some problem along the way.

>
>
> Full operation log below:
>
> --------------------------------------
> --------------------------------------
> --------------------------------------
> $ dd if=/dev/zero of=a.img bs=4K count=256K
> 262144+0 records in
> 262144+0 records out
> 1073741824 bytes (1.1 GB) copied, 23.4067 s, 45.9 MB/s
>
> $ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img
> mke2fs 1.41.14 (22-Dec-2010)
> a.img is not a block special device.
> Proceed anyway? (y,n) y
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> Stride=0 blocks, Stripe width=0 blocks
> 65536 inodes, 262144 blocks
> 13107 blocks (5.00%) reserved for the super user
> First data block=0
> Maximum filesystem blocks=268435456
> 8 block groups
> 32768 blocks per group, 32768 fragments per group
> 8192 inodes per group
> Superblock backups stored on blocks:
> ? ? ? ?32768, 98304, 163840, 229376
>
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
>
> This filesystem will be automatically checked every 31 mounts or
> 180 days, whichever comes first. ?Use tune2fs -c or -i to override.
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
>
> $ du -sh /usr/src/
> 92M ? ? /usr/src/
>
> $ cp -a /usr/src/* /mnt/
>
> $ e2fsck -f a.img
> e2fsck 1.41.14 (22-Dec-2010)
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> a.img: 11/65536 files (0.0% non-contiguous), 4443/262144 blocks
>
> $ resize2fs a.img 4G
> resize2fs 1.41.14 (22-Dec-2010)
> Resizing the filesystem on a.img to 1048576 (4k) blocks.
> The filesystem on a.img is now 1048576 blocks long.
>
> $ sudo umount /mnt
>
> $ truncate -s 1G a.img
>
> $ e2fsck -f a.img
> e2fsck 1.41.14 (22-Dec-2010)
> Pass 1: Checking inodes, blocks, and sizes
> Inode 7 has illegal block(s). ?Clear<y>? yes
>
> Illegal block #2064 (294914) in inode 7. ?CLEARED.
> Illegal block #2065 (819202) in inode 7. ?CLEARED.
> Illegal block #2066 (884738) in inode 7. ?CLEARED.
> Illegal block #3088 (294915) in inode 7. ?CLEARED.
> Illegal block #3089 (819203) in inode 7. ?CLEARED.
> Illegal block #3090 (884739) in inode 7. ?CLEARED.
> Illegal block #4112 (294916) in inode 7. ?CLEARED.
> Illegal block #4113 (819204) in inode 7. ?CLEARED.
> Illegal block #4114 (884740) in inode 7. ?CLEARED.
> Illegal block #5136 (294917) in inode 7. ?CLEARED.
> Illegal block #5137 (819205) in inode 7. ?CLEARED.
> Too many illegal blocks in inode 7.
> Clear inode<y>? yes
>
> Restarting e2fsck from the beginning...
> Resize inode not valid. ?Recreate<y>? yes

So fsck re-created the resize inode, which it had just cleared...
I bet if you run fsck again you would get the exact same errors over again.

>
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> Free blocks count wrong for group #0 (24746, counted=24747).
> Fix<y>? yes
>
> Free blocks count wrong (234383, counted=234384).
> Fix<y>? yes
>
>
> a.img: ***** FILE SYSTEM WAS MODIFIED *****
> a.img: 20864/65536 files (0.0% non-contiguous), 27760/262144 blocks
>
> $ tune2fs -l a.img
> tune2fs 1.41.14 (22-Dec-2010)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?56f4818f-ee66-4a30-a31c-917b0816f139
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
> Filesystem flags: ? ? ? ? signed_directory_hash
> Default mount options: ? ?(none)
> Filesystem state: ? ? ? ? clean
> Errors behavior: ? ? ? ? ?Continue
> Filesystem OS type: ? ? ? Linux
> Inode count: ? ? ? ? ? ? ?65536
> Block count: ? ? ? ? ? ? ?262144
> Reserved block count: ? ? 13107
> Free blocks: ? ? ? ? ? ? ?234384
> Free inodes: ? ? ? ? ? ? ?44672
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Sat Jul 30 03:18:44 2011
> Last mount time: ? ? ? ? ?Sat Jul 30 03:19:04 2011
> Last write time: ? ? ? ? ?Sat Jul 30 03:28:39 2011
> Mount count: ? ? ? ? ? ? ?0
> Maximum mount count: ? ? ?31
> Last checked: ? ? ? ? ? ? Sat Jul 30 03:28:39 2011
> Check interval: ? ? ? ? ? 15552000 (6 months)
> Next check after: ? ? ? ? Thu Jan 26 03:28:39 2012
> Lifetime writes: ? ? ? ? ?722 kB
> 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
> Default directory hash: ? half_md4
> Directory Hash Seed: ? ? ?6d50d9cc-e370-4868-acaa-92f7414df164
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
>
> $ sudo du -sh /mnt/
> 92M ? ? /mnt/
>
> $ cat /mnt/linux-headers-2.6.38-8/Documentation/Makefile
> obj-m := DocBook/ accounting/ auxdisplay/ connector/ \
> ? ? ? ?filesystems/ filesystems/configfs/ ia64/ laptops/ networking/ \
> ? ? ? ?pcmcia/ spi/ timers/ vm/ watchdog/src/
>
> $ ls -la /mnt/
> total 32
> drwxr-xr-x ?5 round round ?4096 Jul 30 03:26 .
> drwxr-xr-x 23 root root ?4096 Jul ?9 01:24 ..
> drwxr-xr-x 24 round round ?4096 Apr 26 08:08 linux-headers-2.6.38-8
> drwxr-xr-x ?7 round round ?4096 Apr 26 08:08 linux-headers-2.6.38-8-generic
> drwx------ ?2 root root 16384 Jul 30 03:18 lost+found
>
> $ sudo umount /mnt
> -------------------------------------
> -------------------------------------
> -------------------------------------
>

2011-08-01 17:43:31

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

> I meant using a newer version of resize2fs (which you do not have),

I have now corrected this and other mistakes.
But when I mount the image after finally extending
to 4G, the df still shows the size as 1G.
Am I still doing something wrong?

Full log below:

-----------------------------------------
-----------------------------------------
-----------------------------------------
$ dd if=/dev/zero of=a.img bs=4K count=256K
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB) copied, 4.09006 s, 263 MB/s

$ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img
mke2fs 1.42-WIP (02-Jul-2011)
a.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 0 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.

$ sudo mount -t ext4 -o loop a.img /mnt/
$ du -sh /usr/src/
92M /usr/src/
$ cp -a /usr/src/* /mnt/

$ e2fsck -f a.img
e2fsck 1.42-WIP (02-Jul-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (242859, counted=237788).
Fix<y>? yes

Free inodes count wrong (55821, counted=52249).
Fix<y>? yes


a.img: ***** FILE SYSTEM WAS MODIFIED *****
a.img: 13287/65536 files (0.0% non-contiguous), 24356/262144 blocks

$ resize2fs a.img 4G
resize2fs 1.42-WIP (02-Jul-2011)
Please run 'e2fsck -f a.img' first.

$ e2fsck -f a.img
e2fsck 1.42-WIP (02-Jul-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
a.img: 20864/65536 files (0.0% non-contiguous), 27067/262144 blocks

$ resize2fs a.img 4G
resize2fs 1.42-WIP (02-Jul-2011)
Resizing the filesystem on a.img to 1048576 (4k) blocks.
The filesystem on a.img is now 1048576 blocks long.

$ sudo tune2fs -O has_journal /dev/loop0
tune2fs 1.42-WIP (02-Jul-2011)
Creating journal inode: done
This filesystem will be automatically checked every 20 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.

$ sudo umount /mnt

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: 4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 65536
Block count: 262144
Reserved block count: 13107
Free blocks: 226191
Free inodes: 44671
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 02:29:45 2011
Last mount time: Tue Aug 2 02:29:50 2011
Last write time: Tue Aug 2 02:31:01 2011
Mount count: 1
Maximum mount count: 20
Last checked: Tue Aug 2 02:29:45 2011
Check interval: 0 (<none>)
Lifetime writes: 406 kB
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: 20500
Default directory hash: half_md4
Directory Hash Seed: a42d0c4e-0207-4fd4-94e7-b71bc107ae90
Journal features: (none)
Journal size: 32M
Journal length: 8192
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x3fe2, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Free blocks: 20358-32767
Free inodes:
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x1361, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Free blocks: 49152-57343, 60376-60383, 60512-61439
Free inodes:
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x3bb7, unused inodes 4076
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
28672 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
Free blocks: 69632-98303
Free inodes: 20501-24576
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x372b, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Free blocks: 98369-131071
Free inodes: 24904-32768
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x4c7a, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Free blocks: 131072-163839
Free inodes: 32807-40960
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xbd51, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 163905-196607
Free inodes: 40961-49152
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xf453, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 196608-229375
Free inodes: 49153-57344
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xfcc2, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 229441-262143
Free inodes: 57345-65536

$ truncate -s 1G a.img

$ e2fsck -f a.img
e2fsck 1.42-WIP (02-Jul-2011)
Backing up journal inode block information.

Moving journal from /.journal to hidden inode.

Pass 1: Checking inodes, blocks, and sizes
Inode 7 has illegal block(s). Clear<y>? yes

Illegal block #2064 (294914) in inode 7. CLEARED.
Illegal block #2065 (819202) in inode 7. CLEARED.
Illegal block #2066 (884738) in inode 7. CLEARED.
Illegal block #3088 (294915) in inode 7. CLEARED.
Illegal block #3089 (819203) in inode 7. CLEARED.
Illegal block #3090 (884739) in inode 7. CLEARED.
Illegal block #4112 (294916) in inode 7. CLEARED.
Illegal block #4113 (819204) in inode 7. CLEARED.
Illegal block #4114 (884740) in inode 7. CLEARED.
Illegal block #5136 (294917) in inode 7. CLEARED.
Illegal block #5137 (819205) in inode 7. CLEARED.
Too many illegal blocks in inode 7.
Clear inode<y>? yes

Restarting e2fsck from the beginning...
Resize inode not valid. Recreate<y>? yes

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(8022--20357)
Fix<y>? yes

Free blocks count wrong for group #0 (24745, counted=24746).
Fix<y>? yes

Free blocks count wrong (226190, counted=226191).
Fix<y>? yes


a.img: ***** FILE SYSTEM WAS MODIFIED *****
a.img: 20864/65536 files (0.0% non-contiguous), 35953/262144 blocks
$

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: 4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 65536
Block count: 262144
Reserved block count: 13107
Free blocks: 226191
Free inodes: 44672
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 02:29:45 2011
Last mount time: Tue Aug 2 02:29:50 2011
Last write time: Tue Aug 2 02:32:29 2011
Mount count: 0
Maximum mount count: 20
Last checked: Tue Aug 2 02:32:29 2011
Check interval: 0 (<none>)
Lifetime writes: 742 kB
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: a42d0c4e-0207-4fd4-94e7-b71bc107ae90
Journal backup: inode blocks
Journal features: (none)
Journal size: 32M
Journal length: 8192
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x3fe2, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Free blocks: 8022-32767
Free inodes:
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x1361, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Free blocks: 49152-57343, 60376-60383, 60512-61439
Free inodes:
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x3b77, unused inodes 4077
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
28672 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
Free blocks: 69632-98303
Free inodes: 20500-24576
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x372b, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Free blocks: 98369-131071
Free inodes: 24904-32768
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x4c7a, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Free blocks: 131072-163839
Free inodes: 32807-40960
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xbd51, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 163905-196607
Free inodes: 40961-49152
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xf453, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 196608-229375
Free inodes: 49153-57344
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xfcc2, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 229441-262143
Free inodes: 57345-65536

$ truncate -s 4G a.img

$ e2fsck -f a.img
e2fsck 1.42-WIP (02-Jul-2011)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
a.img: 20864/65536 files (0.0% non-contiguous), 35953/262144 blocks

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: 4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 65536
Block count: 262144
Reserved block count: 13107
Free blocks: 226191
Free inodes: 44672
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 02:29:45 2011
Last mount time: Tue Aug 2 02:29:50 2011
Last write time: Tue Aug 2 02:33:36 2011
Mount count: 0
Maximum mount count: 20
Last checked: Tue Aug 2 02:33:36 2011
Check interval: 0 (<none>)
Lifetime writes: 746 kB
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: a42d0c4e-0207-4fd4-94e7-b71bc107ae90
Journal backup: inode blocks
Journal features: (none)
Journal size: 32M
Journal length: 8192
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x3fe2, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Free blocks: 8022-32767
Free inodes:
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x1361, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Free blocks: 49152-57343, 60376-60383, 60512-61439
Free inodes:
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x3b77, unused inodes 4077
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
28672 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
Free blocks: 69632-98303
Free inodes: 20500-24576
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x372b, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Free blocks: 98369-131071
Free inodes: 24904-32768
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x4c7a, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Free blocks: 131072-163839
Free inodes: 32807-40960
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xbd51, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 163905-196607
Free inodes: 40961-49152
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xf453, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 196608-229375
Free inodes: 49153-57344
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xfcc2, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 229441-262143
Free inodes: 57345-65536

$ sudo mount -t ext4 -o loop a.img /mnt/
$ df
[...]
/dev/loop0 1032088 127324 852336 13% /mnt

$ sudo umount /mnt
-----------------------------------------
-----------------------------------------
-----------------------------------------

2011-08-01 18:57:51

by Theodore Ts'o

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Aug 02, 2011 at 02:43:20AM +0900, Round Robinjp wrote:
> > I meant using a newer version of resize2fs (which you do not have),
>
> I have now corrected this and other mistakes.
> But when I mount the image after finally extending
> to 4G, the df still shows the size as 1G.
> Am I still doing something wrong?

This is nowhere near correct. My first recommendation is to please
read the man pages so you understand what is happening; it's pretty
clear to me that you're following some other people's suggestions
without really understanding what each step does, and you're doing
some things which they were suggesting when you are creating the
small, compressed image, and what you should do after you flash the
image onto the disk.

Let me try this with a bit more more explicitly in hopes that it is
helpful.

1) Create the file system and mount it.

dd if=/dev/zero of=a.img bs=1G count=4
mke2fs -t ext4 -O ^has_journal a.img
mount -o loop a.img /mnt

2) Populate the image with your content. (I'll leave that up to you.)

3) Unmount the file system and compress it to its minimum size.

umount /mnt
resize2fs -M a.img

4) Save a.img into your source tree, or whatever.

5) For each system that you want to install this on, assuming that
/dev/mmc is your device with the mmc:

dd if=a.img of=/dev/mmc bs=32k
resize2fs /dev/mmc
tune2fs -O has_journal /dev/mmc

You're done!

Before you try this I recommend you read through each man pages for
mke2fs, resize2fs, tune2fs, and dd so you completely understand what
all of the options are, and why it works.

- Ted

2011-08-01 19:44:02

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Mon, Aug 1, 2011 at 8:43 PM, Round Robinjp <[email protected]> wrote:
>> I meant using a newer version of resize2fs (which you do not have),
>
> I have now corrected this and other mistakes.
> But when I mount the image after finally extending
> to 4G, the df still shows the size as 1G.
> Am I still doing something wrong?

yes, a few things :-)

>
> Full log below:
>
> -----------------------------------------
> -----------------------------------------
> -----------------------------------------
> $ dd if=/dev/zero of=a.img bs=4K count=256K
> 262144+0 records in
> 262144+0 records out
> 1073741824 bytes (1.1 GB) copied, 4.09006 s, 263 MB/s
>

create the initial a.img 4G and specify 1G to mkfs.
so the loop device size is 4G and you can online resize the fs to 4G.

> $ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G a.img
> mke2fs 1.42-WIP (02-Jul-2011)
> a.img is not a block special device.
> Proceed anyway? (y,n) y
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> Stride=0 blocks, Stripe width=0 blocks
> 65536 inodes, 262144 blocks
> 13107 blocks (5.00%) reserved for the super user
> First data block=0
> Maximum filesystem blocks=268435456
> 8 block groups
> 32768 blocks per group, 32768 fragments per group
> 8192 inodes per group
> Superblock backups stored on blocks:
> ? ? ? ?32768, 98304, 163840, 229376
>
> Allocating group tables: done
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
>
> This filesystem will be automatically checked every 0 mounts or
> 0 days, whichever comes first. ?Use tune2fs -c or -i to override.
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
> $ du -sh /usr/src/
> 92M ? ? /usr/src/
> $ cp -a /usr/src/* /mnt/
>

you should not run fsck on a mounted fs.
this is not good.
if you run fsck /dev/loop0 you will get an error.
if you want to check the fs, umount it first.

> $ e2fsck -f a.img
> e2fsck 1.42-WIP (02-Jul-2011)
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> Free blocks count wrong (242859, counted=237788).
> Fix<y>? yes
>
> Free inodes count wrong (55821, counted=52249).
> Fix<y>? yes
>
>
> a.img: ***** FILE SYSTEM WAS MODIFIED *****
> a.img: 13287/65536 files (0.0% non-contiguous), 24356/262144 blocks
>
> $ resize2fs a.img 4G

resize2fs /dev/loop0

> resize2fs 1.42-WIP (02-Jul-2011)
> Please run 'e2fsck -f a.img' first.
>
> $ e2fsck -f a.img
> e2fsck 1.42-WIP (02-Jul-2011)
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> a.img: 20864/65536 files (0.0% non-contiguous), 27067/262144 blocks
>
> $ resize2fs a.img 4G
> resize2fs 1.42-WIP (02-Jul-2011)
> Resizing the filesystem on a.img to 1048576 (4k) blocks.
> The filesystem on a.img is now 1048576 blocks long.
>
> $ sudo tune2fs -O has_journal /dev/loop0
> tune2fs 1.42-WIP (02-Jul-2011)
> Creating journal inode: done
> This filesystem will be automatically checked every 20 mounts or
> 0 days, whichever comes first. ?Use tune2fs -c or -i to override.
>
> $ sudo umount /mnt
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?65536
> Block count: ? ? ? ? ? ? ?262144

if you do everything right you should have 1048576 blocks after resize.

> Reserved block count: ? ? 13107
> Free blocks: ? ? ? ? ? ? ?226191
> Free inodes: ? ? ? ? ? ? ?44671
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 02:29:45 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 02:29:50 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 02:31:01 2011
> Mount count: ? ? ? ? ? ? ?1
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 02:29:45 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?406 kB
> 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: ? ? ? ? ? ?20500
> Default directory hash: ? half_md4
> Directory Hash Seed: ? ? ?a42d0c4e-0207-4fd4-94e7-b71bc107ae90
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 32M
> Journal length: ? ? ? ? ? 8192
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x3fe2, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> ?Free blocks: 20358-32767
> ?Free inodes:
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x1361, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> ?Free blocks: 49152-57343, 60376-60383, 60512-61439
> ?Free inodes:
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x3bb7, unused inodes 4076
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?28672 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
> ?Free blocks: 69632-98303
> ?Free inodes: 20501-24576
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x372b, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> ?Free blocks: 98369-131071
> ?Free inodes: 24904-32768
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x4c7a, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> ?Free blocks: 131072-163839
> ?Free inodes: 32807-40960
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xbd51, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 163905-196607
> ?Free inodes: 40961-49152
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xf453, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 196608-229375
> ?Free inodes: 49153-57344
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xfcc2, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 229441-262143
> ?Free inodes: 57345-65536
>
> $ truncate -s 1G a.img
>
> $ e2fsck -f a.img

don't try to 'fix' the fs before truncate -s 4G.
you can run fsck -nf if you want to see how the fs looks now.

> e2fsck 1.42-WIP (02-Jul-2011)
> Backing up journal inode block information.
>
> Moving journal from /.journal to hidden inode.
>
> Pass 1: Checking inodes, blocks, and sizes
> Inode 7 has illegal block(s). ?Clear<y>? yes
>
> Illegal block #2064 (294914) in inode 7. ?CLEARED.
> Illegal block #2065 (819202) in inode 7. ?CLEARED.
> Illegal block #2066 (884738) in inode 7. ?CLEARED.
> Illegal block #3088 (294915) in inode 7. ?CLEARED.
> Illegal block #3089 (819203) in inode 7. ?CLEARED.
> Illegal block #3090 (884739) in inode 7. ?CLEARED.
> Illegal block #4112 (294916) in inode 7. ?CLEARED.
> Illegal block #4113 (819204) in inode 7. ?CLEARED.
> Illegal block #4114 (884740) in inode 7. ?CLEARED.
> Illegal block #5136 (294917) in inode 7. ?CLEARED.
> Illegal block #5137 (819205) in inode 7. ?CLEARED.
> Too many illegal blocks in inode 7.
> Clear inode<y>? yes
>
> Restarting e2fsck from the beginning...
> Resize inode not valid. ?Recreate<y>? yes
>
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> Block bitmap differences: ?-(8022--20357)
> Fix<y>? yes
>
> Free blocks count wrong for group #0 (24745, counted=24746).
> Fix<y>? yes
>
> Free blocks count wrong (226190, counted=226191).
> Fix<y>? yes
>
>
> a.img: ***** FILE SYSTEM WAS MODIFIED *****
> a.img: 20864/65536 files (0.0% non-contiguous), 35953/262144 blocks
> $
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?65536
> Block count: ? ? ? ? ? ? ?262144
> Reserved block count: ? ? 13107
> Free blocks: ? ? ? ? ? ? ?226191
> Free inodes: ? ? ? ? ? ? ?44672
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 02:29:45 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 02:29:50 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 02:32:29 2011
> Mount count: ? ? ? ? ? ? ?0
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 02:32:29 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?742 kB
> 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: ? ? ?a42d0c4e-0207-4fd4-94e7-b71bc107ae90
> Journal backup: ? ? ? ? ? inode blocks
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 32M
> Journal length: ? ? ? ? ? 8192
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x3fe2, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> ?Free blocks: 8022-32767
> ?Free inodes:
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x1361, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> ?Free blocks: 49152-57343, 60376-60383, 60512-61439
> ?Free inodes:
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x3b77, unused inodes 4077
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?28672 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
> ?Free blocks: 69632-98303
> ?Free inodes: 20500-24576
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x372b, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> ?Free blocks: 98369-131071
> ?Free inodes: 24904-32768
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x4c7a, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> ?Free blocks: 131072-163839
> ?Free inodes: 32807-40960
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xbd51, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 163905-196607
> ?Free inodes: 40961-49152
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xf453, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 196608-229375
> ?Free inodes: 49153-57344
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xfcc2, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 229441-262143
> ?Free inodes: 57345-65536
>
> $ truncate -s 4G a.img
>
> $ e2fsck -f a.img
> e2fsck 1.42-WIP (02-Jul-2011)
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> a.img: 20864/65536 files (0.0% non-contiguous), 35953/262144 blocks
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?4f2361c3-2755-4a6a-bf28-dd7e1a4dd772
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?65536
> Block count: ? ? ? ? ? ? ?262144
> Reserved block count: ? ? 13107
> Free blocks: ? ? ? ? ? ? ?226191
> Free inodes: ? ? ? ? ? ? ?44672
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 02:29:45 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 02:29:50 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 02:33:36 2011
> Mount count: ? ? ? ? ? ? ?0
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 02:33:36 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?746 kB
> 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: ? ? ?a42d0c4e-0207-4fd4-94e7-b71bc107ae90
> Journal backup: ? ? ? ? ? inode blocks
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 32M
> Journal length: ? ? ? ? ? 8192
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x3fe2, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> ?Free blocks: 8022-32767
> ?Free inodes:
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x1361, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> ?Free blocks: 49152-57343, 60376-60383, 60512-61439
> ?Free inodes:
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x3b77, unused inodes 4077
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?28672 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
> ?Free blocks: 69632-98303
> ?Free inodes: 20500-24576
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x372b, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> ?Free blocks: 98369-131071
> ?Free inodes: 24904-32768
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x4c7a, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> ?Free blocks: 131072-163839
> ?Free inodes: 32807-40960
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xbd51, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 163905-196607
> ?Free inodes: 40961-49152
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xf453, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 196608-229375
> ?Free inodes: 49153-57344
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xfcc2, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 229441-262143
> ?Free inodes: 57345-65536
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
> $ df
> [...]
> /dev/loop0 ? ? ? ? ? ? 1032088 ? ?127324 ? ?852336 ?13% /mnt
>
> $ sudo umount /mnt
> -----------------------------------------
> -----------------------------------------
> -----------------------------------------
>

2011-08-02 06:53:44

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

Amir

> create the initial a.img 4G and specify 1G to mkfs.
> so the loop device size is 4G and you can online resize the fs to 4G.

I think this time I have been able to achieve what I was
trying to.

After resize, there are 1048576 blocks, as expected.
After truncating to 1G, dumpe2fs gives error, but I guess
this is also expected behaviour.

But after extending to 4G, e2fsck makes some complain.
I guess this is not expected behaviour, is it?

However, now df shows 4G as the fs size, which is as expected.

Log:
--------------------------------
--------------------------------
--------------------------------
$ dd if=/dev/zero of=a.img bs=4K count=1024K
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 14.2708 s, 301 MB/s

$ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G -b 4096 a.img 262144
mke2fs 1.42-WIP (02-Jul-2011)
a.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 0 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.

$ sudo mount -t ext4 -o loop a.img /mnt/

$ cp -a /usr/src/* /mnt/

$ sudo resize2fs /dev/loop0
resize2fs 1.42-WIP (02-Jul-2011)
Filesystem at /dev/loop0 is mounted on /mnt; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/loop0 to 1048576 (4k) blocks.
The filesystem on /dev/loop0 is now 1048576 blocks long.

$ sudo tune2fs -O has_journal /dev/loop0
tune2fs 1.42-WIP (02-Jul-2011)
Creating journal inode: done
This filesystem will be automatically checked every 20 mounts or
0 days, whichever comes first. Use tune2fs -c or -i to override.

$ sudo umount /mnt

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: f5a32b70-423d-448a-9550-90d67ff8b247
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 262144
Block count: 1048576
Reserved block count: 52419
Free blocks: 975516
Free inodes: 241279
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 14:55:16 2011
Last mount time: Tue Aug 2 14:55:24 2011
Last write time: Tue Aug 2 15:33:06 2011
Mount count: 1
Maximum mount count: 20
Last checked: Tue Aug 2 14:55:16 2011
Check interval: 0 (<none>)
Lifetime writes: 406 kB
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: 20500
Default directory hash: half_md4
Directory Hash Seed: 6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
Journal features: (none)
Journal size: 128M
Journal length: 32768
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x6170, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Free blocks: 8022-32767
Free inodes:
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x4df3, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Free blocks: 49152-57343, 60376-60383, 60512-61439
Free inodes:
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x7b0d, unused inodes 4076
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
4096 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
Free blocks: 94208-98303
Free inodes: 20501-24576
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x69b9, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Free blocks: 98369-131071
Free inodes: 24904-32768
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x12e8, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Free blocks: 131072-163839
Free inodes: 32807-40960
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xe3c3, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 163905-196607
Free inodes: 40961-49152
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xaac1, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 196608-229375
Free inodes: 49153-57344
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xa250, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 229441-262143
Free inodes: 57345-65536
Group 8: (Blocks 262144-294911) [ITABLE_ZEROED]
Checksum 0x99e5, unused inodes 0
Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
Inode table at 262146-262657 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 262658-294911
Free inodes: 65537-73728
Group 9: (Blocks 294912-327679) [ITABLE_ZEROED]
Checksum 0xf08a, unused inodes 0
Backup superblock at 294912, Group descriptors at 294913-294913
Reserved GDT blocks at 294914-294976
Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
Inode table at 294979-295490 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Free blocks: 295491-327679
Free inodes: 73729-81920
Group 10: (Blocks 327680-360447) [ITABLE_ZEROED]
Checksum 0xc787, unused inodes 0
Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
Inode table at 327682-328193 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 328194-360447
Free inodes: 81921-90112
Group 11: (Blocks 360448-393215) [ITABLE_ZEROED]
Checksum 0xe8b6, unused inodes 0
Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
Inode table at 360450-360961 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 360962-393215
Free inodes: 90113-98304
Group 12: (Blocks 393216-425983) [ITABLE_ZEROED]
Checksum 0x2521, unused inodes 0
Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
Inode table at 393218-393729 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 393730-425983
Free inodes: 98305-106496
Group 13: (Blocks 425984-458751) [ITABLE_ZEROED]
Checksum 0x0a10, unused inodes 0
Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
Inode table at 425986-426497 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 426498-458751
Free inodes: 106497-114688
Group 14: (Blocks 458752-491519) [ITABLE_ZEROED]
Checksum 0x7b43, unused inodes 0
Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
Inode table at 458754-459265 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 459266-491519
Free inodes: 114689-122880
Group 15: (Blocks 491520-524287) [ITABLE_ZEROED]
Checksum 0x5472, unused inodes 0
Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
Inode table at 491522-492033 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 492034-524287
Free inodes: 122881-131072
Group 16: (Blocks 524288-557055) [ITABLE_ZEROED]
Checksum 0xd378, unused inodes 0
Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
Inode table at 524290-524801 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 524802-557055
Free inodes: 131073-139264
Group 17: (Blocks 557056-589823) [ITABLE_ZEROED]
Checksum 0xfc49, unused inodes 0
Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
Inode table at 557058-557569 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 557570-589823
Free inodes: 139265-147456
Group 18: (Blocks 589824-622591) [ITABLE_ZEROED]
Checksum 0x8d1a, unused inodes 0
Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
Inode table at 589826-590337 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 590338-622591
Free inodes: 147457-155648
Group 19: (Blocks 622592-655359) [ITABLE_ZEROED]
Checksum 0xa22b, unused inodes 0
Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
Inode table at 622594-623105 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 623106-655359
Free inodes: 155649-163840
Group 20: (Blocks 655360-688127) [ITABLE_ZEROED]
Checksum 0x6fbc, unused inodes 0
Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
Inode table at 655362-655873 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 655874-688127
Free inodes: 163841-172032
Group 21: (Blocks 688128-720895) [ITABLE_ZEROED]
Checksum 0x408d, unused inodes 0
Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
Inode table at 688130-688641 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 688642-720895
Free inodes: 172033-180224
Group 22: (Blocks 720896-753663) [ITABLE_ZEROED]
Checksum 0x31de, unused inodes 0
Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
Inode table at 720898-721409 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 721410-753663
Free inodes: 180225-188416
Group 23: (Blocks 753664-786431) [ITABLE_ZEROED]
Checksum 0x1eef, unused inodes 0
Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
Inode table at 753666-754177 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 754178-786431
Free inodes: 188417-196608
Group 24: (Blocks 786432-819199) [ITABLE_ZEROED]
Checksum 0xeaf3, unused inodes 0
Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
Inode table at 786434-786945 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 786946-819199
Free inodes: 196609-204800
Group 25: (Blocks 819200-851967) [ITABLE_ZEROED]
Checksum 0x839c, unused inodes 0
Backup superblock at 819200, Group descriptors at 819201-819201
Reserved GDT blocks at 819202-819264
Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
Inode table at 819267-819778 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Free blocks: 819779-851967
Free inodes: 204801-212992
Group 26: (Blocks 851968-884735) [ITABLE_ZEROED]
Checksum 0xb491, unused inodes 0
Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
Inode table at 851970-852481 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 852482-884735
Free inodes: 212993-221184
Group 27: (Blocks 884736-917503) [ITABLE_ZEROED]
Checksum 0xddfe, unused inodes 0
Backup superblock at 884736, Group descriptors at 884737-884737
Reserved GDT blocks at 884738-884800
Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
Inode table at 884803-885314 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Free blocks: 885315-917503
Free inodes: 221185-229376
Group 28: (Blocks 917504-950271) [ITABLE_ZEROED]
Checksum 0x5637, unused inodes 0
Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
Inode table at 917506-918017 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 918018-950271
Free inodes: 229377-237568
Group 29: (Blocks 950272-983039) [ITABLE_ZEROED]
Checksum 0x7906, unused inodes 0
Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
Inode table at 950274-950785 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 950786-983039
Free inodes: 237569-245760
Group 30: (Blocks 983040-1015807) [ITABLE_ZEROED]
Checksum 0x0855, unused inodes 0
Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
Inode table at 983042-983553 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 983554-1015807
Free inodes: 245761-253952
Group 31: (Blocks 1015808-1048575) [ITABLE_ZEROED]
Checksum 0x2764, unused inodes 0
Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
Inode table at 1015810-1016321 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Free blocks: 1016322-1048575
Free inodes: 253953-262144

$ truncate -s 1G a.img

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: f5a32b70-423d-448a-9550-90d67ff8b247
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 262144
Block count: 1048576
Reserved block count: 52419
Free blocks: 975516
Free inodes: 241279
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 14:55:16 2011
Last mount time: Tue Aug 2 14:55:24 2011
Last write time: Tue Aug 2 15:33:06 2011
Mount count: 1
Maximum mount count: 20
Last checked: Tue Aug 2 14:55:16 2011
Check interval: 0 (<none>)
Lifetime writes: 406 kB
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: 20500
Default directory hash: half_md4
Directory Hash Seed: 6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
Journal features: (none)
Journal size: 128M
Journal length: 32768
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x6170, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x4df3, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x7b0d, unused inodes 4076
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
4096 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x69b9, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x12e8, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xe3c3, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xaac1, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xa250, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Group 8: (Blocks 262144-294911) [ITABLE_ZEROED]
Checksum 0x99e5, unused inodes 0
Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
Inode table at 262146-262657 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 9: (Blocks 294912-327679) [ITABLE_ZEROED]
Checksum 0xf08a, unused inodes 0
Backup superblock at 294912, Group descriptors at 294913-294913
Reserved GDT blocks at 294914-294976
Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
Inode table at 294979-295490 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Group 10: (Blocks 327680-360447) [ITABLE_ZEROED]
Checksum 0xc787, unused inodes 0
Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
Inode table at 327682-328193 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 11: (Blocks 360448-393215) [ITABLE_ZEROED]
Checksum 0xe8b6, unused inodes 0
Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
Inode table at 360450-360961 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 12: (Blocks 393216-425983) [ITABLE_ZEROED]
Checksum 0x2521, unused inodes 0
Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
Inode table at 393218-393729 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 13: (Blocks 425984-458751) [ITABLE_ZEROED]
Checksum 0x0a10, unused inodes 0
Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
Inode table at 425986-426497 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 14: (Blocks 458752-491519) [ITABLE_ZEROED]
Checksum 0x7b43, unused inodes 0
Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
Inode table at 458754-459265 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 15: (Blocks 491520-524287) [ITABLE_ZEROED]
Checksum 0x5472, unused inodes 0
Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
Inode table at 491522-492033 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 16: (Blocks 524288-557055) [ITABLE_ZEROED]
Checksum 0xd378, unused inodes 0
Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
Inode table at 524290-524801 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 17: (Blocks 557056-589823) [ITABLE_ZEROED]
Checksum 0xfc49, unused inodes 0
Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
Inode table at 557058-557569 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 18: (Blocks 589824-622591) [ITABLE_ZEROED]
Checksum 0x8d1a, unused inodes 0
Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
Inode table at 589826-590337 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 19: (Blocks 622592-655359) [ITABLE_ZEROED]
Checksum 0xa22b, unused inodes 0
Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
Inode table at 622594-623105 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 20: (Blocks 655360-688127) [ITABLE_ZEROED]
Checksum 0x6fbc, unused inodes 0
Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
Inode table at 655362-655873 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 21: (Blocks 688128-720895) [ITABLE_ZEROED]
Checksum 0x408d, unused inodes 0
Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
Inode table at 688130-688641 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 22: (Blocks 720896-753663) [ITABLE_ZEROED]
Checksum 0x31de, unused inodes 0
Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
Inode table at 720898-721409 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 23: (Blocks 753664-786431) [ITABLE_ZEROED]
Checksum 0x1eef, unused inodes 0
Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
Inode table at 753666-754177 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 24: (Blocks 786432-819199) [ITABLE_ZEROED]
Checksum 0xeaf3, unused inodes 0
Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
Inode table at 786434-786945 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 25: (Blocks 819200-851967) [ITABLE_ZEROED]
Checksum 0x839c, unused inodes 0
Backup superblock at 819200, Group descriptors at 819201-819201
Reserved GDT blocks at 819202-819264
Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
Inode table at 819267-819778 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Group 26: (Blocks 851968-884735) [ITABLE_ZEROED]
Checksum 0xb491, unused inodes 0
Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
Inode table at 851970-852481 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 27: (Blocks 884736-917503) [ITABLE_ZEROED]
Checksum 0xddfe, unused inodes 0
Backup superblock at 884736, Group descriptors at 884737-884737
Reserved GDT blocks at 884738-884800
Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
Inode table at 884803-885314 (+67)
32189 free blocks, 8192 free inodes, 0 directories
Group 28: (Blocks 917504-950271) [ITABLE_ZEROED]
Checksum 0x5637, unused inodes 0
Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
Inode table at 917506-918017 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 29: (Blocks 950272-983039) [ITABLE_ZEROED]
Checksum 0x7906, unused inodes 0
Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
Inode table at 950274-950785 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 30: (Blocks 983040-1015807) [ITABLE_ZEROED]
Checksum 0x0855, unused inodes 0
Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
Inode table at 983042-983553 (+2)
32254 free blocks, 8192 free inodes, 0 directories
Group 31: (Blocks 1015808-1048575) [ITABLE_ZEROED]
Checksum 0x2764, unused inodes 0
Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
Inode table at 1015810-1016321 (+2)
32254 free blocks, 8192 free inodes, 0 directories

dumpe2fs: a.img: error reading bitmaps: Can't read an block bitmap

$ truncate -s 4G a.img

$ e2fsck -f a.img
e2fsck 1.42-WIP (02-Jul-2011)
Backing up journal inode block information.

Moving journal from /.journal to hidden inode.

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: +(262144--262657) +(294912--295490) +(327680--328193) +(360448--360961) +(393216--393729) +(425984--426497) +(458752--459265) +(491520--492033) +(524288--524801) +(557056--557569) +(589824--590337) +(622592--623105) +(655360--655873) +(688128--688641) +(720896--721409) +(753664--754177) +(786432--786945) +(819200--819778) +(851968--852481) +(884736--885314) +(917504--918017) +(950272--950785) +(983040--983553) +(1015808--1016321)
Fix<y>? yes


a.img: ***** FILE SYSTEM WAS MODIFIED *****
a.img: 20864/262144 files (0.0% non-contiguous), 73060/1048576 blocks

$ dumpe2fs a.img
dumpe2fs 1.42-WIP (02-Jul-2011)
Filesystem volume name: <none>
Last mounted on: /mnt
Filesystem UUID: f5a32b70-423d-448a-9550-90d67ff8b247
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype 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: 262144
Block count: 1048576
Reserved block count: 52419
Free blocks: 975516
Free inodes: 241280
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 63
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 32
Filesystem created: Tue Aug 2 14:55:16 2011
Last mount time: Tue Aug 2 14:55:24 2011
Last write time: Tue Aug 2 15:33:44 2011
Mount count: 0
Maximum mount count: 20
Last checked: Tue Aug 2 15:33:44 2011
Check interval: 0 (<none>)
Lifetime writes: 566 kB
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: 6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
Journal backup: inode blocks
Journal features: (none)
Journal size: 128M
Journal length: 32768
Journal sequence: 0x00000001
Journal start: 0


Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
Checksum 0x6170, unused inodes 0
Primary superblock at 0, Group descriptors at 1-1
Reserved GDT blocks at 2-64
Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
Inode table at 129-640 (+129)
24746 free blocks, 0 free inodes, 3 directories
Free blocks: 8022-32767
Free inodes:
Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
Checksum 0x4df3, unused inodes 0
Backup superblock at 32768, Group descriptors at 32769-32769
Reserved GDT blocks at 32770-32832
Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
Inode table at 641-1152 (bg #0 + 641)
9128 free blocks, 0 free inodes, 975 directories
Free blocks: 49152-57343, 60376-60383, 60512-61439
Free inodes:
Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
Checksum 0x7bcd, unused inodes 4077
Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
Inode table at 1153-1664 (bg #0 + 1153)
4096 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
Free blocks: 94208-98303
Free inodes: 20500-24576
Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
Checksum 0x69b9, unused inodes 7865
Backup superblock at 98304, Group descriptors at 98305-98305
Reserved GDT blocks at 98306-98368
Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
Inode table at 1665-2176 (bg #0 + 1665)
32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
Free blocks: 98369-131071
Free inodes: 24904-32768
Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
Checksum 0x12e8, unused inodes 8154
Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
Inode table at 2177-2688 (bg #0 + 2177)
32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
Free blocks: 131072-163839
Free inodes: 32807-40960
Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xe3c3, unused inodes 8192
Backup superblock at 163840, Group descriptors at 163841-163841
Reserved GDT blocks at 163842-163904
Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
Inode table at 2689-3200 (bg #0 + 2689)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 163905-196607
Free inodes: 40961-49152
Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Checksum 0xaac1, unused inodes 8192
Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
Inode table at 3201-3712 (bg #0 + 3201)
32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 196608-229375
Free inodes: 49153-57344
Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xa250, unused inodes 8192
Backup superblock at 229376, Group descriptors at 229377-229377
Reserved GDT blocks at 229378-229440
Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
Inode table at 3713-4224 (bg #0 + 3713)
32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 229441-262143
Free inodes: 57345-65536
Group 8: (Blocks 262144-294911) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x8219, unused inodes 8192
Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
Inode table at 262146-262657 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 262658-294911
Free inodes: 65537-73728
Group 9: (Blocks 294912-327679) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xeb76, unused inodes 8192
Backup superblock at 294912, Group descriptors at 294913-294913
Reserved GDT blocks at 294914-294976
Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
Inode table at 294979-295490 (+67)
32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 295491-327679
Free inodes: 73729-81920
Group 10: (Blocks 327680-360447) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xdc7b, unused inodes 8192
Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
Inode table at 327682-328193 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 328194-360447
Free inodes: 81921-90112
Group 11: (Blocks 360448-393215) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xf34a, unused inodes 8192
Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
Inode table at 360450-360961 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 360962-393215
Free inodes: 90113-98304
Group 12: (Blocks 393216-425983) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x3edd, unused inodes 8192
Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
Inode table at 393218-393729 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 393730-425983
Free inodes: 98305-106496
Group 13: (Blocks 425984-458751) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x11ec, unused inodes 8192
Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
Inode table at 425986-426497 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 426498-458751
Free inodes: 106497-114688
Group 14: (Blocks 458752-491519) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x60bf, unused inodes 8192
Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
Inode table at 458754-459265 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 459266-491519
Free inodes: 114689-122880
Group 15: (Blocks 491520-524287) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x4f8e, unused inodes 8192
Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
Inode table at 491522-492033 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 492034-524287
Free inodes: 122881-131072
Group 16: (Blocks 524288-557055) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xc884, unused inodes 8192
Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
Inode table at 524290-524801 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 524802-557055
Free inodes: 131073-139264
Group 17: (Blocks 557056-589823) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xe7b5, unused inodes 8192
Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
Inode table at 557058-557569 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 557570-589823
Free inodes: 139265-147456
Group 18: (Blocks 589824-622591) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x96e6, unused inodes 8192
Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
Inode table at 589826-590337 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 590338-622591
Free inodes: 147457-155648
Group 19: (Blocks 622592-655359) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xb9d7, unused inodes 8192
Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
Inode table at 622594-623105 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 623106-655359
Free inodes: 155649-163840
Group 20: (Blocks 655360-688127) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x7440, unused inodes 8192
Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
Inode table at 655362-655873 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 655874-688127
Free inodes: 163841-172032
Group 21: (Blocks 688128-720895) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x5b71, unused inodes 8192
Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
Inode table at 688130-688641 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 688642-720895
Free inodes: 172033-180224
Group 22: (Blocks 720896-753663) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x2a22, unused inodes 8192
Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
Inode table at 720898-721409 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 721410-753663
Free inodes: 180225-188416
Group 23: (Blocks 753664-786431) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x0513, unused inodes 8192
Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
Inode table at 753666-754177 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 754178-786431
Free inodes: 188417-196608
Group 24: (Blocks 786432-819199) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xf10f, unused inodes 8192
Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
Inode table at 786434-786945 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 786946-819199
Free inodes: 196609-204800
Group 25: (Blocks 819200-851967) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x9860, unused inodes 8192
Backup superblock at 819200, Group descriptors at 819201-819201
Reserved GDT blocks at 819202-819264
Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
Inode table at 819267-819778 (+67)
32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 819779-851967
Free inodes: 204801-212992
Group 26: (Blocks 851968-884735) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xaf6d, unused inodes 8192
Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
Inode table at 851970-852481 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 852482-884735
Free inodes: 212993-221184
Group 27: (Blocks 884736-917503) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0xc602, unused inodes 8192
Backup superblock at 884736, Group descriptors at 884737-884737
Reserved GDT blocks at 884738-884800
Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
Inode table at 884803-885314 (+67)
32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 885315-917503
Free inodes: 221185-229376
Group 28: (Blocks 917504-950271) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x4dcb, unused inodes 8192
Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
Inode table at 917506-918017 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 918018-950271
Free inodes: 229377-237568
Group 29: (Blocks 950272-983039) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x62fa, unused inodes 8192
Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
Inode table at 950274-950785 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 950786-983039
Free inodes: 237569-245760
Group 30: (Blocks 983040-1015807) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x13a9, unused inodes 8192
Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
Inode table at 983042-983553 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 983554-1015807
Free inodes: 245761-253952
Group 31: (Blocks 1015808-1048575) [INODE_UNINIT, ITABLE_ZEROED]
Checksum 0x3c98, unused inodes 8192
Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
Inode table at 1015810-1016321 (+2)
32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
Free blocks: 1016322-1048575
Free inodes: 253953-262144

$ sudo mount -t ext4 -o loop a.img /mnt/

$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop0 4128448 226384 3692388 6% /mnt

$ sudo umount /mnt
--------------------------------
--------------------------------
--------------------------------

2011-08-02 07:42:25

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Aug 2, 2011 at 9:53 AM, Round Robinjp <[email protected]> wrote:
> Amir
>
>> create the initial a.img 4G and specify 1G to mkfs.
>> so the loop device size is 4G and you can online resize the fs to 4G.
>
> I think this time I have been able to achieve what I was
> trying to.
>

Yes, you have :-)

> After resize, there are 1048576 blocks, as expected.
> After truncating to 1G, dumpe2fs gives error, but I guess
> this is also expected behaviour.
>
> But after extending to 4G, e2fsck makes some complain.
> I guess this is not expected behaviour, is it?
>

it is expected when you use the current resize2fs,
which does not respect the flex_bg layout, so new group block bitmaps
are allocated beyond the 1G border and initialized.
if you use Yongqiang's new 64bit resize patches, the final fsck won't complain.
unfortunately for you, those patches have not been merged to the kernel yet,
so you will have to either build your own ext4 module or wait at least until
kernel 3.2 is released to have it in mainline.

It is actually quite simple to fix the 1G image, so it will pass fsck
after truncate -s 4G.
All it takes it setting the BLOCK_UNINIT flag in groups 8-31
this should be possible to do with debugfs (or write a small tool to do it).
if I have time, it will try it myself and post the instructions.


> However, now df shows 4G as the fs size, which is as expected.
>
> Log:
> --------------------------------
> --------------------------------
> --------------------------------
> $ dd if=/dev/zero of=a.img bs=4K count=1024K
> 1048576+0 records in
> 1048576+0 records out
> 4294967296 bytes (4.3 GB) copied, 14.2708 s, 301 MB/s
>
> $ mkfs.ext4 -O ^has_journal,flex_bg -G 32 -E resize=4G -b 4096 a.img 262144
> mke2fs 1.42-WIP (02-Jul-2011)
> a.img is not a block special device.
> Proceed anyway? (y,n) y
> Filesystem label=
> OS type: Linux
> Block size=4096 (log=2)
> Fragment size=4096 (log=2)
> Stride=0 blocks, Stripe width=0 blocks
> 65536 inodes, 262144 blocks
> 13107 blocks (5.00%) reserved for the super user
> First data block=0
> Maximum filesystem blocks=268435456
> 8 block groups
> 32768 blocks per group, 32768 fragments per group
> 8192 inodes per group
> Superblock backups stored on blocks:
> ? ? ? ?32768, 98304, 163840, 229376
>
> Allocating group tables: done
> Writing inode tables: done
> Writing superblocks and filesystem accounting information: done
>
> This filesystem will be automatically checked every 0 mounts or
> 0 days, whichever comes first. ?Use tune2fs -c or -i to override.
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
>
> $ cp -a /usr/src/* /mnt/
>
> $ sudo resize2fs /dev/loop0
> resize2fs 1.42-WIP (02-Jul-2011)
> Filesystem at /dev/loop0 is mounted on /mnt; on-line resizing required
> old desc_blocks = 1, new_desc_blocks = 1
> Performing an on-line resize of /dev/loop0 to 1048576 (4k) blocks.
> The filesystem on /dev/loop0 is now 1048576 blocks long.
>
> $ sudo tune2fs -O has_journal /dev/loop0
> tune2fs 1.42-WIP (02-Jul-2011)
> Creating journal inode: done
> This filesystem will be automatically checked every 20 mounts or
> 0 days, whichever comes first. ?Use tune2fs -c or -i to override.
>
> $ sudo umount /mnt
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?f5a32b70-423d-448a-9550-90d67ff8b247
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?262144
> Block count: ? ? ? ? ? ? ?1048576
> Reserved block count: ? ? 52419
> Free blocks: ? ? ? ? ? ? ?975516
> Free inodes: ? ? ? ? ? ? ?241279
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 14:55:16 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 14:55:24 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 15:33:06 2011
> Mount count: ? ? ? ? ? ? ?1
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 14:55:16 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?406 kB
> 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: ? ? ? ? ? ?20500
> Default directory hash: ? half_md4
> Directory Hash Seed: ? ? ?6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 128M
> Journal length: ? ? ? ? ? 32768
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x6170, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> ?Free blocks: 8022-32767
> ?Free inodes:
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x4df3, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> ?Free blocks: 49152-57343, 60376-60383, 60512-61439
> ?Free inodes:
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x7b0d, unused inodes 4076
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?4096 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
> ?Free blocks: 94208-98303
> ?Free inodes: 20501-24576
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x69b9, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> ?Free blocks: 98369-131071
> ?Free inodes: 24904-32768
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x12e8, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> ?Free blocks: 131072-163839
> ?Free inodes: 32807-40960
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xe3c3, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 163905-196607
> ?Free inodes: 40961-49152
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xaac1, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 196608-229375
> ?Free inodes: 49153-57344
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xa250, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 229441-262143
> ?Free inodes: 57345-65536
> Group 8: (Blocks 262144-294911) [ITABLE_ZEROED]
> ?Checksum 0x99e5, unused inodes 0
> ?Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
> ?Inode table at 262146-262657 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 262658-294911
> ?Free inodes: 65537-73728
> Group 9: (Blocks 294912-327679) [ITABLE_ZEROED]
> ?Checksum 0xf08a, unused inodes 0
> ?Backup superblock at 294912, Group descriptors at 294913-294913
> ?Reserved GDT blocks at 294914-294976
> ?Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
> ?Inode table at 294979-295490 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 295491-327679
> ?Free inodes: 73729-81920
> Group 10: (Blocks 327680-360447) [ITABLE_ZEROED]
> ?Checksum 0xc787, unused inodes 0
> ?Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
> ?Inode table at 327682-328193 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 328194-360447
> ?Free inodes: 81921-90112
> Group 11: (Blocks 360448-393215) [ITABLE_ZEROED]
> ?Checksum 0xe8b6, unused inodes 0
> ?Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
> ?Inode table at 360450-360961 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 360962-393215
> ?Free inodes: 90113-98304
> Group 12: (Blocks 393216-425983) [ITABLE_ZEROED]
> ?Checksum 0x2521, unused inodes 0
> ?Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
> ?Inode table at 393218-393729 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 393730-425983
> ?Free inodes: 98305-106496
> Group 13: (Blocks 425984-458751) [ITABLE_ZEROED]
> ?Checksum 0x0a10, unused inodes 0
> ?Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
> ?Inode table at 425986-426497 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 426498-458751
> ?Free inodes: 106497-114688
> Group 14: (Blocks 458752-491519) [ITABLE_ZEROED]
> ?Checksum 0x7b43, unused inodes 0
> ?Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
> ?Inode table at 458754-459265 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 459266-491519
> ?Free inodes: 114689-122880
> Group 15: (Blocks 491520-524287) [ITABLE_ZEROED]
> ?Checksum 0x5472, unused inodes 0
> ?Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
> ?Inode table at 491522-492033 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 492034-524287
> ?Free inodes: 122881-131072
> Group 16: (Blocks 524288-557055) [ITABLE_ZEROED]
> ?Checksum 0xd378, unused inodes 0
> ?Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
> ?Inode table at 524290-524801 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 524802-557055
> ?Free inodes: 131073-139264
> Group 17: (Blocks 557056-589823) [ITABLE_ZEROED]
> ?Checksum 0xfc49, unused inodes 0
> ?Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
> ?Inode table at 557058-557569 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 557570-589823
> ?Free inodes: 139265-147456
> Group 18: (Blocks 589824-622591) [ITABLE_ZEROED]
> ?Checksum 0x8d1a, unused inodes 0
> ?Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
> ?Inode table at 589826-590337 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 590338-622591
> ?Free inodes: 147457-155648
> Group 19: (Blocks 622592-655359) [ITABLE_ZEROED]
> ?Checksum 0xa22b, unused inodes 0
> ?Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
> ?Inode table at 622594-623105 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 623106-655359
> ?Free inodes: 155649-163840
> Group 20: (Blocks 655360-688127) [ITABLE_ZEROED]
> ?Checksum 0x6fbc, unused inodes 0
> ?Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
> ?Inode table at 655362-655873 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 655874-688127
> ?Free inodes: 163841-172032
> Group 21: (Blocks 688128-720895) [ITABLE_ZEROED]
> ?Checksum 0x408d, unused inodes 0
> ?Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
> ?Inode table at 688130-688641 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 688642-720895
> ?Free inodes: 172033-180224
> Group 22: (Blocks 720896-753663) [ITABLE_ZEROED]
> ?Checksum 0x31de, unused inodes 0
> ?Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
> ?Inode table at 720898-721409 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 721410-753663
> ?Free inodes: 180225-188416
> Group 23: (Blocks 753664-786431) [ITABLE_ZEROED]
> ?Checksum 0x1eef, unused inodes 0
> ?Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
> ?Inode table at 753666-754177 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 754178-786431
> ?Free inodes: 188417-196608
> Group 24: (Blocks 786432-819199) [ITABLE_ZEROED]
> ?Checksum 0xeaf3, unused inodes 0
> ?Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
> ?Inode table at 786434-786945 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 786946-819199
> ?Free inodes: 196609-204800
> Group 25: (Blocks 819200-851967) [ITABLE_ZEROED]
> ?Checksum 0x839c, unused inodes 0
> ?Backup superblock at 819200, Group descriptors at 819201-819201
> ?Reserved GDT blocks at 819202-819264
> ?Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
> ?Inode table at 819267-819778 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 819779-851967
> ?Free inodes: 204801-212992
> Group 26: (Blocks 851968-884735) [ITABLE_ZEROED]
> ?Checksum 0xb491, unused inodes 0
> ?Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
> ?Inode table at 851970-852481 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 852482-884735
> ?Free inodes: 212993-221184
> Group 27: (Blocks 884736-917503) [ITABLE_ZEROED]
> ?Checksum 0xddfe, unused inodes 0
> ?Backup superblock at 884736, Group descriptors at 884737-884737
> ?Reserved GDT blocks at 884738-884800
> ?Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
> ?Inode table at 884803-885314 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 885315-917503
> ?Free inodes: 221185-229376
> Group 28: (Blocks 917504-950271) [ITABLE_ZEROED]
> ?Checksum 0x5637, unused inodes 0
> ?Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
> ?Inode table at 917506-918017 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 918018-950271
> ?Free inodes: 229377-237568
> Group 29: (Blocks 950272-983039) [ITABLE_ZEROED]
> ?Checksum 0x7906, unused inodes 0
> ?Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
> ?Inode table at 950274-950785 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 950786-983039
> ?Free inodes: 237569-245760
> Group 30: (Blocks 983040-1015807) [ITABLE_ZEROED]
> ?Checksum 0x0855, unused inodes 0
> ?Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
> ?Inode table at 983042-983553 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 983554-1015807
> ?Free inodes: 245761-253952
> Group 31: (Blocks 1015808-1048575) [ITABLE_ZEROED]
> ?Checksum 0x2764, unused inodes 0
> ?Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
> ?Inode table at 1015810-1016321 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> ?Free blocks: 1016322-1048575
> ?Free inodes: 253953-262144
>
> $ truncate -s 1G a.img
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?f5a32b70-423d-448a-9550-90d67ff8b247
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?262144
> Block count: ? ? ? ? ? ? ?1048576
> Reserved block count: ? ? 52419
> Free blocks: ? ? ? ? ? ? ?975516
> Free inodes: ? ? ? ? ? ? ?241279
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 14:55:16 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 14:55:24 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 15:33:06 2011
> Mount count: ? ? ? ? ? ? ?1
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 14:55:16 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?406 kB
> 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: ? ? ? ? ? ?20500
> Default directory hash: ? half_md4
> Directory Hash Seed: ? ? ?6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 128M
> Journal length: ? ? ? ? ? 32768
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x6170, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x4df3, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x7b0d, unused inodes 4076
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?4096 free blocks, 4076 free inodes, 2302 directories, 4076 unused inodes
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x69b9, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x12e8, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xe3c3, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xaac1, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xa250, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> Group 8: (Blocks 262144-294911) [ITABLE_ZEROED]
> ?Checksum 0x99e5, unused inodes 0
> ?Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
> ?Inode table at 262146-262657 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 9: (Blocks 294912-327679) [ITABLE_ZEROED]
> ?Checksum 0xf08a, unused inodes 0
> ?Backup superblock at 294912, Group descriptors at 294913-294913
> ?Reserved GDT blocks at 294914-294976
> ?Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
> ?Inode table at 294979-295490 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> Group 10: (Blocks 327680-360447) [ITABLE_ZEROED]
> ?Checksum 0xc787, unused inodes 0
> ?Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
> ?Inode table at 327682-328193 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 11: (Blocks 360448-393215) [ITABLE_ZEROED]
> ?Checksum 0xe8b6, unused inodes 0
> ?Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
> ?Inode table at 360450-360961 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 12: (Blocks 393216-425983) [ITABLE_ZEROED]
> ?Checksum 0x2521, unused inodes 0
> ?Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
> ?Inode table at 393218-393729 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 13: (Blocks 425984-458751) [ITABLE_ZEROED]
> ?Checksum 0x0a10, unused inodes 0
> ?Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
> ?Inode table at 425986-426497 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 14: (Blocks 458752-491519) [ITABLE_ZEROED]
> ?Checksum 0x7b43, unused inodes 0
> ?Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
> ?Inode table at 458754-459265 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 15: (Blocks 491520-524287) [ITABLE_ZEROED]
> ?Checksum 0x5472, unused inodes 0
> ?Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
> ?Inode table at 491522-492033 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 16: (Blocks 524288-557055) [ITABLE_ZEROED]
> ?Checksum 0xd378, unused inodes 0
> ?Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
> ?Inode table at 524290-524801 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 17: (Blocks 557056-589823) [ITABLE_ZEROED]
> ?Checksum 0xfc49, unused inodes 0
> ?Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
> ?Inode table at 557058-557569 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 18: (Blocks 589824-622591) [ITABLE_ZEROED]
> ?Checksum 0x8d1a, unused inodes 0
> ?Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
> ?Inode table at 589826-590337 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 19: (Blocks 622592-655359) [ITABLE_ZEROED]
> ?Checksum 0xa22b, unused inodes 0
> ?Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
> ?Inode table at 622594-623105 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 20: (Blocks 655360-688127) [ITABLE_ZEROED]
> ?Checksum 0x6fbc, unused inodes 0
> ?Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
> ?Inode table at 655362-655873 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 21: (Blocks 688128-720895) [ITABLE_ZEROED]
> ?Checksum 0x408d, unused inodes 0
> ?Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
> ?Inode table at 688130-688641 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 22: (Blocks 720896-753663) [ITABLE_ZEROED]
> ?Checksum 0x31de, unused inodes 0
> ?Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
> ?Inode table at 720898-721409 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 23: (Blocks 753664-786431) [ITABLE_ZEROED]
> ?Checksum 0x1eef, unused inodes 0
> ?Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
> ?Inode table at 753666-754177 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 24: (Blocks 786432-819199) [ITABLE_ZEROED]
> ?Checksum 0xeaf3, unused inodes 0
> ?Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
> ?Inode table at 786434-786945 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 25: (Blocks 819200-851967) [ITABLE_ZEROED]
> ?Checksum 0x839c, unused inodes 0
> ?Backup superblock at 819200, Group descriptors at 819201-819201
> ?Reserved GDT blocks at 819202-819264
> ?Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
> ?Inode table at 819267-819778 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> Group 26: (Blocks 851968-884735) [ITABLE_ZEROED]
> ?Checksum 0xb491, unused inodes 0
> ?Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
> ?Inode table at 851970-852481 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 27: (Blocks 884736-917503) [ITABLE_ZEROED]
> ?Checksum 0xddfe, unused inodes 0
> ?Backup superblock at 884736, Group descriptors at 884737-884737
> ?Reserved GDT blocks at 884738-884800
> ?Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
> ?Inode table at 884803-885314 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories
> Group 28: (Blocks 917504-950271) [ITABLE_ZEROED]
> ?Checksum 0x5637, unused inodes 0
> ?Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
> ?Inode table at 917506-918017 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 29: (Blocks 950272-983039) [ITABLE_ZEROED]
> ?Checksum 0x7906, unused inodes 0
> ?Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
> ?Inode table at 950274-950785 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 30: (Blocks 983040-1015807) [ITABLE_ZEROED]
> ?Checksum 0x0855, unused inodes 0
> ?Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
> ?Inode table at 983042-983553 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
> Group 31: (Blocks 1015808-1048575) [ITABLE_ZEROED]
> ?Checksum 0x2764, unused inodes 0
> ?Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
> ?Inode table at 1015810-1016321 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories
>
> dumpe2fs: a.img: error reading bitmaps: Can't read an block bitmap
>
> $ truncate -s 4G a.img
>
> $ e2fsck -f a.img
> e2fsck 1.42-WIP (02-Jul-2011)
> Backing up journal inode block information.
>
> Moving journal from /.journal to hidden inode.
>
> Pass 1: Checking inodes, blocks, and sizes
> Pass 2: Checking directory structure
> Pass 3: Checking directory connectivity
> Pass 4: Checking reference counts
> Pass 5: Checking group summary information
> Block bitmap differences: ?+(262144--262657) +(294912--295490) +(327680--328193) +(360448--360961) +(393216--393729) +(425984--426497) +(458752--459265) +(491520--492033) +(524288--524801) +(557056--557569) +(589824--590337) +(622592--623105) +(655360--655873) +(688128--688641) +(720896--721409) +(753664--754177) +(786432--786945) +(819200--819778) +(851968--852481) +(884736--885314) +(917504--918017) +(950272--950785) +(983040--983553) +(1015808--1016321)
> Fix<y>? yes
>
>
> a.img: ***** FILE SYSTEM WAS MODIFIED *****
> a.img: 20864/262144 files (0.0% non-contiguous), 73060/1048576 blocks
>
> $ dumpe2fs a.img
> dumpe2fs 1.42-WIP (02-Jul-2011)
> Filesystem volume name: ? <none>
> Last mounted on: ? ? ? ? ?/mnt
> Filesystem UUID: ? ? ? ? ?f5a32b70-423d-448a-9550-90d67ff8b247
> Filesystem magic number: ?0xEF53
> Filesystem revision #: ? ?1 (dynamic)
> Filesystem features: ? ? ?has_journal ext_attr resize_inode dir_index filetype 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: ? ? ? ? ? ? ?262144
> Block count: ? ? ? ? ? ? ?1048576
> Reserved block count: ? ? 52419
> Free blocks: ? ? ? ? ? ? ?975516
> Free inodes: ? ? ? ? ? ? ?241280
> First block: ? ? ? ? ? ? ?0
> Block size: ? ? ? ? ? ? ? 4096
> Fragment size: ? ? ? ? ? ?4096
> Reserved GDT blocks: ? ? ?63
> Blocks per group: ? ? ? ? 32768
> Fragments per group: ? ? ?32768
> Inodes per group: ? ? ? ? 8192
> Inode blocks per group: ? 512
> Flex block group size: ? ?32
> Filesystem created: ? ? ? Tue Aug ?2 14:55:16 2011
> Last mount time: ? ? ? ? ?Tue Aug ?2 14:55:24 2011
> Last write time: ? ? ? ? ?Tue Aug ?2 15:33:44 2011
> Mount count: ? ? ? ? ? ? ?0
> Maximum mount count: ? ? ?20
> Last checked: ? ? ? ? ? ? Tue Aug ?2 15:33:44 2011
> Check interval: ? ? ? ? ? 0 (<none>)
> Lifetime writes: ? ? ? ? ?566 kB
> 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: ? ? ?6aa182f8-2ce9-4b90-9138-51b2fcf09ff0
> Journal backup: ? ? ? ? ? inode blocks
> Journal features: ? ? ? ? (none)
> Journal size: ? ? ? ? ? ? 128M
> Journal length: ? ? ? ? ? 32768
> Journal sequence: ? ? ? ? 0x00000001
> Journal start: ? ? ? ? ? ?0
>
>
> Group 0: (Blocks 0-32767) [ITABLE_ZEROED]
> ?Checksum 0x6170, unused inodes 0
> ?Primary superblock at 0, Group descriptors at 1-1
> ?Reserved GDT blocks at 2-64
> ?Block bitmap at 65 (+65), Inode bitmap at 97 (+97)
> ?Inode table at 129-640 (+129)
> ?24746 free blocks, 0 free inodes, 3 directories
> ?Free blocks: 8022-32767
> ?Free inodes:
> Group 1: (Blocks 32768-65535) [ITABLE_ZEROED]
> ?Checksum 0x4df3, unused inodes 0
> ?Backup superblock at 32768, Group descriptors at 32769-32769
> ?Reserved GDT blocks at 32770-32832
> ?Block bitmap at 66 (bg #0 + 66), Inode bitmap at 98 (bg #0 + 98)
> ?Inode table at 641-1152 (bg #0 + 641)
> ?9128 free blocks, 0 free inodes, 975 directories
> ?Free blocks: 49152-57343, 60376-60383, 60512-61439
> ?Free inodes:
> Group 2: (Blocks 65536-98303) [ITABLE_ZEROED]
> ?Checksum 0x7bcd, unused inodes 4077
> ?Block bitmap at 67 (bg #0 + 67), Inode bitmap at 99 (bg #0 + 99)
> ?Inode table at 1153-1664 (bg #0 + 1153)
> ?4096 free blocks, 4077 free inodes, 2302 directories, 4077 unused inodes
> ?Free blocks: 94208-98303
> ?Free inodes: 20500-24576
> Group 3: (Blocks 98304-131071) [ITABLE_ZEROED]
> ?Checksum 0x69b9, unused inodes 7865
> ?Backup superblock at 98304, Group descriptors at 98305-98305
> ?Reserved GDT blocks at 98306-98368
> ?Block bitmap at 68 (bg #0 + 68), Inode bitmap at 100 (bg #0 + 100)
> ?Inode table at 1665-2176 (bg #0 + 1665)
> ?32703 free blocks, 7865 free inodes, 327 directories, 7865 unused inodes
> ?Free blocks: 98369-131071
> ?Free inodes: 24904-32768
> Group 4: (Blocks 131072-163839) [ITABLE_ZEROED]
> ?Checksum 0x12e8, unused inodes 8154
> ?Block bitmap at 69 (bg #0 + 69), Inode bitmap at 101 (bg #0 + 101)
> ?Inode table at 2177-2688 (bg #0 + 2177)
> ?32768 free blocks, 8154 free inodes, 38 directories, 8154 unused inodes
> ?Free blocks: 131072-163839
> ?Free inodes: 32807-40960
> Group 5: (Blocks 163840-196607) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xe3c3, unused inodes 8192
> ?Backup superblock at 163840, Group descriptors at 163841-163841
> ?Reserved GDT blocks at 163842-163904
> ?Block bitmap at 70 (bg #0 + 70), Inode bitmap at 102 (bg #0 + 102)
> ?Inode table at 2689-3200 (bg #0 + 2689)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 163905-196607
> ?Free inodes: 40961-49152
> Group 6: (Blocks 196608-229375) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xaac1, unused inodes 8192
> ?Block bitmap at 71 (bg #0 + 71), Inode bitmap at 103 (bg #0 + 103)
> ?Inode table at 3201-3712 (bg #0 + 3201)
> ?32768 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 196608-229375
> ?Free inodes: 49153-57344
> Group 7: (Blocks 229376-262143) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xa250, unused inodes 8192
> ?Backup superblock at 229376, Group descriptors at 229377-229377
> ?Reserved GDT blocks at 229378-229440
> ?Block bitmap at 72 (bg #0 + 72), Inode bitmap at 104 (bg #0 + 104)
> ?Inode table at 3713-4224 (bg #0 + 3713)
> ?32703 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 229441-262143
> ?Free inodes: 57345-65536
> Group 8: (Blocks 262144-294911) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x8219, unused inodes 8192
> ?Block bitmap at 262144 (+0), Inode bitmap at 262145 (+1)
> ?Inode table at 262146-262657 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 262658-294911
> ?Free inodes: 65537-73728
> Group 9: (Blocks 294912-327679) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xeb76, unused inodes 8192
> ?Backup superblock at 294912, Group descriptors at 294913-294913
> ?Reserved GDT blocks at 294914-294976
> ?Block bitmap at 294977 (+65), Inode bitmap at 294978 (+66)
> ?Inode table at 294979-295490 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 295491-327679
> ?Free inodes: 73729-81920
> Group 10: (Blocks 327680-360447) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xdc7b, unused inodes 8192
> ?Block bitmap at 327680 (+0), Inode bitmap at 327681 (+1)
> ?Inode table at 327682-328193 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 328194-360447
> ?Free inodes: 81921-90112
> Group 11: (Blocks 360448-393215) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xf34a, unused inodes 8192
> ?Block bitmap at 360448 (+0), Inode bitmap at 360449 (+1)
> ?Inode table at 360450-360961 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 360962-393215
> ?Free inodes: 90113-98304
> Group 12: (Blocks 393216-425983) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x3edd, unused inodes 8192
> ?Block bitmap at 393216 (+0), Inode bitmap at 393217 (+1)
> ?Inode table at 393218-393729 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 393730-425983
> ?Free inodes: 98305-106496
> Group 13: (Blocks 425984-458751) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x11ec, unused inodes 8192
> ?Block bitmap at 425984 (+0), Inode bitmap at 425985 (+1)
> ?Inode table at 425986-426497 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 426498-458751
> ?Free inodes: 106497-114688
> Group 14: (Blocks 458752-491519) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x60bf, unused inodes 8192
> ?Block bitmap at 458752 (+0), Inode bitmap at 458753 (+1)
> ?Inode table at 458754-459265 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 459266-491519
> ?Free inodes: 114689-122880
> Group 15: (Blocks 491520-524287) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x4f8e, unused inodes 8192
> ?Block bitmap at 491520 (+0), Inode bitmap at 491521 (+1)
> ?Inode table at 491522-492033 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 492034-524287
> ?Free inodes: 122881-131072
> Group 16: (Blocks 524288-557055) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xc884, unused inodes 8192
> ?Block bitmap at 524288 (+0), Inode bitmap at 524289 (+1)
> ?Inode table at 524290-524801 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 524802-557055
> ?Free inodes: 131073-139264
> Group 17: (Blocks 557056-589823) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xe7b5, unused inodes 8192
> ?Block bitmap at 557056 (+0), Inode bitmap at 557057 (+1)
> ?Inode table at 557058-557569 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 557570-589823
> ?Free inodes: 139265-147456
> Group 18: (Blocks 589824-622591) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x96e6, unused inodes 8192
> ?Block bitmap at 589824 (+0), Inode bitmap at 589825 (+1)
> ?Inode table at 589826-590337 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 590338-622591
> ?Free inodes: 147457-155648
> Group 19: (Blocks 622592-655359) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xb9d7, unused inodes 8192
> ?Block bitmap at 622592 (+0), Inode bitmap at 622593 (+1)
> ?Inode table at 622594-623105 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 623106-655359
> ?Free inodes: 155649-163840
> Group 20: (Blocks 655360-688127) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x7440, unused inodes 8192
> ?Block bitmap at 655360 (+0), Inode bitmap at 655361 (+1)
> ?Inode table at 655362-655873 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 655874-688127
> ?Free inodes: 163841-172032
> Group 21: (Blocks 688128-720895) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x5b71, unused inodes 8192
> ?Block bitmap at 688128 (+0), Inode bitmap at 688129 (+1)
> ?Inode table at 688130-688641 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 688642-720895
> ?Free inodes: 172033-180224
> Group 22: (Blocks 720896-753663) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x2a22, unused inodes 8192
> ?Block bitmap at 720896 (+0), Inode bitmap at 720897 (+1)
> ?Inode table at 720898-721409 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 721410-753663
> ?Free inodes: 180225-188416
> Group 23: (Blocks 753664-786431) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x0513, unused inodes 8192
> ?Block bitmap at 753664 (+0), Inode bitmap at 753665 (+1)
> ?Inode table at 753666-754177 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 754178-786431
> ?Free inodes: 188417-196608
> Group 24: (Blocks 786432-819199) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xf10f, unused inodes 8192
> ?Block bitmap at 786432 (+0), Inode bitmap at 786433 (+1)
> ?Inode table at 786434-786945 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 786946-819199
> ?Free inodes: 196609-204800
> Group 25: (Blocks 819200-851967) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x9860, unused inodes 8192
> ?Backup superblock at 819200, Group descriptors at 819201-819201
> ?Reserved GDT blocks at 819202-819264
> ?Block bitmap at 819265 (+65), Inode bitmap at 819266 (+66)
> ?Inode table at 819267-819778 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 819779-851967
> ?Free inodes: 204801-212992
> Group 26: (Blocks 851968-884735) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xaf6d, unused inodes 8192
> ?Block bitmap at 851968 (+0), Inode bitmap at 851969 (+1)
> ?Inode table at 851970-852481 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 852482-884735
> ?Free inodes: 212993-221184
> Group 27: (Blocks 884736-917503) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0xc602, unused inodes 8192
> ?Backup superblock at 884736, Group descriptors at 884737-884737
> ?Reserved GDT blocks at 884738-884800
> ?Block bitmap at 884801 (+65), Inode bitmap at 884802 (+66)
> ?Inode table at 884803-885314 (+67)
> ?32189 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 885315-917503
> ?Free inodes: 221185-229376
> Group 28: (Blocks 917504-950271) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x4dcb, unused inodes 8192
> ?Block bitmap at 917504 (+0), Inode bitmap at 917505 (+1)
> ?Inode table at 917506-918017 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 918018-950271
> ?Free inodes: 229377-237568
> Group 29: (Blocks 950272-983039) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x62fa, unused inodes 8192
> ?Block bitmap at 950272 (+0), Inode bitmap at 950273 (+1)
> ?Inode table at 950274-950785 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 950786-983039
> ?Free inodes: 237569-245760
> Group 30: (Blocks 983040-1015807) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x13a9, unused inodes 8192
> ?Block bitmap at 983040 (+0), Inode bitmap at 983041 (+1)
> ?Inode table at 983042-983553 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 983554-1015807
> ?Free inodes: 245761-253952
> Group 31: (Blocks 1015808-1048575) [INODE_UNINIT, ITABLE_ZEROED]
> ?Checksum 0x3c98, unused inodes 8192
> ?Block bitmap at 1015808 (+0), Inode bitmap at 1015809 (+1)
> ?Inode table at 1015810-1016321 (+2)
> ?32254 free blocks, 8192 free inodes, 0 directories, 8192 unused inodes
> ?Free blocks: 1016322-1048575
> ?Free inodes: 253953-262144
>
> $ sudo mount -t ext4 -o loop a.img /mnt/
>
> $ df
> Filesystem ? ? ? ? ? 1K-blocks ? ? ?Used Available Use% Mounted on
> /dev/loop0 ? ? ? ? ? ? 4128448 ? ?226384 ? 3692388 ? 6% /mnt
>
> $ sudo umount /mnt
> --------------------------------
> --------------------------------
> --------------------------------
>

2011-08-02 16:07:20

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

Amir

> > But after extending to 4G, e2fsck makes some complain.
> > I guess this is not expected behaviour, is it?
> >
>
> it is expected when you use the current resize2fs,
> which does not respect the flex_bg layout, so new group block bitmaps
> are allocated beyond the 1G border and initialized.

So that means I have thrown away some important part of
the filesystem when I did truncate -s 1G, isn't it?
Will things go wrong if I flash this 1G image to my eMMC
partition (without using Yongqiang's new 64bit resize patches)?
I need to understand whether Yongqiang's patch is absolutely
necessary for this purpose or just a good thing to have.

> if you use Yongqiang's new 64bit resize patches, the final fsck won't complain.
> unfortunately for you, those patches have not been merged to the kernel yet,
> so you will have to either build your own ext4 module or wait at least until
> kernel 3.2 is released to have it in mainline.

As said above.

> It is actually quite simple to fix the 1G image, so it will pass fsck
> after truncate -s 4G.
> All it takes it setting the BLOCK_UNINIT flag in groups 8-31
> this should be possible to do with debugfs (or write a small tool to do it).
> if I have time, it will try it myself and post the instructions.

OK, thanks in advance.

Best Regards
Round

2011-08-02 16:58:05

by Theodore Ts'o

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Wed, Aug 03, 2011 at 01:07:08AM +0900, Round Robinjp wrote:
> So that means I have thrown away some important part of
> the filesystem when I did truncate -s 1G, isn't it?
> Will things go wrong if I flash this 1G image to my eMMC
> partition (without using Yongqiang's new 64bit resize patches)?
> I need to understand whether Yongqiang's patch is absolutely
> necessary for this purpose or just a good thing to have.

This is one of the reasons why I originally suggested using zero_free
and make_sparse to write the file system image. It's a much, much,
MUCH simpler way of handling things, and it doesn't require resizing
the file system image, using truncate (and making sure you truncate to
the right size, etc.).

With the method Amir talked about, it matters whether or not the file
system is mounted when you use resize2fs, whether you have the latest
resize patches, etc., etc.

- Ted


2011-08-02 17:44:19

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Aug 2, 2011 at 7:07 PM, Round Robinjp <[email protected]> wrote:
> Amir
>
>> > But after extending to 4G, e2fsck makes some complain.
>> > I guess this is not expected behaviour, is it?
>> >
>>
>> it is expected when you use the current resize2fs,
>> which does not respect the flex_bg layout, so new group block bitmaps
>> are allocated beyond the 1G border and initialized.
>
> So that means I have thrown away some important part of
> the filesystem when I did truncate -s 1G, isn't it?

It's not "so important" because it contains information that can be
recovered, so fsck -fp can easily fix that.
Do you have e2fsck on your embedded system?
Can you run it on first boot?

> Will things go wrong if I flash this 1G image to my eMMC
> partition (without using Yongqiang's new 64bit resize patches)?

I think the kernel will shout at you, mark the fs with error_fs flag
and recommend that you run fsck.
This will happen when you write files to the extended 3G.

> I need to understand whether Yongqiang's patch is absolutely
> necessary for this purpose or just a good thing to have.

if you don't use it, you need to use the other method I mentioned using debugfs
or run fsck on the MMC after you flashed the short image.

>
>> if you use Yongqiang's new 64bit resize patches, the final fsck won't complain.
>> unfortunately for you, those patches have not been merged to the kernel yet,
>> so you will have to either build your own ext4 module or wait at least until
>> kernel 3.2 is released to have it in mainline.
>
> As said above.
>
>> It is actually quite simple to fix the 1G image, so it will pass fsck
>> after truncate -s 4G.
>> All it takes it setting the BLOCK_UNINIT flag in groups 8-31
>> this should be possible to do with debugfs (or write a small tool to do it).
>> if I have time, it will try it myself and post the instructions.
>
> OK, thanks in advance.
>
> Best Regards
> Round
>

2011-08-02 17:52:58

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Aug 2, 2011 at 7:57 PM, Ted Ts'o <[email protected]> wrote:
> On Wed, Aug 03, 2011 at 01:07:08AM +0900, Round Robinjp wrote:
>> So that means I have thrown away some important part of
>> the filesystem when I did truncate -s 1G, isn't it?
>> Will things go wrong if I flash this 1G image to my eMMC
>> partition (without using Yongqiang's new 64bit resize patches)?
>> I need to understand whether Yongqiang's patch is absolutely
>> necessary for this purpose or just a good thing to have.
>
> This is one of the reasons why I originally suggested using zero_free
> and make_sparse to write the file system image. ?It's a much, much,
> MUCH simpler way of handling things, and it doesn't require resizing
> the file system image, using truncate (and making sure you truncate to
> the right size, etc.).
>
> With the method Amir talked about, it matters whether or not the file
> system is mounted when you use resize2fs, whether you have the latest
> resize patches, etc., etc.
>

I think it is fair to say that with if there are no constrains on the methods
used throughout the process, the zero_free + make_sparse is MUCH simpler.

However, my method is targeting an a-symmetric environment, where the
person or organization responsible for generating the stock image
have unlimited
resources and knowledge, while the person or organization responsible for
burning that image to hundreds of devices are less capable or bound to using old
legacy systems, who just know how to burn an image of size N.

Maybe Round can share more about the constrains of his environment.

Amir.

2011-08-03 08:40:10

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

On Tue, Aug 2, 2011 at 7:07 PM, Round Robinjp <[email protected]> wrote:
> Amir
>
>> > But after extending to 4G, e2fsck makes some complain.
>> > I guess this is not expected behaviour, is it?
>> >
>>
>> it is expected when you use the current resize2fs,
>> which does not respect the flex_bg layout, so new group block bitmaps
>> are allocated beyond the 1G border and initialized.
>
> So that means I have thrown away some important part of
> the filesystem when I did truncate -s 1G, isn't it?
> Will things go wrong if I flash this 1G image to my eMMC
> partition (without using Yongqiang's new 64bit resize patches)?
> I need to understand whether Yongqiang's patch is absolutely
> necessary for this purpose or just a good thing to have.
>
>> if you use Yongqiang's new 64bit resize patches, the final fsck won't complain.
>> unfortunately for you, those patches have not been merged to the kernel yet,
>> so you will have to either build your own ext4 module or wait at least until
>> kernel 3.2 is released to have it in mainline.
>
> As said above.
>
>> It is actually quite simple to fix the 1G image, so it will pass fsck
>> after truncate -s 4G.
>> All it takes it setting the BLOCK_UNINIT flag in groups 8-31
>> this should be possible to do with debugfs (or write a small tool to do it).
>> if I have time, it will try it myself and post the instructions.
>
> OK, thanks in advance.
>

You are welcome ;-)
https://raw.github.com/amir73il/e2fsprogs-snapshots/next4-stable/contrib/uninit_bg.c


so after resize2fs to 4G, you need to umount the image and run:

amir@qalab:~$ gcc -o uninit_bg -lext2fs uninit_bg.c
amir@qalab:~$ uninit_bg -f a.img 8
uninit_bg: uninitializing filesystem a.img groups [8..31]
uninit_bg: found 514 used blocks in group 8!
uninit_bg: found super block backup in group 9!
uninit_bg: found 579 used blocks in group 9!
uninit_bg: found 514 used blocks in group 10!
uninit_bg: found 514 used blocks in group 11!
uninit_bg: found 514 used blocks in group 12!
uninit_bg: found 514 used blocks in group 13!
uninit_bg: found 514 used blocks in group 14!
uninit_bg: found 514 used blocks in group 15!
uninit_bg: found 514 used blocks in group 16!
uninit_bg: found 514 used blocks in group 17!
uninit_bg: found 514 used blocks in group 18!
uninit_bg: found 514 used blocks in group 19!
uninit_bg: found 514 used blocks in group 20!
uninit_bg: found 514 used blocks in group 21!
uninit_bg: found 514 used blocks in group 22!
uninit_bg: found 514 used blocks in group 23!
uninit_bg: found 514 used blocks in group 24!
uninit_bg: found super block backup in group 25!
uninit_bg: found 579 used blocks in group 25!
uninit_bg: found 514 used blocks in group 26!
uninit_bg: found super block backup in group 27!
uninit_bg: found 579 used blocks in group 27!
uninit_bg: found 514 used blocks in group 28!
uninit_bg: found 514 used blocks in group 29!
uninit_bg: found 514 used blocks in group 30!
uninit_bg: found 514 used blocks in group 31!

now you have an fs you can truncate to 1G.
fsck will complain about one small thing.
the complian is not relevant for your use case,
because you don't intent to resize that fs again
and the last group is full if you are using round size like 4G.

amir@qalab:~$ truncate -s 1G a.img
amir@qalab:~$ truncate -s 4G a.img
amir@qalab:~$ e2fsck -nf a.img
e2fsck 1.41.14 (22-Dec-2010)
Last group block bitmap uninitialized. Fix? no

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
a.img: 2204/262144 files (0.3% non-contiguous), 86720/1048576 blocks



Amir.

2011-08-03 15:15:43

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

> This is one of the reasons why I originally suggested using zero_free
> and make_sparse to write the file system image. It's a much, much,
> MUCH simpler way of handling things, and it doesn't require resizing
> the file system image, using truncate (and making sure you truncate to
> the right size, etc.).
>
> With the method Amir talked about, it matters whether or not the file
> system is mounted when you use resize2fs, whether you have the latest
> resize patches, etc., etc.

I am glad that I have several options in my list, and in fact
I have not yet excluded any of them. All methods have pros
and cons and I am trying to understand them.

In our environment, it is acceptable to do complicated things
at the stage of creating image. But it is strongly undesirable
to do any post processing at the time of mass production.
Although it is not impossible to add post processing, the problem
is it will require extra booting of each device at the factory.

Had it not been the case, the
"resize2fs -M a.img" + "resize2fs on the device"
would have been the ideal solution.

The reason I am trying Amir's method first is that it "may"
give me a zero-post-processing way. Also it does not require
our legacy mass production flash writer to be changed.

zero_free way is indeed simpler and does not require post
processing. The only problem is that we need to change to
a flash writer which supports writing from a sparse file.

Many thanks for taking interest.
Round

2011-08-09 16:05:36

by Round Robinjp

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

Amir

> https://raw.github.com/amir73il/e2fsprogs-snapshots/next4-stable/contrib/uninit_bg.c
>
> amir@qalab:~$ gcc -o uninit_bg -lext2fs uninit_bg.c

For me, it gives error:

$ gcc -o uninit_bg -lext2fs uninit_bg.c
uninit_bg.c: In function ‘main’:
uninit_bg.c:105:2: error: invalid use of undefined type ‘struct opaque_ext2_group_desc’
uninit_bg.c:105:5: warning: assignment from incompatible pointer type
$

I have the latest source code from
git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
but nowhere I can find the full declaration of
struct opaque_ext2_group_desc.

Am I missing something?
I didn't want to bother you for this, but I could not
solve the puzzle.

Thanks
Round

2011-08-09 19:55:18

by Amir Goldstein

[permalink] [raw]
Subject: Re: flashing large eMMC partitions with ext4

2011/8/9 Round Robinjp <[email protected]>:
> Amir
>
>> https://raw.github.com/amir73il/e2fsprogs-snapshots/next4-stable/contrib/uninit_bg.c
>>
>> amir@qalab:~$ gcc -o uninit_bg -lext2fs uninit_bg.c
>
> For me, it gives error:
>
> $ gcc -o uninit_bg -lext2fs uninit_bg.c
> uninit_bg.c: In function ?main?:
> uninit_bg.c:105:2: error: invalid use of undefined type ?struct opaque_ext2_group_desc?
> uninit_bg.c:105:5: warning: assignment from incompatible pointer type
> $
>
> I have the latest source code from
> git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
> but nowhere I can find the full declaration of
> struct opaque_ext2_group_desc.
>
> Am I missing something?

I did not build this tool with latest e2fsprogs lib, I built it with
stable version 1.41.14
which comes installed with my Ubuntu distro.
Basically, you don't need to download and build any sources, but since
you have built
e2fsprogs from git already you may as well checkout tag v1.41.14,
configure build and install it.
hope this helps.

> I didn't want to bother you for this, but I could not
> solve the puzzle.
>
> Thanks
> Round
>