The following procedure mounts the filesystem in the block device “/dev/sdz” on the machine “server” onto the directory “/mnt” on the machine “client”. This is done via nbd (network block device). As a result the filesystem logic is done on the machine “client”. I doubt that there will be a considerable speed advantage, but if your “server” is very slow and your client and network are quite fast, it’s possible. You will have to replace strings like “/dev/sda”, “/mnt” and “server” with the actual names.
Your ssh daemon should already be running on the server, otherwise you couldn’t have used sshfs. Install package “nbd” on both machines. Login at “server” as root, then:
$ nbd-server 127.0.0.1:60000 /dev/sdz
Add “-r” to the command line to enforce read-only access (you can only mount read-only later with this). Caution: This command allows any local user to access this block device on “server”.
On the client, connect to the server with ssh (as ordinary user, if you want):
$ ssh -c blowfish-cbc -L 127.0.0.1:60000:127.0.0.1:60000 server
The blowfish cipher is said to be quite fast, hence not eating too much CPU power on the server and client. Caution: This command allows any local user on “client” to access the block device on “server”. Don’t close this ssh-connection while the file system is mounted!
Now login as root on “client”, and mount the device with:
$ modprobe nbd
$ nbd-client localhost 60000 /dev/nbd0
$ mount /dev/nbd0 /mnt
Your filesystem should now appear in /mnt, subject to access restrictions and privileges based on the user accounts on the machine “client”. In a multi-user environment, this might lead to unexpected results and even security risks! On the other hand, if you’re the only user of “client” and “server”, there shouldn’t be any serious problems. And if your machines are connected via a secure link, you can skip the ssh tunnel entirely (thus saving more CPU power) and connect the nbd-server and nbd-client directly.
To unmount everything:
$ umount /mnt
$ nbd-client -d /dev/nbd0
Now you can close the ssh connection.
Yarny