Tuesday Dec 09, 2008

Automounter verbose toggle and GNU ls

As I have mentioned before you can turn automounters verbose mode on and off by accessing the file "=v" as root in the root of an automount point. Typically this means "/home/=v" so I would usually do:

# ls /home/=v

and the logging would burst into life. However you need to be sure you don't use the gnu ls (which is the default on OpenSolaris) as if you do you will see in the log file this:

t4 Automountd: verbose on 
t4 Automountd: verbose off 

The reason is clear when you truss the ls:

cjg@brompton:/var/crash/brompton$ pfexec truss -o /tmp/tr ls /home/=v
ls: cannot access /home/=v: No such file or directory
cjg@brompton:/var/crash/brompton$ egrep =v /tmp/tr
stat64("/home/=v", 0x0807A20C)                  Err#2 ENOENT
lstat64("/home/=v", 0x0807A20C)                 Err#2 ENOENT
cjg@brompton:/var/crash/brompton$ 

It accesses the file twice, so toggles verbose mode on and then off. I think this is a bug in the gnu ls since if they did lstat64 first and it returned ENOENT they would not need to do the stat64 at all. Anyway the solaris ls does the right thing:

cjg@brompton:/var/crash/brompton$ pfexec /usr/bin/ls /home/=v
/home/=v: No such file or directory
cjg@brompton:/var/crash/brompton$ tail -1 /var/svc/log/system-filesystem-autofs:default.log
t4      Automountd: verbose on
cjg@brompton:/var/crash/brompton$ 

Wednesday May 21, 2008

Using mirror mounts to get a better /net

One problem with the automounter is that when you use the /net mount points to mount a server if the admin on that server adds a share then you client won't see that share until the automounter timesout the mount. This obviously requires that the mounts are unused which for a large nfs server could never happen.

So given an NFS server host called sa64-zfs-gmp03.eu which is sharing a directory /newpool/cjg on a client you can do:

#  ls /net/sa64-zfs-gmp03.eu/newpool
cjg
#  ls /net/sa64-zfs-gmp03.eu/newpool/cjg
SPImage         ipmiLog         ppcenv          sel.bin         tmp
SPValueAdd      mcCpu0Core0Log  processLog      summaryLog
evLog           mcCpu1Core0Log  prsLog          swLog
hwLog           mcCpu2Core0Log  pstore          tdulog.tar
# cd  /net/sa64-zfs-gmp03.eu/newpool/cjg
# ls
SPImage         ipmiLog         ppcenv          sel.bin         tmp
SPValueAdd      mcCpu0Core0Log  processLog      summaryLog
evLog           mcCpu1Core0Log  prsLog          swLog
hwLog           mcCpu2Core0Log  pstore          tdulog.tar

However if at this point on the server you create and share a new file system:

# zfs create -o sharenfs=rw newpool/cjg2
# share
-@newpool/cjg   /newpool/cjg   rw   ""  
-@newpool/cjg2  /newpool/cjg2   rw   ""  
# echo foo > /newpool/cjg2/file
# 

You can't now directly access it on the client:

# ls /net/sa64-zfs-gmp03.eu/newpool/cjg2
/net/sa64-zfs-gmp03.eu/newpool/cjg2: No such file or directory
#

Now we all know you can work around this by using aliases for the server or even different capitalization:

# ls /net/SA64-zfs-gmp03.eu/newpool/cjg2
file
# 

however lots of users just won't buy that and I don't blame them.

With the advent or mirror mounts to NFSv4 you can do a lot better and there is an RFE (4107375) for the automounter to do this for you, which looks like it would be simple on a client that can do mirror mounts but until that is done here is a work-around. Create a file “/etc/auto_mirror “that contains this line:

\* &:/

Then add this line to auto_master:

/mirror auto_mirror  -nosuid,nobrowse,vers=4

or add a new key to an existing automount table:

: s4u-nv-gmp03.eu TS 50 $; nismatch mirror auto_share
mirror / -fstype=autofs,nosuid,nobrowse auto_mirror.org_dir.cte.sun.com.
: s4u-nv-gmp03.eu TS 51 $; 

Now if we do the same test this time replacing the “/net” path with the “/mirror” path you get:

# ls /mirror/sa64-zfs-gmp03.eu/newpool/
cjg
# ls /mirror/sa64-zfs-gmp03.eu/newpool/cjg
SPImage         ipmiLog         ppcenv          sel.bin         tmp
SPValueAdd      mcCpu0Core0Log  processLog      summaryLog
evLog           mcCpu1Core0Log  prsLog          swLog
hwLog           mcCpu2Core0Log  pstore          tdulog.tar
# (cd /mirror/sa64-zfs-gmp03.eu/newpool/cjg ; sleep 1000000) &
[1]     10455
# ls /mirror/sa64-zfs-gmp03.eu/newpool/cjg2
/mirror/sa64-zfs-gmp03.eu/newpool/cjg2: No such file or directory

Here I created the new file system on the server and put the file in.

# ls /mirror/sa64-zfs-gmp03.eu/newpool/cjg2
file
# 

If you are an entirely NFSv4 shop then you could change the “/net” mount point to use this.

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