Sunday, April 16, 2017

Idiosyncrasies of ${HOME} that is an NFS Share

NFS is perhaps best for more 'permanent' network mounted directories such as /homedir or regularly accessed shared resources.  In this article, we will cover the following topics:
  • Set up NFS share via automounter
  • Idiosyncrasies of  /homedir that is an NFS share 

Automounter


One drawback to using /etc/fstab is that, regardless of how infrequently a user accesses the NFS mounted file system, the system must dedicate resources to keep the mounted file system in place. This is not a problem with one or two mounts, but when the system is maintaining mounts to many systems at one time, overall system performance can be affected.

An alternative to /etc/fstab is to use the kernel-based automount utility.  An automounter consists of two components:[1]
  • A kernel module
    • implements a file system
  • A user-space daemon
    • performs all of the other functions

The automount utility can mount and unmount NFS file systems automatically (on demand mounting) therefore saving system resources. The automount utility can be used to mount other file systems including AFS, SMBFS, CIFS and local file systems.

${HOME}


When your home directory is automounted, it has different behaviors than other file systems due to its sharing.  For example, you could run into the following two issues:
  • cp: cannot stat  "KeePass-2.14.zip": Permission denied[2]
  • ".bashrc" E509: Cannot create backup file (add ! to override)"
In the below sections, we will discuss these two issues in more details.

cp: cannot stat "KeePass-2.14.zip" : Permission denied


In [2], the author has described an issue in which she has tried to copy a file from her home directory to /usr:
$ chmod 777 KeePass-2.14.zip
$ cp KeePass-2.14.zip /usr/keepass/
cp: cannot create regular file `/usr/keepass/KeePass-2.14.zip': Permission denied
$ sudo cp KeePass-2.14.zip /usr/keepass/
cp: cannot stat `KeePass-2.14.zip': Permission denied
However, sudo cp can't statKeePass-2.14.zi because${HOME} is on an NFS mount and the NFS server doesn't grant your machine root permission to the NFS share.

To workaround this "cannot stat: Permission denied" issue, you need to copy the file to another directory (e.g., /tmp) first:
cp KeePass-2.14.zip /tmp
sudo cp /tmp/KeePass-2.14.zip /usr/keepass/

".bashrc" E509: Cannot create backup file (add ! to override)"


One time when I edited and saved my $HOME/.bashrc, the system has thrown the following message:

".bashrc" E509: Cannot create backup file (add ! to override)"
Then I used "df" command to find the disk space available on my homedir:

$ df -h .
Filesystem            Size  Used Avail Use% Mounted on
server1:/export/home4/myusername
                      5.0T  1.4T  3.7T  28% /home/myusername
It showed that there were still plenty of space.  However, because ${HOME} is NFS shared for the home directories of many others, every user has been assigned a disk quota.  To find out how much quota you have been assigned for your homedir, you can run:

$ quota -Q -s
Disk quotas for user myusername (uid 40000):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
server1:/export/home4/myusername

                  1624M   2048M   2048M               0       0       0

So, to resolve this issue, you can simply remove other junk files form the homedir to gain some disk space for saving the file.

References

  1. autofs
  2. How to copy a file from my home folder to /usr
  3. Automount mini-Howto
  4. How to configure autofs in Linux and what are its advantages?
  5. Is it feasible to have home folder hosted with NFS?

4 comments:

  1. awesome post presented by you..your writing style is fabulous and keep updated with your blogs Big data hadoop online Course Hyderabad

    ReplyDelete
  2. How To Terminate All Your Hurdles Carefully With Chime Customer Service?

    It would not be wrong to state that Chime is free of all sorts of terrors, mishaps, and loopholes. If you are a user of the Chime account, you may come across some issues. However, if you are a technical person, you can easily handle it without taking expert’s help. Besides, if the situation is out of control and you are able to rectify your Chime related technical hurdles, you should consider taking Chime Customer Service without making any delay.

    ReplyDelete
  3. Thanks for sharing an informative blog keep rocking bring more details. I like the helpful info you provide in your articles. Also, check Digital Marketing Jobs in Nigeria.

    ReplyDelete
  4. Furthermore, file permissions and ownership can become nuanced when dealing with ${HOME} as an NFS share. In a heterogeneous environment with different user identities and permissions across machines, maintaining consistent access control becomes paramount. Administering proper NFS settings and coordinating user identities can mitigate potential discrepancies in file permissions.

    In essence, while ${HOME} as an NFS share offers centralized storage benefits, it necessitates careful attention to network performance, server reliability, and user permissions. Addressing these idiosyncrasies ensures a smoother and more reliable user experience in environments leveraging NFS for home directories. Most students are drawn to these types of articles and information, but they are unable to prepare for their exams, If you have been struggling with your e-commerce project and want assistance, students can visit ecommerce web design company - ecommerce web design company near us and get the best performance on their website by providing them with the most excellent available resources, including quality web design services.

    ReplyDelete