IncentivesPro Forum Index IncentivesPro
Leading USB solutions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sharing multiple drives with similar enclosures

 
Post new topic   Reply to topic    IncentivesPro Forum Index -> USB Redirector for Linux
View previous topic :: View next topic  
Author Message
aquaman



Joined: 23 May 2017
Posts: 5

PostPosted: Sun Jul 05, 2020 11:04 pm    Post subject: Sharing multiple drives with similar enclosures Reply with quote

Hello,


I found what might be a bug where it seems usbredirector gets confused when the server is sharing multiple drives that have a similar (the same model) drive enclosure. The issue seems to extend from the fact that each hard drive is reporting the same serial number, and usbredirector struggles to sort them out.

The type of enclosure I am using is the Inland SATA->USB3.0 located here:

https://www.microcenter.com/product/486119/inland-25-sata-to-high-speed-usb-30-external-hard-drive-enclosure

Using usbredirector 3.9.1 with Ubuntu 20.04 on Raspberry Pi4. At a given time, there are between 5 and 10 usb drives plugged into a powered hub. All of them have different models and different serial numbers. But when you put the drives in these enclosures, usbredirector thinks they are all have the same vid = 174c, pid = 1153 and serial number = 00000000000000000000.

NOTE: I can get the real serial numbers of the hard drives if I use hdparm.

For the most part, the server is able to handle it by distinguishing the drives based on which usb port it's plugged into.

Manually sharing any one drive is problematic, but you can avoid that problem by turning on auto-share. And, luckily the issue doesn't affect my other devices (mouse / kb) because they have their own serial numbers, so I can exclude them from auto-share with no problem. However, it gets confused if I change the port that a hard drive is plugged into.

For example, let's say I plug in Drive 1 to usb port 2-1.1, and then nickname it to "Drive A". Then I plug in Drive 2 into port 2-1.2, and nickname it "Drive B". Well then if I move Drive 1 from port 2-1.1 to 2-1.2, where Drive 2 used to be, it will show the nickname is "Drive B". So Drive 1 picks up the saved nickname for Drive 2, which is wrong. I believe the expected behavior is that it should have no nickname or retain its nickname after moving to a new port.

So far these are minor symptoms. The clients don't have any issues on their side except maybe some confusing nicknames.

The real problem starts when you want to exclude one of the drives. I can exclude one, but after the next reboot two problems will happen. First, it forgets which device I excluded and defaults to excluding the first device it can find with matching serial number. So it excludes the wrong device.
Then, the remaining drives get stuck in "Initializing" and never get shared.
(Non-drives like mouse and kb are not affected). The result is that no drives are shared/available. The only way to fix this situation is to remove the exclusion, and then power cycle the drives. After that, all devices go back to being shareable again.

I looked at the source code to try to see if there is anything I could do, but I got lost. I am giving up trying to fix the issue, but I figured I would post to the forum and then maybe a fix will be discovered if I am lucky.

Note also the issue happens with or without the powered hub (using the built-in Pi4 usb ports), it is not a factor.

Prior to this I was using usbredirector 3.6 on Odroid XU4, with the same drive enclosures. It had similar issues but the exclusions problem appears to be a new issue.

I am just not totally sure that it is a usbredirector problem. When I type sudo lshw -class disk | grep 'serial', it shows me all the serial numbers are 00000000000000000000. But when I type sudo hdparm -I /dev/sd? | grep 'Serial\ Number', it shows me all the correct serial numbers. Regardless, I feel like usbredirector source code should be smart enough to handle this.


a
Back to top
View user's profile Send private message
Peter
Site Admin


Joined: 01 Aug 2007
Posts: 653

PostPosted: Mon Jul 06, 2020 9:26 am    Post subject: Reply with quote

Hi aquaman,

Thank you for the detailed post!

The root cause of the problem is that HDD enclosures do not comply with the USB specification in terms of serial numbers. We would suggest getting better ones that have unique serial numbers.

The only way for USB Redirector to distinguish between identical USB devices is the USB port number they are attached to. That's why you see a nickname assigned to Drive 1 when you plug it into the USB port where Drive 2 is used to be.

When there are multiple USB devices with an identical serial number, only the first device that you attach will be identified by serial. Other devices will be identified by a USB port number. This is new behavior in 3.9 that harmonizes it with the Windows version so that both versions behave the same way.

As to hdparm. This tool displays hard drive's serial number, while USB Redirector works at USB level and the only serial number it knows is a serial number of a USB device (HDD enclosure in your case).

As to exclusions, we will look into it...
Back to top
View user's profile Send private message
aquaman



Joined: 23 May 2017
Posts: 5

PostPosted: Mon Jul 06, 2020 1:34 pm    Post subject: Reply with quote

Peter wrote:
When there are multiple USB devices with an identical serial number, only the first device that you attach will be identified by serial. Other devices will be identified by a USB port number. This is new behavior in 3.9 that harmonizes it with the Windows version so that both versions behave the same way.


Thank you for the quick reply Peter this explains a lot.

These enclosures are special because they are stable and compatible with both windows and linux. It took a lot of research and trial and error to find them. They work really well.

In Windows there are similar issues with the identical enclosure serial numbers. Device manager shows them all having the same device name, but there are ways to distinguish them such as by drive label. It is not as impactful, and just like Linux I can use any number of tools (such as HWINFO.exe) to get the real serial numbers. I have even been able to hack the *.inf driver files to make sure each drive obtained a unique device name. It's just this small problem in Linux that I am struggling with.

I would like to find another suitable drive enclosure but that really does involve buying different ones and trying them until I find a model that works to my requirements.

Alternately, if usbredirector code was able to acknowledge that some drive enclosures may have non-standard behavior and is able to handle them anyway, well then it would be a superior application.
Back to top
View user's profile Send private message
Peter
Site Admin


Joined: 01 Aug 2007
Posts: 653

PostPosted: Thu Aug 27, 2020 10:11 am    Post subject: Reply with quote

Hi aquaman,

We have prepared a new version that resolves this issue, it should properly exclude a single device without affecting all others with the same vid/pid/serial:
https://www.incentivespro.com/usb-redirector-linux-arm-gnueabihf.tar.gz
(UPD: these changes have been implemented in 3.9.5 and later versions)

Note that the first device you attach will be still identified by serial number, while others with the same serial will be identified by USB port number.

If desired, it is possible to revert to the old behavior, so that all drives are identified by USB port number. You can do it as follows:

1) Stop USB Redirector
Code:
/etc/init.d/rc.usbsrvd stop

2) Add the following lines to /etc/usbsrvd.conf file:
Code:
[USB device quirks section]
quirk=174c:1153::IgnoreSerial;

where 174c and 1153 are the VID and PID of the enclosure as displayed by USB Redirector.

3) Start USB Redirector
Code:
/etc/init.d/rc.usbsrvd start


Hope it helps. Please update us after you try it.
Thanks.


Last edited by Peter on Mon Jan 18, 2021 4:46 pm; edited 2 times in total
Back to top
View user's profile Send private message
aquaman



Joined: 23 May 2017
Posts: 5

PostPosted: Mon Sep 07, 2020 4:08 am    Post subject: Reply with quote

Hello

I'm back to report that the updated version does resolve the exclusions issue. It allows me to add and remove excludes as expected. Thank you!

The only remaining challenge for me is the nick-name confusion due to duplicate serial numbers. As a part of that investigation I looked at another model enclosure by Sabrent which can be located here.

https://www.microcenter.com/product/451202/sabrent-25-sata-hard-drive-usb-30-enclosure

We got 2 of them from a local store and 9 of them from Amazon.com. All of them report the same serial number to usbredirector regardless of the hard drive inside the enclosure. The experience leads me to believe that I probably won't solve the problem by finding a "perfect" usb enclosure.
Back to top
View user's profile Send private message
Peter
Site Admin


Joined: 01 Aug 2007
Posts: 653

PostPosted: Mon Sep 07, 2020 9:00 am    Post subject: Reply with quote

See the 3 steps in my previous post. They will help to resolve the nickname confusion by identifying the enclosures with the help of USB port number instead of serial number (nicknames will be tied to port number)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IncentivesPro Forum Index -> USB Redirector for Linux All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group