Can a USB hub be used to access a drive from two devices?
Solution 1:
No. USB by design can only have a single host (one PC).
What you can get is a kind of "switch", often combined with a USB hub. Then you can connect two PCs to it and manually switch between them. But only one PC can be the USB host at a time.
If you want to share a harddisk between two PCs, then there are other ways to do that (e.g. NAS = network attached storage).
Solution 2:
No. You cannot share USB devices between different hosts. USB switches allow you to disconnect USB devices from one computer and connect them to another by pressing a button. The primary use is (most probably) to connect a keyboard-mouse-set to two PCs and switch as needed.
But even if USB would allow the setup you have in mind, you'll run into trouble. Most filesystems will be damaged/become inconsistent/corrupt if data is written simultaneously by two computers. Please don't confuse this with special protocols like Samba/Windows Shares, NFS etc. In these cases, only the computer that shares the data will continue to read and write to disk for the other computers. So although multiple computers have access, a single computer controls all read and write accesses.
If you want to share a harddisk between two PCs you can use sharing options in the OS of one of the PCs (e.g., Windows Shares, NFS). Moreover, today's home routers and NAS allow to easily share attached storage in the network.
Solution 3:
It's physically impossible to plug a hub into two PCs using standard USB cables. Hubs and PCs both have A-type sockets on downstream ports, and there are no standard cables connecting two A-sockets together.
The same issue will arise when you'll try to connect your hub's upstream port to a hard drive, as they will both have B-type sockets . There are exceptions to this case, as upstream ports are allowed to have AB or C-type sockets, but it won't work nevertheless, as USB is dysfunctional without a host on the bus.
Solution 4:
No, you cannot, but there are other similar solutions.
If you were to set up a NAS (Network Attached Storage) on the network, then both PC's could read off of the network storage device. This would work over the entire network, as it is connected to the network. You then could even map the drive or subdirectory on the USB as a drive, if you want.
Alternately, you can plug the USB into another PC and map one PC read another PC by manually setting ip addreses (if they are not already mapped), set the sharing settings, and you connect them with via ethernet, but I'm pretty sure that you can't automatically access external drives (anything plugged into USB) using this method unless they are specifically mapped. In this case the drive would be plugged into only 1 computer and the other PC would read the drive through the other PC, over ethernet.
Solution 5:
I have a KVM that is able to share a single USB2 port between up to 4 computers along with the keyboard mouse.
You can drop a file from a Windows PC onto it and read it from a Mac connected to the same KVM. It's pretty cool.
Cost about $100 on Amazon for the 4Port version with 4K support. I have a MacMini + Windows + RaspberryPI + Nintendo Switch connected.
The trick is that normal KVM's disconnect the ports as you switch between hosts, but this model keeps the ports alive so the O/S doesn't lose / rediscover the keyboard/mouse/usb each time you switch.
I've tested the port with a USB2 stick, PS4 controller and a Logitech mechanical keyboard which needed more power than the dedicated keyboard usb port on the KVM.
Don't want to break any advertising rules, but if you google the product, it's red.
My first answer, so YMMV.