# Problems detecting USB-harddrive after reboot



## knutte2 (Dec 3, 2011)

Hi!

I bought a 1,5 TB external USB harddrive for my FreeBSD-server but ran into problems when I installed it. After recompiling the kernel with msdosfs_large support I succeeded to mount and use the disk. The problem appeared when I rebooted the system, because FreeBSD doesn't detect it on startup. The line below


```
/dev/da0s1  /media/USB-HDD  msdosfs rw  0 0
```

added in /etc/fstab therefore won't get any effect. I have to disconnect the USB cable and reconnect it when the system is running for the system to recognize it, and then mount it manually. Is there any way for the system to recognize it automatically?

Some info
[cmd=]dmesg[/cmd] (after reboot with the USB harddrive connected)

```
Copyright (c) 1992-2007 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 6.2-RELEASE-p1 #0: Sat Dec  3 00:23:53 CET 2011
    knutte2@www2.hottmejl.com:/usr/obj/usr/src/sys/SHOTGUN
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Pentium(R) 4 CPU 2.80GHz (2800.11-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf25  Stepping = 5
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x4400<CNTX-ID,<b14>>
  Logical CPUs per core: 2
real memory  = 2147418112 (2047 MB)
avail memory = 2096300032 (1999 MB)
ACPI APIC Table: <AWARD  AWRDACPI>
ioapic0: Changing APIC ID to 2
ioapic0 <Version 2.0> irqs 0-23 on motherboard
kbd1 at kbdmux0
ath_hal: 0.9.17.2 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
acpi0: <AWARD AWRDACPI> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
cpu0: <ACPI CPU> on acpi0
acpi_throttle0: <ACPI CPU Throttling> on cpu0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff,0x5000-0x501f,0x4000-0x407f,0x4d6 on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <PCI-PCI bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pci1: <display, VGA> at device 0.0 (no driver attached)
pcib2: <ACPI PCI-PCI bridge> at device 2.0 on pci0
pci2: <ACPI PCI bus> on pcib2
re0: <RealTek 8169SB/8110SB Single-chip Gigabit Ethernet> port 0xd000-0xd0ff mem 0xeb000000-0xeb0000ff irq 19 at device 7.0 on pci2
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S media interface> on miibus0
rgephy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 1000baseTX-FDX, auto
re0: Ethernet address: 00:e0:4c:d0:17:2f
re0: [FAST]
re1: <RealTek 8169SB/8110SB Single-chip Gigabit Ethernet> port 0xd400-0xd4ff mem 0xeb001000-0xeb0010ff irq 21 at device 9.0 on pci2
miibus1: <MII bus> on re1
rgephy1: <RTL8169S/8110S media interface> on miibus1
rgephy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 1000baseTX-FDX, auto
re1: Ethernet address: 00:e0:4c:d0:17:1a
re1: [FAST]
isab0: <PCI-ISA bridge> at device 3.0 on pci0
isa0: <ISA bus> on isab0
pci0: <bridge> at device 3.1 (no driver attached)
pci0: <multimedia, audio> at device 4.0 (no driver attached)
atapci0: <AcerLabs M5229 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xf000-0xf00f at device 14.0 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
pci0: <network, ethernet> at device 14.1 (no driver attached)
ohci0: <AcerLabs M5237 (Aladdin-V) USB controller> mem 0xec002000-0xec002fff irq 18 at device 15.0 on pci0
ohci0: [GIANT-LOCKED]
usb0: OHCI version 1.0, legacy support
usb0: SMM does not respond, resetting
usb0: <AcerLabs M5237 (Aladdin-V) USB controller> on ohci0
usb0: USB revision 1.0
uhub0: AcerLabs OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
ohci1: <AcerLabs M5237 (Aladdin-V) USB controller> mem 0xec003000-0xec003fff irq 18 at device 15.1 on pci0
ohci1: [GIANT-LOCKED]
usb1: OHCI version 1.0, legacy support
usb1: SMM does not respond, resetting
usb1: <AcerLabs M5237 (Aladdin-V) USB controller> on ohci1
usb1: USB revision 1.0
uhub1: AcerLabs OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
ohci2: <AcerLabs M5237 (Aladdin-V) USB controller> mem 0xec004000-0xec004fff irq 18 at device 15.2 on pci0
ohci2: [GIANT-LOCKED]
usb2: OHCI version 1.0, legacy support
usb2: SMM does not respond, resetting
usb2: <AcerLabs M5237 (Aladdin-V) USB controller> on ohci2
usb2: USB revision 1.0
uhub2: AcerLabs OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
ehci0: <ALi M5239 USB 2.0 controller> mem 0xec005000-0xec0050ff irq 23 at device 15.3 on pci0
ehci0: [GIANT-LOCKED]
usb3: EHCI version 1.0
usb3: companion controllers, 2 ports each: usb0 usb1 usb2
usb3: <ALi M5239 USB 2.0 controller> on ehci0
usb3: USB revision 2.0
uhub3: AcerLabs EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub3: 6 ports with 6 removable, self powered
uhub3: device problem (TIMEOUT), disabling port 5
acpi_tz0: <Thermal Zone> on acpi0
fdc0: <floppy drive controller> port 0x3f2-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: [FAST]
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
ppc0: <Standard parallel printer port> port 0x378-0x37f,0x778-0x77b irq 7 on acpi0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
ppbus0: <Parallel port bus> on ppc0
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
pmtimer0 on isa0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio1: configured irq 3 not in bitmap of probed irqs 0
sio1: port may not be enabled
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounter "TSC" frequency 2800111768 Hz quality 800
Timecounters tick every 1.000 msec
ad0: 117800MB <IC35L120AVV207 0 V24OA66A> at ata0-master UDMA100
Trying to mount root from ufs:/dev/ad0s1a
re1: link state changed to UP
re0: link state changed to UP
```

[cmd=]camcontrol devlist[/cmd] (after reboot with the USB harddrive connected)

```
<Didn't give any output>
```

[cmd=]dmesg[/cmd]] (after reconnected the USB harddrive)

```
<The above plus the following five lines>
umass0: Seagate Desktop, rev 2.00/1.30, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Seagate Desktop 0130> Fixed Direct Access SCSI-4 device 
da0: 40.000MB/s transfers
da0: 1430799MB (2930277168 512 byte sectors: 255H 63S/T 182401C)
```

[cmd=]camcontrol devlist[/cmd] (after reconnected the USB-harddrive)

```
<Seagate Desktop 0130>  at scbus0 target 0 lun 0 (da0,pass0)
```

The USB-drive:
Seagate 1,5Tb formatted with FAT32-filesystem, one partition.

My system:

```
www2# uname -a
FreeBSD www2.hottmejl.com 6.2-RELEASE-p1 FreeBSD 6.2-RELEASE-p1 #0: Sat Dec  3 00:23:53 CET 2011 
[email]knutte2@www2.hottmejl.com[/email]:/usr/obj/usr/src/sys/SHOTGUN  i386
```

Please mind that I have quite bad knowledge about unix/FreeBSD when you response. Grateful for answers.


----------



## jb_fvwm2 (Dec 3, 2011)

Some sysctl or device.hints setting?. If so, I could maybe find it if I had an hour to search this forum and elsewhere...


----------



## knutte2 (Dec 3, 2011)

As I mentioned, I have quite bad knowledge about freebsdFreeBSD/unix. What information do you need, and how do I provide you with that info. Shall I enter some command and post the output, or something?


----------



## wblock@ (Dec 3, 2011)

Adding the "late" option to /etc/fstab might give the drive enough time to become ready:

```
/dev/da0s1  /media/USB-HDD  msdosfs rw,late  0 0
```


----------



## knutte2 (Dec 3, 2011)

wblock@ said:
			
		

> Adding the "late" option to /etc/fstab might give the drive enough time to become ready:
> 
> ```
> /dev/da0s1  /media/USB-HDD  msdosfs rw,late  0 0
> ```


Thanks wblock@, but it didn't work. I guess the problem is that the system don't detect the drive on startup/boot. It's not visible when I run the commands *dmesg* or *camcontrol devlist* until I physically disconnect the USB cable and reconnect it again.


----------



## wblock@ (Dec 4, 2011)

camcontrol(8) and usbconfig(8) can reset a device;  camcontrol is probably the better option.  An rc.local script could reset it, poll/sleep until the drive becomes ready, then mount it.


----------



## knutte2 (Dec 4, 2011)

wblock@ said:
			
		

> camcontrol(8) and usbconfig(8) can reset a device;  camcontrol is probably the better option.  An rc.local script could reset it, poll/sleep until the drive becomes ready, then mount it.


Tried [cmd=\camcontrol reset all[/cmd] but nothing happened. Have also tried several other attributes to that command, but nothing presents the USB drive. usbconfig(8) doesn't exist on my system.

I noticed another thing. When I have rebooted the system the LED on the USB drive is off, but when I disconnect the USB cable and reconnect it the LED lights up and the system detects the drive.

Any other ideas?


----------



## wblock@ (Dec 4, 2011)

Maybe the drive is asleep?  Don't know how to send USB commands on the old pre-8.0 systems, but there ought to be a way.  camcontrol(8) wouldn't work because the device wouldn't exist until the drive woke up.


----------

