Mounting a Linux partition/USB device as an NFS share to an ESXi host
search cancel

Mounting a Linux partition/USB device as an NFS share to an ESXi host

book

Article ID: 306524

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to mount a Linux partition/USB device as an NFS share to an ESXi host.
You may want to mount a Linux partition/USB device as an NFS share to an ESX/ESXi host to:
  • Copy files from local datastore to a USB device without using the datastore browser download option.
  • Clone/copy a running virtual machine to a USB device.


Environment

VMware ESXi 4.0.x Installable
VMware ESXi 4.0.x Embedded
VMware vSphere ESXi 5.1
VMware ESXi 4.1.x Installable
VMware ESX Server 3.5.x
VMware ESX 4.1.x
VMware ESXi 4.1.x Embedded
VMware ESX 4.0.x
VMware ESXi 3.5.x Installable
VMware vSphere ESXi 5.0
VMware ESXi 3.5.x Embedded

Resolution

To export the share/USB to an ESX/ESXi host as an NFS share:
  1. Connect a USB drive to a Linux machine
  2. Ensure that the USB device is detected and mounted to that machine.

    For example, run this command to mount a USB device in Linux:

    mount /dev/sdX /mnt/usb

  3. Create a file-share in that USB device.

    For Example:

    /mnt/usb/fileshare

  4. Verify and ensure that NFS services are running on the Linux machine.

    Note: You can use this command to start the services:

    apt-get install nfs-kernel-server

  5. Open the /etc/exports file in the Linux machine using a text editor.
  6. Add a line similar to:

    /mnt/usb/fileshare IP_address (rw,sync,no_root_squash,no_subtree_check)

    Where IP_address is the IP address of the host.


  7. Save and close the file.
  8. Run this command and ensure that you do not see any warnings/errors:

    exportfs -a

  9. Connect to the ESX/ESXi server using the vSphere Client.
  10. Click the Configuration tab.
  11. Click Storage.
  12. Click Add Storage.
  13. Select Network File System and click Next.
  14. Enter these information:

    • Server – IP address of the Linux machine
    • Folder – NFS share path

      For example, /mnt/usb/fileshare
    • Name – Any label of your choice

  15. Click Next.
  16. Click Finish.

    You should now be able to see the USB device as a datastore under Configuration > Storage > Datastores.