ext2 mounted as vfat

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 3 14:36:46 UTC 2010


On Wed, Sep 1, 2010 at 3:59 PM, Sergey Naumov <sknaumov at gmail.com> wrote:
> I have an issue with busybox-1.16.0 (from buildroot-2010.02) with mount.

Zeroth subversion is always a bit buggy.
Update to the latest 1.16.x, 1.16.2, is in order.

> I had partitioned a flash and set up fat 16 and fat 32 filesystems
> there. Then I decided to change them to ext2 (flash geometry remained
> the same). When I mount them with standard mount utility on host
> (Debian 5.0.0 lenny), everything is OK, but at embedded system
> busybox's mount tries to mount them as VFAT and MOUNTS !!! them (but
> of course without any files on them).

mkFOOfs utilities generally do not erase all data on the partition/file,
they only write out skeleton data structure of the new fs.

It's a good idea to dd if=/dev/zero of=/dev/blockdev bs=1M count=1
before mkfs'ing a non-fresh /dev/blockdev. If you worry that
some especially nasty filesystems/LVMs leave signatures _at the end_,
erase the tail too. If the blockdev isn't too big, just zero it out completely.

> I thought that it could be
> because ext2 skips first 512? or 1024? bytes from the beginning of the
> partition, so there is a space for the file allocation table.

busybox-1.16.0/util-linux/mkfs_ext2.c:

        // zero boot sectors
        memset(buf, 0, blocksize);
        PUT(0, buf, 1024); // N.B. 1024 <= blocksize, so buf[0..1023]
contains zeros

> But even
> when I made dd if=/dev/zero for first 32768 bytes of partitions
> (before execution of mkfs.ext2), busybox mounted them as VFAT. Then I
> changed the flash's geometry, and busybox tried to mount them as VFAT
> again, but now without success. I have tried to force -t ext2, but
> without any success.

> Only after I had formatted partitions with
> Busybox's mkfs.ext2 applet I mounted these partitions on embedded
> system successfully.

This last part is confusing. *Which* mkfs.ext2 works and which does not?
Because it sounds like you are reporting that _non_-busybox mkfs.ext2 is buggy.

-- 
vda


More information about the busybox mailing list