From owner-freebsd-arm@FreeBSD.ORG Mon Oct 10 08:06:34 2011 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E6CD106566B for ; Mon, 10 Oct 2011 08:06:34 +0000 (UTC) (envelope-from mrossi@swin.edu.au) Received: from outbound.icp-osb-irony-out8.iinet.net.au (outbound.icp-osb-irony-out8.iinet.net.au [203.59.1.134]) by mx1.freebsd.org (Postfix) with ESMTP id 1BFFA8FC08 for ; Mon, 10 Oct 2011 08:06:33 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqMBAMWmkk7KoR+Q/2dsb2JhbAAMN6YUhFwBAQEBAzhAEQsNCwkWDwkDAgECAUUTCAEBtSeJAodDBJN3hUmMHQ X-IronPort-AV: E=Sophos;i="4.68,516,1312128000"; d="scan'208";a="157982429" Received: from unknown (HELO [192.168.15.65]) ([202.161.31.144]) by outbound.icp-osb-irony-out8.iinet.net.au with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 10 Oct 2011 16:06:31 +0800 Message-ID: <4E92A78C.7040503@swin.edu.au> Date: Mon, 10 Oct 2011 19:06:36 +1100 From: Mattia Rossi Organization: Swinburne University of Technology User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: freebsd-arm@freebsd.org References: <4E9290FF.7090306@swin.edu.au> In-Reply-To: <4E9290FF.7090306@swin.edu.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Create FAT partition/filesystem on the internal microSD flash of the Dreamplug X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: mrossi@swin.edu.au List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2011 08:06:34 -0000 On 10/10/11 17:30, Mattia Rossi wrote: > Hi all again, > > I've now been on to this for quite a while, but just can't get it to work. > I've mistakenly blown away the partitioning scheme that the dreamplug > came with originally, therefore also the FAT boot partition. > > I've tried to recreate it using gpart and newfs_msdos, but can't create > any new FAT partition that mount_msdosfs would mount. > > See: > > dreamplug# gpart create -s mbr da0 > da0 created > dreamplug# gpart add -t fat32 -i 1 -s 32M da0 > da0s1 added > dreamplug# newfs_msdos da0s1 > /dev/da0s1: 65416 sectors in 8177 FAT16 clusters (4096 bytes/cluster) > BytesPerSec=512 SecPerClust=8 ResSectors=1 FATs=2 RootDirEnts=512 > Sectors=65520 Media=0xf0 FATsecs=32 SecPerTrack=63 Heads=255 HiddenSecs=0 > dreamplug# mount_msdosfs /dev/da0s1 /mnt/usb > mount_msdosfs: /dev/da0s1: Invalid argument > > I've tried to change the partition type to 6 and 4 and to freebsd (165), > but didn't help. > I also tried to set the start of the partition (-b) to 64, 128 and 192 > but nothing there either. > > Trying to tune newfs_msdos to use FAT 12 or FAT 32 and different > bytes/sec or a different mediatype (0xf8) and a variety of tweaks did > not help either. > > It seems that I can't create a mountable FAT partition. > > I believe the problem is that gpart create -s mbr starts the > partitioning scheme at an offset of 63 sectors, while the one on the > external SD card I have (pre-partitioned not using FreeBSD) has an > offset of 32 sectors. > > I couldn't find any documentation that tells me how to tell gpart create > to use a different offset. > > Any hints? > I think something is wrong with newfs_msdos. Might be an issue with FreeBSD-9. I'm using: FreeBSD dreamplug 9.0-BETA3 FreeBSD 9.0-BETA3 #22 r226165 I tried the following: I partitioned the external SD card using gpart, then took the card out and put it in my laptop running Linux. There I formatted it using mkfs.vfat with no options (the card could be mounted properly), and put the card back into the dreamplug which I rebooted before, to make sure that no USB weirdness gets into my way. Then I mounted the card and it worked! dreamplug# mount_msdosfs /dev/da1s1 /mnt/sd/ dreamplug# umount /mnt/sd So I checked the format options: dreamplug# newfs_msdos -N /dev/da1s1 /dev/da1s1: 1994688 sectors in 62334 FAT16 clusters (16384 bytes/cluster) BytesPerSec=512 SecPerClust=32 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FA Tsecs=244 SecPerTrack=32 Heads=64 HiddenSecs=0 HugeSectors=1995232 Then I reformatted the card using newfs_msdos with the -F16 options to make sure it uses FAT16 as above: dreamplug# newfs_msdos -F16 /dev/da1s1 /dev/da1s1: 1994688 sectors in 62334 FAT16 clusters (16384 bytes/cluster) BytesPerSec=512 SecPerClust=32 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FA Tsecs=244 SecPerTrack=32 Heads=64 HiddenSecs=0 HugeSectors=1995232 You'll see exactly the same options.. Then I tried to mount the card again... dreamplug# mount_msdosfs /dev/da1s1 /mnt/sd/ mount_msdosfs: /dev/da1s1: Invalid argument So seriously WTF? Mat