System crash during mke2fs

Theodore Tso tytso at
Fri Oct 24 10:54:40 UTC 2008

On Fri, Oct 24, 2008 at 03:16:30AM +0200, Carlo Wood wrote:
> Hiya, don't know where else to report this. Please
> correct me if this isn't the right place.
> I just ran into a serious bug :((
> We were trying to create a virtual filesystem
> in an image (file) of around 238 GB.  [Using double losetup configuration]
> Here the machine completely halted/crashed. I don't know what
> happened, because it's a remote machine.
> The writing of the inode table started very fast, but it was
> already slowing down the last few - and completely stopped
> at 306, which was 12 minutes ago (my ssh connection to the
> machine still didn't time out, weird enough). 

That's a classic case of mke2fs tickling a VM bug.  The VM should be
able to do proper write throttling, but mke2fs writes a blocks very
quickly, and so it's a great test of the kernel virtual memory
subsystem.  :-) So the fact that your system hung is a kernel bug,
probably caued by the double /dev/loop configuration.  What version of
the kernel are you using?

There is a workaround that might help: "export MKE2FS_SYNC=10".  This
will force an explicit sync system call every 10 blockgroups, which
tends to work around the kernel VM bug.  It's not the default mainly
because mke2fs is such a great kernel test tool, and the VM really
needs to be able to handle this case.

> Note that mke2fs says: 29097984 inodes, 58195960 blocks
> That is 58195960 * 4096 = 238370652160 the full size of
> the image file?!?
> This partition is only 200MB though!

That's because you created /dev/loop1 as a loop device with an offset
of 512*63 bytes from the beginning of /dev/loop0.  There is no way to
set the maximum size of a loop device (it's not something which is
currently defined as part of the interface of the LOOP_SET_STATUS
ioctl.  If you want to do things manually like this, you'll need to
explicitly specify the size of the desired filesystem to mke2fs; it's
a shortcoming in the loop device.

The other way to do things would be to create an image file of the
desired partition length, and then assemble it by hand afterwards;
sorry, the loop device wasn't designed to be used to emulate a
partitioned disk.  It could be, but kernel patches would be required
to extend its functionality.


							- Ted

More information about the Ext3-users mailing list