I want to create a USB-to-USB data transfer system in Linux (preferably Ubuntu). For this I want to use no external hardware or switch (except this cable). It’s going to be like mounting a USB drive to a system, but in this scenario one of the Linux systems is going to be mounted on the other. How can I create this?
Are there any kernel modules available, given my experience with kernel programming is very basic?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Yes this is possible, but it is not possible by cutting two USB cables with USB-A connectors (what is normally going into the USB on your motherboard) and cross connecting the data cables. If you connect the USB power lines on such a self made cable, you are likely to end up frying your on-board USB handling chip. Don’t try this at home!
On most computer boards the chips handling USB are host only. Not only that but, it also handles a lot of the low level communication to speed things up and reduce the load on the CPU. It is not as if you could program your computer to handle the pins on the USB port to act as if a non-host. The devices capable, on the chip level, of switching between acting as a host and connecting to a host are few, as this requires a much more expensive chip¹. This is e.g. why intelligent devices like my smart-phone, GPS and ebook, although they all run Linux or something similar, do not allow me to use ssh to communicate when connected via a normal USB cable.
Those devices go into some dumb mode when connected, where the host (my desktop system) can use its storage as a USB disc. After disconnecting the device uses the same interface as a host as to get to the data (although no cable connection is required, this happens internally). With that kind of devices even if Linux runs on both, there is no communication between the systems, i.e. the linuxes. This independent of a normal micro or mini USB cable connecting them to my desktop.
Between two desktop PCs the above is normally impossible to do as you would require a USB-A to USB-A cable, which is is not common (as it would not work with the normal chips that are driving the connections anyway).
Any solution doing USB to USB with two USB-A connectors that I have seen, is based on a cable that has some electronics in between. (much like a USB → Serial plugged into a Serial → USB cable, but then all in one piece). These normally require drivers to do the transfer, although you might be able to use UUCP or something else over such a cable, like you would over a “normal” serial port. This probably requires inetd and proper configuration to login on the other computer as well.
¹ The only device I have that is software changeable in this way is a Arduino board with exactly such a special chip. Just this chip made the board twice as expensive as a normal Arduino board.
Method 2
Yes, USB 3.0 makes full duplex data transfer possible, with 3.0 cabling. The specs are in section 5.5.2 of the USB specs. The link to those specs is given earlier in another answer. http://www.gaw.ru/pdf/interface/usb/USB%203%200_english.pdf
Cables are becoming easier to find- they can be bought on Amazon, for example, for under $8.00. be sure to buy DATA TRANSFER, male A to male A cables. Newer versions of Linux support the transfer.
I hope that helps someone- I searched for the answer for quite a while myself.
Method 3
you could use a USB bridge device which is available in a cable form-factor like this … http://www.usbgear.com/link/ (auto-play video warning)
Method 4
It is technically possible if one of the device supports USB OTG, in which a port may act as master or as slave. You may set up the OTG device as slave, and let it act as an USB hard disk drive (so you don’t even need special driver on the master).
This is what a lot of phones and some cameras do. If you connect them to a printer they become master; if connected to a PC they become slave.
Method 5
The way I would do it is use 2 usb-serial cables and a null connection between. Then u can use xmodem, zmodem, kermit etc to transfer files, or use ppp or slip for a network between two machines. Old fashioned but will work.
Thad
Method 6
I know you wanted to limit your hardware to a single cable, so this answer is for people who do not have that requirement.
Use 2 USB-net cards and an RJ45 patch cable (no need for a switch with modern cards).
This way you do not need to deal with special kernel drivers or special software. Simply setup the net cards in both ends and transfer via this network using normal tools like rsync or NFS.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0