Bulk file transfers made easy with SSHFS on Ubuntu and OpenBSD
A few days ago, I decided that I would like to transfer a large archive of files from one computer (running OpenBSD 7.0) to another (running Ubuntu 21.04). The main reason for this was simply that I needed to clear some space on the hard drive.
My first course of action was to do the file transfer via removable media, in this case a 32gb usb stick, which didn’t go so well. After issuing cp -R $HOME/archive /mnt/ from the command line, and then finding something else to do while the machine did it’s thing, I came back about 45 minutes later to find that the write process was going at an achingly slow pace. Eventually, the write process failed altogether, with only a fraction of the usb’s capacity having been used.
Digging in with some online searches, I saw that others have had similar complaints, and that historically, OpenBSD has been known for slow usb write speeds. (At the most, I had only ever written a handful of files at a time to usb, so this was news to me despite the fact I’ve been using OpenBSD off and on for almost a decade.) Apparently, the OpenBSD project has been working on this issue since version 6.7, and I’ve also read that there are some workarounds. But while ordinarily I’d be down with exploring said workarounds, at this point I simply wanted to get the files transferred sooner rather than later, and thus my attention span for futzing around under the hood was somewhere between between minimal and non-existent. (To be clear: I do want to explore getting my OpenBSD box to write files to usb faster, but under more patient circumstances.)
Feeling stymied by the usb issue, I then quickly resolved to somehow transferring the file archive over my local network, rather than via removable media of any kind. The solution I settled on was SSHFS, which allows you to mount a directory on a remote machine via SSH as if it were physically attached to your local machine. In my case, the ‘local’ machine (a laptop) was on my dining room table, and the ‘remote’ machine was just upstairs. In your case, your ‘remote’ machine may also be in another room in the house, or on the other side of the planet.