0

I recently purchased a multi-port usb hub so that I can connect multiple external hard drives to my Synology nas.

When I don't need to use them, I eject them safely from the web interface and then with a smart plug I disconnect it from the power remotely.

The problem is that when I need to use them again and activate them with the smart plug it does not recognize them again. This system works perfectly if an external drive is plugged directly into the nas via usb, but with the hub when you turn on the drive it never reappears. If I restart the system, it recognizes all the drives connected to the hub but it's a very inconvenient thing to do constantly.

You would need a command or tool that ejects or unplugs the usb hub (as if you had rebooted the nas) to get it to recognize all drives again.

Through SSH with the dmesg command, it gives me a lot of information, but I think the relevant one in my case could be this:

[   38.081313] usb-storage 3-1.1:1.0: USB Mass Storage device detected
[   38.088627] scsi host2: usb-storage 3-1.1:1.0
[   38.093334] usb-storage 5-1.4:1.0: USB Mass Storage device detected
[   38.099958] scsi host3: usb-storage 5-1.4:1.0
[   38.104628] usb-storage 5-1.3.1:1.0: USB Mass Storage device detected
[   38.111356] scsi host4: usb-storage 5-1.3.1:1.0
[   38.116179] usbcore: registered new interface driver usb-storage
[   38.174998] uhci_hcd: USB Universal Host Controller Interface driver
[   38.308182] usbcore: registered new interface driver usblp
[   38.392432] usbcore: registered new interface driver usbhid
[   38.398144] usbhid: USB HID core driver

How could I reset the hub (or one of the drives plugged into the hub individually) so that the drives are recognized again after being ejected, unplugged, and plugged back in? I'm not very good with Linux commands, I've tried this but without success:

echo "5-1" > /sys/bus/usb/drivers/usb/unbind
sleep 10
echo "5-1" > /sys/bus/usb/drivers/usb/bind
PlayerWet
  • 138
  • 9
  • 1
    Have you tried a different USB hub, specifically, one that is externally powered? – Ramhound Feb 04 '22 at 13:31
  • The hub is powered, it is 5v/3a and the nas recognizes it perfectly with all the drives running. The problem is when ejecting a drive from Synology web interface, turning off the power to the external drive with the smart plug and plugging it back in does not mount the drive to the nas again. For the disks to appear again I have to restart the nas. – PlayerWet Feb 04 '22 at 13:38
  • 1
    That doesn’t answer my question if you have used another USB, suspect the problem, is a conflict with the Hub and the smart plug – Ramhound Feb 04 '22 at 14:19
  • Hard drives are external and are the ones that are plugged into a smart plug. When I need some data from a drive, I turn on the socket where that drive is plugged in and it turns on and is immediately recognized by the nas, when I don't need to use the drive, I unmount the drive from Synology and turn off the power. The system works fine if it is directly connected to the nas via USB, but with the hub, if I activate the disk plug, the nas does not recognize it. It is only recognized if I restart the nas. I think it may be a recognition problem between the hub and the nas. – PlayerWet Feb 04 '22 at 15:08
  • 1
    I agree; I suspect the Hub is the reason for the behavior. Hopefully, the Hub which can be replaced, is the issue otherwise if it's the Synology NAS you are likely out of luck since it's a closed system. The dmesg output is when the drives are working or not working? – Ramhound Feb 04 '22 at 15:52

1 Answers1

1

Try:

USBDEVICE="3-1.1"
echo 0 > /sys/bus/usb/devices/$USBDEVICE/authorized
usleep 100000
echo 1 > /sys/bus/usb/devices/$USBDEVICE/authorized

for the first of the three disks listed in your dmesg excerpt. Change the first line to

USBDEVICE="5-1.4"

or

USBDEVICE="5-1.3.1"

for the other two.

Tilman Schmidt
  • 1,223
  • 1
  • 11
  • 16
  • It works great. Many thanks. How could I do the opposite? That is, if I want to unmount drive 5-1.3.1 using another script. Thanks !!!! – PlayerWet Feb 05 '22 at 13:25
  • 1
    Determine the corresponding block device and run the `umount` command on that, for example `umount /dev/sdc1`. – Tilman Schmidt Feb 05 '22 at 18:02
  • I have opened another question related to this matter, to see if you can stop by and give me a hand. thank you very much tilman https://superuser.com/questions/1703351/script-to-eject-usb-disk-from-task-scheduler-on-synology-nas – PlayerWet Feb 05 '22 at 18:36