NFS shared storage

Modified: 09 Mar 2023 22:10 UTC

Tasks:

  1. Review for correctness in the current context
  2. Reformat as markdown

Old content

If you plan to run your SmartMachine or VM in a production environment, you should consider a storage solution that utilizes Network File System storage (NFS). MNX hosts NFS storage that you can use as part of your backup strategy.

To setup NFS space, you must contact MNX support to setup a mount and whitelist your IPs. You can request a subnet Virtual LAN (VLAN) of private IP's that MNX will whitelist. This allows customers to provision a dataset that is on the VLAN and have access to the NFS mount.

MNX recommends that you only use NFS space for archiving data. Avoid hosting your production files off of an NFS store.

The way you add systems to an NFS mount varies depending on the environment.

SmartOS

To add SmartMachines to an NFS mount:

  1. Ensure NFS is enabled through SMF:
    svcadm enable rpc/bind nfs/client nfs/status nfs/nlockmgr
  2. Create a mount point:
    mkdir /shared
  3. Create an entry in /etc/vfstab: <``` 10.10.10.10:/vol/ - /shared nfs - yes -
  4. Mount the share:
    mount /shared
  5. Verify filesystem is mounted:
    gdf -h
  6. Test the mount by accessing a file in the share.

Debian flavored Linux (Ubuntu)

To add Debian flavored Linux VMs to an NFS mount:

  1. Ensure the NFS package is installed:
    apt-get update
    apt-get install nfs-common
  2. Create a mount point:
    mkdir /shared
  3. Create an entry in /etc/fstab:
    
    10.10.10.10:/vol/<UUID> /shared nfs rw,users
  4. Mount the share:
    mount /shared
  5. Verify the filesystem is mounted:
    df -h
  6. Test the mount by accessing a file in the share.

RedHat flavored Linux (CentOS, Fedora)

To add RedHat flavored Linux VMs to an NFS mount:

  1. Ensure the NFS package is installed:
    yum install nfs-utils nfs-utils-lib 
  2. Create a mount point:
    mkdir /shared 
  3. Create an entry in /etc/fstab:
    10.10.10.10:/vol/<UUID> /shared nfs rw,users,nolock 
  4. Mount the share:
    mount /shared 
  5. Verify filesystem is mounted:
    df -h 
  6. Test the mount by accessing a file in the share.

|

| If you want the mount to be available on reboot you will have to enable netfs:

chkconfig --level 345 netfs on
chkconfig --level 345 nfs on 

|

Microsoft Windows

Microsoft Windows includes a service for NFS but you will need to enable it first. The following TechNet article provides more information on enabling the NFS service in Windows.

http://technet.microsoft.com/en-us/library/cc753302(v=ws.10).aspx

You will need to contact MNX support for the NFS server IP and volume.

To use NFS from a Windows machine, you will need to modify the registry so that Windows has rewrite access to the NFS share. The reason for this is the anonymous UID and GID for the Windows client to access an NFS share is set to -2 by default. You will need to set this to a value of 0.

  1. Click Start > Command Prompt
  2. In the Command Prompt, run regedit.
    C:\Users\Administrator\>regedit 

    This will open the Registry Editor.

  3. In the registry editor, navigate to HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > ClientForNFS > CurrentVersion > Default
  4. In the default directory, click Edit > New > DWORD (32bit) value.
  5. Add two DWORDs: AnonymousUid and AnonymousGid
  6. For each new DWORD, click Edit > Modify...
  7. In the Value Data field, set the value to 0.
  8. Restart the NFS service client or restart your Windows machine.

You can mount the NFS share by running this command from the Command Prompt:

mount <NFS_Server_IP>:<Share_Path> <Mount_Point>

For example:

mount 192.168.31.254:/vol/joyfb7fff88_ae36_4c25_9d4b_df6e3c64efc2 z:

You can also map to an NFS share through Explorer using :.

To setup your mounts so that they persist after a reboot, you need to set up a script that mounts shares on boot. You can find more information about setting up a script here.

Windows 2012 GUI mapping of network drive:

1.) Right click on My Computer Icon, and Map Network Drive 2.) Choose a drive letter and insert

\vol\ Example: \\192.168.31.253\vol\joy5dd44d21_611b_4dd2_b4ea_b1002dcaa32e (In the document it doesn’t explain the path) ### Troubleshooting Device is busy [root@server ~&]# mount -a mount: /tmp is already mounted or swap is busy nfs mount: mount: /backups: Device busy entity not found entity not found Use fuser on the directory to see if a process is holding the directory open. Permission denied when trying to mount 1. Do a traceroute from client to NFS server and make sure that it can reach it and is NOT going over the public interface. It is is going over the public interface you will have to add a route to to the NFS server: - if the zone is shared from the global route -p add / - if the zone is ip exclusive from inside the zone route -p add /32 2. check that the zone's /etc/vfstab is set up to point to proper NFS Serve and mountpoint 3. check that the NFS Server has proper internal IP address of zone Debian Related issues: From [http://forums.debian.net/viewtopic.php?f=16&&t=71654](http://forums.debian.net/viewtopic.php?f=16&t=71654) If the NFS shares fail to mount at boot, while you can still mount them manually (# mount -a), the problem may be that there is a lock caused by e.g. a server crash, that "can fail to be removed and so a reboot of the machine in question will fail to remove the lock and mountnfs will abort all mounts because the lock is still in place" . To get rid of the lock, just - rm -r /var/run/network/mountnfs The related Bug is documented here: [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550883](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550883)