Tuesday Jan 03, 2012

NFS mounts with ZFS

I ran into a strange automount issue where my NFS shares were not being mounted at boot time. nfs/client was enabled, my entry in /etc/vfstab was correct, and issuing a `mount -a` worked flawlessly. So what was the problem? Well, this was the entry in my vfstab file:
biff:/paulie    -       /export/home/paulie/biff   nfs     -       yes     proto=tcp,vers=3
I wanted to place my NFS share inside a zfs filesystem so that it was easily accessible in my home directory.
[paulie@doc ~]$ zfs list | grep export/home/paulie
rpool/export/home/paulie  78.3M  2.82G  78.3M  /export/home/paulie
Turns out this is not such a good idea since the /etc/vfstab file is read *before* zpool's are imported and mounted. This means that all NFS shares need to be listed outside any filesystems to be mounted at boot time and then symlinked in.
[root@doc ~]# mkdir /biff
[paulie@doc ~]$ ln -s /biff/ /export/home/paulie/biff/
... and then changing around vfstab ...
biff:/paulie    -       /biff   nfs     -       yes     proto=tcp,vers=3
And that's it, NFS should automount now:
[paulie@doc ~]$ df -kh | grep biff
biff:/paulie           2.7T   1.2T       1.4T    47%    /biff
Lesson learned.

Wednesday May 20, 2009

Cannot remove directory: File exists

If you try to delete a directory over NFS and get an error such as...
rm: cannot remove directory `asdf/': File exists
... you will notice that conventional methods won't be good enough to remove it.
$ chmod -R 777 asdf/
$ rm -rf asdf/
$ rm: cannot remove directory `asdf/': File exists
Usually there is a file like .nfs234B inside the directory than can be displayed with ls -la
$ ls -la
total 146
drwxr-xr-x 2 user group    512 2009-05-20 08:51 .
drwxr-xr-x 3 user group    512 2009-05-19 08:59 ..
-rwxr-xr-x 1 user group 134888 2009-05-18 12:45 .nfs234B
Removing this file only replaces it with another. There are two solutions: manually delete the file on the NFS server, or (if you don't have that type of access) kill its process.
$fuser -u asdf/.\*
asdf/.:     9070c(user)
asdf/..:    28690c(user)   24845c(user)
asdf/.nfs934B:     9070tm(user)
9070 is the offending process. Kill it with fire.
$ kill -9 9070
Should be able to remove that directory now.
About

Hiya, my name is Paul Johnson and I'm a software engineer working on the ZFS storage appliance .

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
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