# Portable USB drive works in Windows, not in FreeBSD



## Maxamoto (Nov 9, 2012)

Howdy,

I'm hoping there is a quick fix for this issue. Like the title says, I have a portable 500GB USB drive formatted NTFS (From within Win7, I think) in a generic case I use for backups and sneaker-net between multiple machines and operating systems. It's been tested, and is known to work, on many desktops and laptops, except -you guessed it- my FreeBSD laptop. I'm hoping that I've just missed something really, really simple. Here's the pertinent info:

The wondrous dmesg:


```
ugen6.2: <Super Top> at usbus6
umass0: <Super Top USB 2.0  SATA BRIDGE, class 0/0, rev 2.00/2.00, addr 2> on usbus6
umass0:  SCSI over Bulk-Only; quirks = 0x4100
umass0:3:0:-1: Attached to scbus3
da0 at umass-sim0 bus 0 scbus3 target 0 lun 0
da0: <WDC WD50 00BEVT-11ZAT0 \\0000\\0000> Fixed Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: 476940MB (976773167 512 byte sectors: 255H 63S/T 60801C)
GEOM: da0: corrupt or invalid GPT detected.
GEOM: da0: GPT rejected -- may not be recoverable.
```

The almighty diskinfo:


```
korben# diskinfo -v da0
da0
	512         	# sectorsize
	500107861504	# mediasize in bytes (465G)
	976773167   	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	60801       	# Cylinders according to firmware.
	255         	# Heads according to firmware.
	63          	# Sectors according to firmware.
	M6116A016V20	# Disk ident.
```

The amazing gpart:


```
korben# gpart show da0
gpart: No such geom: da0.
```

The titillating kldstat:


```
korben# kldstat
Id Refs Address    Size     Name
 1   17 0xc0400000 e9ece4   kernel
 2    1 0xc71f6000 26000    wpifw.ko
 3    1 0xcdda9000 9f6000   nvidia.ko
 4    1 0xceebf000 6000     amd.ko
 5    1 0xcef0e000 4000     atapicam.ko
```

And finally, pciconf...


```
korben# pciconf -lv
hostb0@pci0:0:0:0:	class=0x060000 card=0x01fe1028 chip=0x2a008086 rev=0x0c hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Mobile PM965/GM965/GL960 Memory Controller Hub'
    class      = bridge
    subclass   = HOST-PCI
pcib1@pci0:0:1:0:	class=0x060400 card=0x01fe1028 chip=0x2a018086 rev=0x0c hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Mobile PM965/GM965/GL960 PCI Express Root Port'
    class      = bridge
    subclass   = PCI-PCI
uhci0@pci0:0:26:0:	class=0x0c0300 card=0x01fe1028 chip=0x28348086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
uhci1@pci0:0:26:1:	class=0x0c0300 card=0x01fe1028 chip=0x28358086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
ehci0@pci0:0:26:7:	class=0x0c0320 card=0x01fe1028 chip=0x283a8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB2 EHCI Controller'
    class      = serial bus
    subclass   = USB
hdac0@pci0:0:27:0:	class=0x040300 card=0x01fe1028 chip=0x284b8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) HD Audio Controller'
    class      = multimedia
    subclass   = HDA
pcib2@pci0:0:28:0:	class=0x060400 card=0x01fe1028 chip=0x283f8086 rev=0x02 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) PCI Express Port 1'
    class      = bridge
    subclass   = PCI-PCI
pcib3@pci0:0:28:1:	class=0x060400 card=0x01fe1028 chip=0x28418086 rev=0x02 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) PCI Express Port 2'
    class      = bridge
    subclass   = PCI-PCI
pcib4@pci0:0:28:3:	class=0x060400 card=0x01fe1028 chip=0x28458086 rev=0x02 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) PCI Express Port 4'
    class      = bridge
    subclass   = PCI-PCI
pcib5@pci0:0:28:5:	class=0x060400 card=0x01fe1028 chip=0x28498086 rev=0x02 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) PCI Express Port 6'
    class      = bridge
    subclass   = PCI-PCI
uhci2@pci0:0:29:0:	class=0x0c0300 card=0x01fe1028 chip=0x28308086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
uhci3@pci0:0:29:1:	class=0x0c0300 card=0x01fe1028 chip=0x28318086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
uhci4@pci0:0:29:2:	class=0x0c0300 card=0x01fe1028 chip=0x28328086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB UHCI Controller'
    class      = serial bus
    subclass   = USB
ehci1@pci0:0:29:7:	class=0x0c0320 card=0x01fe1028 chip=0x28368086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) USB2 EHCI Controller'
    class      = serial bus
    subclass   = USB
pcib6@pci0:0:30:0:	class=0x060401 card=0x01fe1028 chip=0x24488086 rev=0xf2 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = '82801 Mobile PCI Bridge'
    class      = bridge
    subclass   = PCI-PCI
isab0@pci0:0:31:0:	class=0x060100 card=0x01fe1028 chip=0x28158086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801HEM (ICH8M) LPC Interface Controller'
    class      = bridge
    subclass   = PCI-ISA
atapci0@pci0:0:31:1:	class=0x01018a card=0x01fe1028 chip=0x28508086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller'
    class      = mass storage
    subclass   = ATA
ahci0@pci0:0:31:2:	class=0x010601 card=0x01fe1028 chip=0x28298086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller'
    class      = mass storage
    subclass   = SATA
none0@pci0:0:31:3:	class=0x0c0500 card=0x01fe1028 chip=0x283e8086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '82801H (ICH8 Family) SMBus Controller'
    class      = serial bus
    subclass   = SMBus
vgapci0@pci0:1:0:0:	class=0x030000 card=0x01fe1028 chip=0x042b10de rev=0xa1 hdr=0x00
    vendor     = 'nVidia Corporation'
    device     = 'G86M [Quadro NVS 135M]'
    class      = display
    subclass   = VGA
wpi0@pci0:12:0:0:	class=0x028000 card=0x10208086 chip=0x42228086 rev=0x02 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'PRO/Wireless 3945ABG [Golan] Network Connection'
    class      = network
bge0@pci0:9:0:0:	class=0x020000 card=0x01fe1028 chip=0x167314e4 rev=0x02 hdr=0x00
    vendor     = 'Broadcom Corporation'
    device     = 'NetXtreme BCM5755M Gigabit Ethernet PCI Express'
    class      = network
    subclass   = ethernet
cbb0@pci0:3:1:0:	class=0x060700 card=0x01fe1028 chip=0x71351217 rev=0x21 hdr=0x02
    vendor     = 'O2 Micro, Inc.'
    device     = 'Cardbus bridge'
    class      = bridge
    subclass   = PCI-CardBus
fwohci0@pci0:3:1:4:	class=0x0c0010 card=0x01fe1028 chip=0x00f71217 rev=0x02 hdr=0x00
    vendor     = 'O2 Micro, Inc.'
    device     = 'Firewire (IEEE 1394)'
    class      = serial bus
    subclass   = FireWire
```

Like I said, I'm sure in my haste to get this thing operational I probably missed something really, really obvious. Anyone want to show me the error of my ways?


----------



## SirDice (Nov 9, 2012)

Have you tried mounting it? If so, what error does that produce?

Windows usually defaults to the MBR layout so I'm not surprised to see GPT errors.

Have a look with fdisk(8) and see if there are any partitions on it.


----------



## Maxamoto (Nov 9, 2012)

I'll be the first to admit my hard drive theory is not very strong. I'm always willing to learn though! That said, here's the output from fdisk. Keep in mind there's currently 2 other USB drives plugged in so the device in question changed to da2:


```
korben# fdisk /dev/da2 
******* Working on device /dev/da2 *******
parameters extracted from in-core disklabel are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
    start 2048, size 976769024 (476938 Meg), flag 80 (active)
	beg: cyl 0/ head 32/ sector 33;
	end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```

Trying to mount it produces this error: 

```
korben# mount -t ntfs /dev/da2 /mnt
mount_ntfs: /dev/da2: Invalid argument
```

Did a little searching around and found someone else having a related issue with a thumb drive, and it was suggested they run *kldload geom_mbr* to fix it, which I tried as well, and lo and behold, there was the drive. I don't really know why that module works, and it may have been because before that I ran *: > /dev/da2* to try opening the drive up for writing... Even a blind squirrel finds a nut every now and then. Anyway, now I have 
	
	



```
korben# ls -l /dev/da2
**snip**
crw-rw----  1 root  operator    0, 154 Nov  9 14:03 /dev/da2
crw-rw----  1 root  operator    0, 155 Nov  9 14:16 /dev/da2s1
```

And all is well! Cheers-


----------



## SirDice (Nov 9, 2012)

There is a partition on it, which FreeBSD calls a slice. You need to mount da2s1.

`# mount -t ntfs -o ro /dev/da2s1 /mnt`


----------



## Maxamoto (Nov 9, 2012)

SirDice said:
			
		

> There is a partition on it, which FreeBSD calls a slice. You need to mount da2s1.
> 
> `# mount -t ntfs -o ro /dev/da2s1 /mnt`



Heh, I didn't think I came off looking like _that_ much of a new guy   Thanks again, SirDice. I owe you a beer! :beergrin


----------

