UFS UFS created on AMD64 not found by ARM?

Hi!

This is my first post so tell me off if I'm doing it wrong. I'm a FreeBSD newbie but eager to learn.

I have a Raspberry-Pi which I have working fine with the FreeBSD-10.1-RELEASE-arm-armv6-RPI-B.img from the FTP. My problem is attaching storage in the form of an external USB drive. I can't get a properly formatted drive to show up.

Following 18.2. Adding Disks in the handbook I tried partitioning and formatting the drive directly on the Pi, I get:
Code:
root@raspberry-pi:/ # gpart create -s GPT da0
gpart: scheme 'GPT': Invalid argument

I can use MBR as my partitioning scheme but then I still can't create a freebsd-ufs partition.

Code:
root@raspberry-pi:/ # gpart create -s mbr da0
da0 created
root@raspberry-pi:/ # gpart add -t freebsd-ufs da0
gpart: Invalid argument

So perhaps gpart(8) on ARM doesn't work as I expect, fine. I create a FreeBSD VM in Virtualbox on my Mac, pass through the USB disk to it and successfully follow the steps in 18.2 to newfs -U /dev/da0p1 doing ls /dev in the VM showed da0p1 had been created. Great, I shutdown the VM and pop the USB drive into the Pi and reboot. But the Pi does not show the UFS partition I just created, it only lists /dev/da0, there is no /dev/da0p1, even though it showed up fine in the VM. Is UFS different between ARM and x86 versions of FreeBSD?

I have also tried formatting the drive as FAT32 on my Mac and then moving it to the Pi but that didn't seem to support proper permissions so I would much rather use UFS or another properly supported file system.

Any tips on how I can move forward on getting a USB hard drive working on FreeBSD ARM on my raspberry pi? Can I get gpart(8) working as expected on ARM? Or should I format the drive in some other way on another machine than the pi?

I'm grateful for any help on this, I'd really like to move to FreeBSD on all my boxes and having to put Raspbian on this one would be a bit of a failure :(

Here is my dmesg output. The disk I want is umass0/da0.
Code:
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.1-RELEASE #0 r274401: Wed Nov 12 04:42:19 UTC 2014
    root@releng1.nyi.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B arm
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
VT: init without driver.
CPU: ARM1176JZ-S rev 7 (ARM11J core)
Supported features: ARM_ISA THUMB2 JAZELLE ARMv4 Security_Ext
WB enabled LABT branch prediction enabled
  16KB/32B 4-way instruction cache
  16KB/32B 4-way write-back-locking-C data cache
real memory  = 268431360 (255 MB)
avail memory = 220422144 (210 MB)
random: <Software, Yarrow> initialized
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> mem 0x20000000-0x20ffffff on ofwbus0
intc0: <BCM2835 Interrupt Controller> mem 0xb200-0xb3ff on simplebus0
systimer0: <BCM2835 System Timer> mem 0x3000-0x3fff irq 8,9,10,11 onsimplebus0
Event timer "BCM2835 Event Timer 3" frequency 1000000 Hz quality 1000
Timecounter "BCM2835 Timecounter" frequency 1000000 Hz quality 1000
bcmwd0: <BCM2708/2835 Watchdog> mem 0x10001c-0x100027 on simplebus0
gpio0: <BCM2708/2835 GPIO controller> mem 0x200000-0x2000af irq 57,59,58,60 on simplebus0
gpio0: read-only pins: 46,47,48,49,50,51,52,53.
gpio0: reserved pins: 48,49,50,51,52,53.
gpioc0: <GPIO controller> on gpio0
gpiobus0: <OFW GPIO bus> on gpio0
gpioled0: <GPIO led> at pin(s) 16 on gpiobus0
iichb0: <BCM2708/2835 BSC controller> mem 0x205000-0x20501f irq 61 on simplebus0
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
iichb1: <BCM2708/2835 BSC controller> mem 0x804000-0x80401f irq 61 on simplebus0
iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
spi0: <BCM2708/2835 SPI controller> mem 0x204000-0x20401f irq 62 on simplebus0
spibus0: <OFW SPI bus> on spi0
bcm_dma0: <BCM2835 DMA Controller> mem 0x7000-0x7fff,0xe05000-0xe05fff irq 24,25,26,27,28,29,30,31,32,33,34,35,36 on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0xb880-0xb8bf irq 1 on simplebus0
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x300000-0x3000ff irq 70 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
uart0: <PrimeCell UART (PL011)> mem 0x201000-0x201fff irq 65 on simplebus0
uart0: console (115200,n,8,1)
dwcotg0: <DWC OTG 2.0 integrated USB controller> mem 0x980000-0x99ffff irq 17 on simplebus0
usbus0 on dwcotg0
fb0: <BCM2835 VT framebuffer driver> on ofwbus0
simplebus1: <Flattened device tree simple bus> on ofwbus0
simplebus1: could not get ranges
device_attach: simplebus1 attach returned 6
Timecounters tick every 10.000 msec
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <DWCOTG> at usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub0: 1 port with 1 removable, self powered
mmcsd0: 8GB <SDHC SD08G 3.0 SN 6D2010EA MFG 06/2012 by 39 PH> at mmc0 25.0MHz/4bit/65535-block
fb0: 1024x768(0x0@0,0) 16bpp
fb0: pitch 2048, base 0x4e006000, screen_size 1572864
fbd0 on fb0
VT: initialize with new VT driver "fb".
random: unblocking device.
Root mount waiting for: usbus0
ugen0.2: <vendor 0x0424> at usbus0
uhub1: <vendor 0x0424 product 0x9512, class 9/0, rev 2.00/2.00, addr 2> on usbus0
uhub1: MTT enabled
Root mount waiting for: usbus0
uhub1: 3 ports with 2 removable, self powered
ugen0.3: <vendor 0x0424> at usbus0
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus0
smsc0: chip 0xec00, rev. 0002
miibus0: <MII bus> on smsc0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on smsc0
ue0: Ethernet address: b8:27:eb:91:ea:77
Root mount waiting for: usbus0
ugen0.4: <vendor 0x1a40> at usbus0
uhub2: <vendor 0x1a40 USB 2.0 Hub MTT, class 9/0, rev 2.00/1.00, addr 4> on usbus0
uhub2: MTT enabled
Root mount waiting for: usbus0
uhub2: 7 ports with 7 removable, self powered
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.5: <Seagate> at usbus0
umass0: <Seagate Expansion, class 0/0, rev 2.10/1.00, addr 5> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0100
umass0:0:0:-1: Attached to scbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <Seagate Expansion 0608> Fixed Direct Access SCSI-6 device
da0: Serial Number NA45JQ4Y
da0: 40.000MB/s transfers
da0: 476940MB (976773167 512 byte sectors: 255H 63S/T 60801C)
da0: quirks=0x2<NO_6_BYTE>
ugen0.6: <Dell> at usbus0
ukbd0: <Dell Dell USB Keyboard, class 0/0, rev 1.10/3.06, addr 6> on usbus0
kbd1 at ukbd0
Trying to mount root from ufs:/dev/mmcsd0s2a [rw,noatime]...
warning: no time-of-day clock registered, system time will not be set accurately
smsc0: chip 0xec00, rev. 0002
 
Your ARM Kernel probably lacks support for the GPT schema. IIRC it can be loaded as kernel module.

I found a GPT module in /boot/kernel/ called geom_part_gpt.ko which I loaded and then it could partition and format the drive!

Code:
root@raspberry-pi:/usr/home/efx # kldstat
Id Refs Address    Size     Name
1    1 0xc0100000 6d81c4   kernel
root@raspberry-pi:/usr/home/efx # kldload geom_part_gpt
root@raspberry-pi:/usr/home/efx # kldstat
Id Refs Address    Size     Name
1    4 0xc0100000 6d81c4   kernel
2    1 0xc1d8b000 d000     geom_part_gpt.ko
root@raspberry-pi:/usr/home/efx # gpart create -s GPT da0
da0 created
root@raspberry-pi:/usr/home/efx # gpart add -t freebsd-ufs da0
da0p1 added

Thank you so much! I got it working and I learned something.
 
Hi!
I can use MBR as my partitioning scheme but then I still can't create a freebsd-ufs partition.

Code:
root@raspberry-pi:/ # gpart create -s mbr da0
da0 created
root@raspberry-pi:/ # gpart add -t freebsd-ufs da0
gpart: Invalid argument

I realise you fixed the problem with using GPT, but the reason why the above didn't work is because you created an MBR partition table on the device, but didn't create an MBR partition to contain a nested BSD partition table and partition. It should have been as follows:

Code:
# gpart create -s mbr da0
da0 created
# gpart add -t freebsd da0
da0s1 added

# gpart create -s bsd da0s1
da0s1 created
# gpart add -t freebsd-ufs da0s1
da0s1a added

For the MBR scheme, you needed a partition (or slice) of type 'freebsd'. Then inside that slice you create your BSD partition of type 'freebsd-ufs'.
 
Back
Top