16

I'd like to connect an USB storage device to 2 computers at the same time (With a cable, not over the network). Is this possible?

Context: I want my Raspberry Pi to save output on an external USB-storage, and then be able to read the output on a Windows XP PC.

8
  • 3
    You'll need to explain precisely what you expect to accomplish to get a useful answer. Jun 7, 2013 at 12:14
  • Try a google search for "usb sharing"
    – Dave
    Jun 7, 2013 at 12:30
  • 1
    As @Ramhound stated, you can't have both computers access the USB Resource at the same time. For example, a USB hard drive can only be mounted on one computer at a time. A printer can only be available to one computer at a time. If you want/need access from both computers, you would have to set up a network share to do so.
    – Kruug
    Jun 7, 2013 at 14:35
  • you could stick the usb device into a computer, like a mini or pico or nano itx then access it remotely. Make the computer as small as possible!
    – barlop
    Sep 20, 2013 at 13:24
  • @barlop - What you describe is a network solution. The author specifically says this isn't an acceptable solution.
    – Ramhound
    Sep 20, 2013 at 13:28

4 Answers 4

11

Something like the following is the best you can hope for.

enter image description here

  • Easily share access to USB devices between two computers
  • LED lights indicate which computer has access
  • Gain instant access to your USB devices by plugging one USB cable into your computer
  • Simply press a button to switch individual USB devices from one computer to another
  • Both computers have direct access to the printer thanks to Automatic Printer Sharing
  • Plug and play set up and easy to use with no network required

Since we don't really do product suggestions here at Superuser here is a single Example of the device described. There are others that'll work similarly to this single example. You will be unable to share a USB device with multiple computers at the same time.

Like the Serial devices that came before Universal Serial Bus devices. USB devices are not designed to be accessed by multiple hosts at the sametime. Its the same reason you cannot share a USB device with a VMWare Guest Operating System and the Host System at the sametime and have to disconnect/connect the device.

6
  • I'd like to add, you'd still need to unmount the USB device from one host, then mount on the other host. This helps with the cable swap, doesn't quite do what (I think) the OP is asking for. Not a deficiency of this answer: I don't think any device can do what the OP wants. Jun 7, 2013 at 16:33
  • 3
    -1 If you are going to comment "I didn't say this device could do exactly what the author wants" and if you really think it doesn't do exactly what he wants, then you should have said that in your answer. And not in a response to a criticism, where you suggest you already were aware of that and you just didn't say.
    – barlop
    Sep 20, 2013 at 13:21
  • @Ramhound Rich filled a gap with his great comment,that u have to unmount n mount each time you want to use it on the other computer. If you agree and you knew that then you should have said that in your answer.It's much clearer than your first line about "hope" and your other line(which is unspecific) about not being able to share at the same time. ('cos that leaves open the possibility that they might share it in a concurrent but not simultaneous way so a task on CompA and task on CompB could happen during the same time period but with execution switching between them).
    – barlop
    Sep 20, 2013 at 23:13
  • I'd note though, regarding @RichHomolka 's comment. There is an option in windows with usb drives, where you don't have to manually mount/unmount them, you officially pull them out safely.. (though i suppose i wouldn't try it if it was writing!). You wouldn't need to dismoutn the drive. And with this switch type device, the mounting is automatic. So there'd be no manual mount or dismount if using that windows option.
    – barlop
    Sep 20, 2013 at 23:22
  • I have removed my downvote.
    – barlop
    Sep 20, 2013 at 23:41
1

I haven't used one before, but you could possibly use a USB-USB bridge to let a second computer access files on the first, which would also include any USB attached storage on the first.

2
  • Doesn't look like it supports Linux.
    – jobukkit
    Jun 7, 2013 at 15:28
  • There's more out there than that example I believe. I don't know of any specific brands but there has got to be a USB-USB bridge that acts like an Ethernet cable. and then you could just NFS or SMB the files over the usb0 interface on both sides. Alternatively if both systems have a serial port you could connect a null modem cable, set up ppp, and file share over that, but it'd be slow. If both systems have a Firewire port you could try that as well. That supports point-to-point PC connections if I'm not mistaken.
    – LawrenceC
    Jun 7, 2013 at 15:46
0

Software people won't like it but from a hardware perspective there is no reason two systems cannot have access to the same storage. If one only writes and one only reads there is no issue except trying to read from a file not yet complete. I am sure that can be resolved by simply waiting a prescribed amount of time before trying to read the file. If both systems want to read and write a simple semaphore can be created using files.

This would be a safe way to transfer data between systems. Unless the systems execute the files viruses on one system could not infect the other system. The infected file would be present but it would just be a file.

I have considered designing such a device myself but never seem to have the time. A development board with two USB slave ports (B) and one USB host port (A) could do it. Just pass all commands arriving on either slave port to the host port. Plug a USB drive or thumb drive into the host port. It wouldn't be quite that simple but that would be a starting point.

1
  • 1
    The reason why software people dont like it is because cache coherancy is a thing. You cant wait a prescribed amount of time because cache consistency within a time frame is not guaranteed. GFS2 may be the only filesystem that you can get away with this because of the cache consistency in the GFS cluster protocol, even then you have to worry about consistency across the disk controller (which generally are not 1:N access by design, however I'd be happy to have this proven wrong. Oct 23, 2022 at 9:59
0

USB kvm like switch won't work for USB drive, I've tested several my self and they all need some power down cycle to reconnect properly. Update: the trick is to connect the USB drive via additional USB hub

1
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Dec 9, 2023 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .