problem mounting from flash [Invalid sectorsize] [g_vfs_done() ?error=22]

Bruce Evans brde at optusnet.com.au
Tue Nov 9 14:16:39 UTC 2010


On Tue, 9 Nov 2010, Oliver Fromme wrote:

> Bruce Evans wrote:
> > On Mon, 8 Nov 2010, Oliver Fromme wrote:
> > > Monthadar Al Jaberi <monthadar at gmail.com> wrote:
> > > > [...]
> > > > mount: /dev/redboot/fs Invalid sectorsize 65536 for superblock size
> > > > 8192: Invalid argument
> > > >
> > > > So I guessed it has todo with the flash configured in 64k sectors
> > > > according to the boot output.
> > > > ...
> > > > mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
> > > > mx25l0: mx25ll128, sector 65536 bytes, 256 sectors
> > > > ...
> > >
> > > Historically UFS/FFS supports only 512 bytes per sector.
> > > I think it was patched at some point in the past to support
> > > 2048 bytes per sector, too, which is used by some MOD media
> > > and DVD-RAM.  I'm pretty sure it does _not_ support 65536
> > > bytes per sector (someone please correct me if I'm wrong).
> >
> > Maybe 25 years ago, but in Net2/ 20 years ago ffs doesn't really
> > even use sectors.  It just has a buggy superblock probe which
> > prevents it determining its correct i/o size when that size
> > exceeds SBLOCKSIZE = 8192.
>
> In the second half of the 90s it did *not* support the
> 2048-byte sectors of the larger MOD media that became
> popular at that time.  I owned several of those drives
> (still have one of them), so I remember it quite well.
> FreeBSD's file system code needed some patches in order
> to be able to use those disks.  Before that, only 512-
> byte sectors worked.

That's strange, since in the initial slice code in 1994 or 1995, I
emulated 4K-sectors in uncommitted patches in the floppy driver and
thought I tested ffs with them.

> I don't know what sector sizes are supported today, but
> I wouldn't be surprised if only 512 to 2048 works out
> of the box.  I'm not aware of any widely used media
> that has sectors smaller than 512 or larger than 2048.
> (Those new 4k drives translate accesses to/from 512 byte
> sectors, so it looks like a 512-byte sector drive.)

I have a DVD drive that only supports writing 32K-blocks on DVD-R.  In
2005 I gave up trying to get ffs to work on this.  The drive supports
reading the usual 2K-blocks, so the ffs probe worked, and the ffs block
size just needed to be set to 32K or 64K so that writes worked too.
But this block size wastes a lot of space and time for small files.
FreeBSD's buffering is bad for read-mostly media, and I never found
any file system that works well for small files on DVDs or CDROMs
(images that can be written in 10 minutes take more like 10 hours
to read back if they contain a few hundred thousand small files).

mdconfig allows any representable sector size except 0 and possibly non-
power-of-2 ones (mdconfig(8) uses strtoul() with null error handling;
md(4) checks for a power of 2 in the malloc-backed case but has null
arg checking in other cases (if other cases are reached now -- this
feature used to be limited to the malloc-backed case)).  Power of 2
sizes that cannot work because they exceed MAXBSIZE can certainly be
configured.

Bruce


More information about the freebsd-fs mailing list