A tunnel to my automounter

As I have said previously, I really like the automounter, and feel It my geeky duty to push my luck with what can be done with it.

When in the office we have a standard automounter mount point /share/install which allows access to all the install images of all the software that we have. Now when at home I wanted the same thing but to get the data from the office over ADSL. But then ssh will do compression which I have found can significantly improve access times. Could I tunnel NFS over ssh and still get the automounter to do it's stuff?

First you have to tunnel the NFS tcp port over ssh:

ssh -C -L 6049:nfs-server:2049  myzone.atwork

where nfs-server is the name of the nfs server of the install images and myzone.atwork is the name of a host at work that can access the nfs server.

Now thanks to nfs URLs I can mount the file system using:

mount nfs://localhost:6049/export/install

Automounting requires a small amount of hackery to workaround a feature of the automounter where it assumes any mount from a “local” address can be achieved using a loopback mount. So the map entry for install looks like this:

install / -fstype=xnfs nfs://127.0.0.1:6049/export/install

Then in /usr/lib/fs/xfns I have a mount script:

#!/bin/ksh -p
exec /usr/sbin/mount $@

And viola I have automounting nfs over a compressed ssh tunnel, mainly because I can! I can then live upgrade my home system over nfs via an ssh tunnel with compression to each new build as it comes out.

This also allows the pleasant side effect of being able to pause any install from the directory by using pstop(1) to stop the ssh process and prun(1) to continue it, which can be useful if I want to have better interactive perfomance over the network for a period while the upgrade continues.

Comments:

Chris,

Simply brilliant. On thing though, the mount above suggests I don't need a mount point, yet I have to specify one:

# mount nfs://localhost:6049/export/install
mount: Mount point cannot be determined
# mount nfs://localhost:6049/export/install /mnt
# df -h /mnt
Filesystem             size   used  avail capacity  Mounted on
nfs://localhost:6049/export/install
                      1007G   935G    63G    94%    /mnt

Posted by Stacey Marshall on October 11, 2004 at 03:35 PM BST #

Stacey, you are right you need a mount point for mounting!

Posted by Chris Gerhard on October 13, 2004 at 03:36 PM BST #

Very nice. Just a reminder to any readers that you need to have AllowTcpForwarding set to "yes" in your /etc/ssh/sshd_config, for this to work

Posted by Peter Schow on November 23, 2004 at 11:22 AM GMT #

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today