From owner-freebsd-fs@FreeBSD.ORG Mon Nov 8 17:49:07 2010 Return-Path: Delivered-To: freebsd-fs@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 803A71065675 for ; Mon, 8 Nov 2010 17:49:07 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id EF7368FC1D for ; Mon, 8 Nov 2010 17:49:06 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id oA8Hmnsq085404; Mon, 8 Nov 2010 18:49:04 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id oA8HmnLS085403; Mon, 8 Nov 2010 18:48:49 +0100 (CET) (envelope-from olli) Date: Mon, 8 Nov 2010 18:48:49 +0100 (CET) Message-Id: <201011081748.oA8HmnLS085403@lurza.secnetix.de> From: Oliver Fromme To: freebsd-fs@FreeBSD.ORG, monthadar@gmail.com In-Reply-To: X-Newsgroups: list.freebsd-fs User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.5 (lurza.secnetix.de [127.0.0.1]); Mon, 08 Nov 2010 18:49:05 +0100 (CET) Cc: Subject: Re: problem mounting from flash [Invalid sectorsize] [g_vfs_done() ?error=22] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-fs@FreeBSD.ORG, monthadar@gmail.com List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 17:49:07 -0000 Monthadar Al Jaberi wrote: > I dont know if I am asking on the wrong place. But it has todo with > filesystem and onboard flash (16MB) on a RouterStation Pro board. > > I am running a FreeBSD Current 201010, with the kernel configuration > file specified in /usr/src/sys/mips/conf/AR71XX with device > geom_redboot. > > but I get this error when I try to mount from flash: > mount /dev/redboot/fs /var/fs > 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: 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). > So I just tried to change SBLOCKSIZE from 8129 to 65536 in > /usr/src/sys/ufs/ffs/fs.h, but then I got this error: That won't work. The media sector size is a hard limit; the driver will refuse to read or write anything that is not aligned to the media sector size. Changing the size of the super block (SBLOCKSIZE) won't help much. > mount /dev/redboot/fs /mnt/fs > g_vfs_done():redboot/fs[READ(offset=8192, length=65536)]error = 22 > mount: /dev/redboot/fs : Invalid argument The UFS code tries to read the super block at offset 8192, which is not aligned correctly (it's not a multiple of the sector size). I think UFS is not the right file system to put on a flash media that has 256 sectors of 65536 bytes. In theory you could insert a translation layer that converts 512-byte access to 65536-byte access (requiring a read-modify-write operation when writing). Maybe gnop(8) can do this, it has a sector size option, but I haven't tried it. Anyway, that would be extremely inefficient. Another possibility is to create a memory device with mdconfig(8) and use "dd bs=65536" to copy the contents of the flash device to the memory disk, then you can mount the memory disk. When you need to write any modifications back to the flash device, you have to umount the memory disk and use dd again (with if= an of= reversed, of course). Make sure that the size of the memory disk is a multiple of 65536, too. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "Documentation is like sex; when it's good, it's very, very good, and when it's bad, it's better than nothing." -- Dick Brandon