Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Nov 2020 20:44:25 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Christoph Harder <shadowomf@arcor.de>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: usb harddisk not working
Message-ID:  <20201121204425.86d9c6b1.freebsd@edvax.de>
In-Reply-To: <b677a42e-a351-7fd5-24e8-770b251d6ba5@arcor.de>
References:  <b677a42e-a351-7fd5-24e8-770b251d6ba5@arcor.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 21 Nov 2020 13:35:46 +0100, Christoph Harder wrote:
> I'm/we're running FreeBSD 12.1-RELEASE-p10 GENERIC amd64
> on an PC Engines APU.4D4 Board with a Transcend MSA230S SSD
> as main hard drive which is detected as ada0.
> I would like to attach a hdd case that contains a Western
> Digital 14TB hard disk (already partitioned and formatted
> with a single ufs partition).
> However the disk is not always detected, sometimes connecting
> it to another usb port (2 ports are available) works but not
> always.
> Especially after a reboot the drive is not detected properly
> (I'm not 100% certain, but I believe it never was detected
> correctly after a reboot). When the disk is detected it is
> listed as da0.
> The hdd case does seem to contain a JMicron usb controller,
> it's a icybox case with space for two 3.5" disks, but currently
> only contains the one WD hdd.
> 
> I've enabled automount like described in section 17.4.2.
> Automounting Removable Media of the handbook.
> The same settings work flawlessly on other devices (same board,
> same os version) with external seagate hdds (though they are
> ready made solutions, not hdd cases that are made to be filled
> with drives by the user).

>From the configuration you could show, it looks to be setup
correctly. But there is something that is a little bit
suspicious, combined with your initial description of "works
sometimes, but not always".

It is the following part:



> usbconfig
> ugen0.1: <0x1022 XHCI root HUB> at usbus0, cfg=0 md=HOST
> spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
> ugen1.1: <AMD EHCI root HUB> at usbus1, cfg=0 md=HOST
> spd=HIGH (480Mbps) pwr=SAVE (0mA)
> ugen1.2: <vendor 0x0438 product 0x7900> at usbus1, cfg=0 md=HOST
> spd=HIGH (480Mbps) pwr=SAVE (100mA)
> ugen0.2: <JMicron JMS56x Series> at usbus0, cfg=0 md=HOST
> spd=SUPER (5.0Gbps) pwr=ON (2mA)
> 
> /dev
> shows ada0 but not da0. It also shows the following usb devices
> lrwxr-xr-x  1 root  wheel        9 Nov 21 13:10 ugen0.1@ -> usb/0.1.0
> lrwxr-xr-x  1 root  wheel        9 Nov 21 13:10 ugen0.2@ -> usb/0.2.0
> lrwxr-xr-x  1 root  wheel        9 Nov 21 13:10 ugen1.1@ -> usb/1.1.0
> lrwxr-xr-x  1 root  wheel        9 Nov 21 13:10 ugen1.2@ -> usb/1.2.0
> crw-r--r--  1 root  operator  0x45 Nov 21 13:10 usbctl

The "chain of command" in USB mass storage basically is this:
ugen -> umass -> pass -> da. If you don't have a da device
associated, nothing can be mounted, nothing will happen.

By the way, I use a similar approach here:

% dmesg
[...]
ugen4.3: <JMicron> at usbus4
umass1: <MSC Bulk-Only Transfer> on usbus4
da3 at umass-sim1 bus 1 scbus4 target 0 lun 0
da3: <WDC WD20 EFAX-68FB5N0 > Fixed Direct Access SCSI-2 device 
da3: 40.000MB/s transfers
da3: 1907729MB (488378646 4096 byte sectors: 255H 63S/T 30400C)

% camcontrol devlist
[...]
<WDC WD20 EFAX-68FB5N0 >           at scbus4 target 0 lun 0 (pass4,da3)

% usbconfig
[...]
ugen4.3: <USB to ATAATAPI bridge JMicron> at usbus4,
	cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON

The corresponding "chain of command" devices appear in /dev
as expected. Sometimes it requires a few seconds after
powering on the device.



> I hope you can give me some hints and tips on how to get
> this disk working properly.

There's another thing I'd like to mention just to be sure:
In case there is a UFS filesystem on the disk, automount
won't be possible if the filesystem is not clean. So in case
it did not get dismounted properly, the "chain of command"
(as mentioned above) will be intact, but you'll only receive
en entry in your system log file that the filesystem is not
clean. So when in doubt, manually run fsck on the device.

But leaving this problem aside, it looks like there is
something wrong in your combination of hardware that stops
the "chain of command" to be established properly. This could
be a wiring thing, but in my experience with cheap USB disk
enclosings, it's probably a version of the firmware (the
part that does "USB plug <---> SATA disk") that is not
working properly and according to the standard. This can
also explain the "works here, but not there" and "works
sometimes, but not always".



> By the way, do you have any information about settings that
> reduce the power consumption of external disk drives?

You're entering a dangerous forest, stranger. ;-)

No, seriously: This is a quite complicated topic, and very
much dependent on brand, model, firmware version, kind of
connection, and so on. Obtaining some of the information
can be achieved using smartctl, others require the tools
of the manufacturer, and may or may not work depending on
the kind of connection to the device.





-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20201121204425.86d9c6b1.freebsd>