Saturday, November 19, 2011

HPUX/LINUX: NFS mounting

Exporting and mounting file systems on Linux and HP-UX

If you want to use a shared file system on Linux® and HP-UX systems, you must export it from the system where it is located and mount it on every system on which you want to access it.
You must be logged on as root.
To export and mount file systems on Linux and HP-UX systems, complete these steps:
  1. Export a file system on Linux and HP-UX systems.
    1. Add the file system that you want to export to the file ⁄etc⁄exports.
    2. Export all entries in the file ⁄etc⁄exports by entering the command ⁄usr⁄sbin⁄exportfs -a.
    3. Verify that the file system is exported by entering the command ⁄usr⁄sbin⁄exportfs.
    All shared file systems are displayed.
  2. Mount a file system on HP-UX and Linux systems.
    1. If the file system that you want to mount is remote, ensure you have the permission to mount it by entering the command⁄usr⁄sbin⁄showmount - e
      where  is the name of the remote operating system.
    2. Choose an empty file system that serves as the mount point for the file system that you want to mount.If an empty file system does not exist, create it by entering the command mkdir /
      where  is the name of the local file system.
    3. Mount the file system on your local system by entering the corresponding command.
      • On HP-UX, enter the command/usr/sbin/mount -F nfs sourcehost:/sourcedir /destinationdir
      • On Linux systems, enter the command/bin/mount -t nfs sourcehost:/sourcedir /destinationdir
      where:
       is the name of the remote operating system
       is the name of the remote file system
       is the name of the local file system
To mount the remote file system after each reboot, add it to the /etc/fstab file.For a description of the file format of /etc/fstab, enter the command
man fstab.

example fstab:

server:/mnt /mnt nfs rw,hard 0 0 #mount from server