VMware Cloud Community
vmdave203
Contributor
Contributor
Jump to solution

Creating an NFS datastore to allow "local-like" file access between VMs?

The task I am trying to accomplish in ESXi is to allow two VMs (Linux Ubuntu 16.04) to access the same folder within a datastore. I also want them to be able to read/write to that folder. My ESXi admin is out for the day, so I cannot take action until tomorrow, but I have come up with this plan to execute tomorrow.

We have already assigned all memory on our host to all of our datastores (all initialized as VMFs). What I am thinking is that we delete one of our datastores to free up memory, and bring up a datastore that is NFS. Once we do this, is it possible to give the two virtual machines read/write access to the same storage in the NFS datastore?

Thanks,
Dave

1 Solution

Accepted Solutions
daphnissov
Immortal
Immortal
Jump to solution

You're going about this the wrong way, in that case. Your objective should be to use an NFS server external to what your vSphere environment uses and perform your data warehouse tasks there. Attempting to co-write to a datastore (NFS or not) currently in use by ESXi is not at all a good idea. This means that you need a separate NFS server on your network, and probably a dedicated array that offers file services with some level of robustness (NetApp, Isilon, etc).

View solution in original post

7 Replies
sjesse
Leadership
Leadership
Jump to solution

Why do you want vms to access the same datastore the esxi uses to store vms? Do you want them to have acess to the vm files? If so this isn't a good thing. If you doing it to save storage just do a different nfs export for the vms and another one for the datastore, it doesn't need to be one or the other.

0 Kudos
ryanrpatel
Enthusiast
Enthusiast
Jump to solution

Instead of doing it as NFS, I would recommend just using shared VMDKs. Add the SCSI controller as VMware Paravirtual\Physical on both VMs with the same Virtual Device Node IDs (SCSI2:0) for example. Then you enable the multi-writer flag on that.

We have quite a few VMs like that (all Linux using RHEL fencing).

There are caveats to this: You cannot move the VMs while powered on as well as some Backup-related issues.

vmdave203
Contributor
Contributor
Jump to solution

We have brought up some VMs on datastore1. We do not want our VMs to be able to touch other VM files. What we want is a large mount for all machines to write to. They would not be writing to the same file. For example, the mount would have folder warehouse. VM1 would write to warehouse/vm1_logs/ while VM2 writes to warehouse/vm2_logs/. We essentially want to allocate a large place for writing for all of our virtual machines.

Are you saying within my datastore2, I can create folder warehouse, and set it as nfs?

0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

You're going about this the wrong way, in that case. Your objective should be to use an NFS server external to what your vSphere environment uses and perform your data warehouse tasks there. Attempting to co-write to a datastore (NFS or not) currently in use by ESXi is not at all a good idea. This means that you need a separate NFS server on your network, and probably a dedicated array that offers file services with some level of robustness (NetApp, Isilon, etc).

sjesse
Leadership
Leadership
Jump to solution

You would do this on your nfs server, not in the datastore, then you make esxi just look at the one folder and the vms look at the other folders. You  don't want your nfs sevrer sharing one big share and have everything use it.

vmdave203
Contributor
Contributor
Jump to solution

Thanks for the advice! Must I power off the first machine with the shared vmdk before attaching it to the second machine? I setup sharing on the first machine, but while attaching the vmdk to the second VM, the sharing box is greyed out.

0 Kudos
vmdave203
Contributor
Contributor
Jump to solution

Thank you for the helpful response, I set up the NFS server and have my VM clients accessing it.

0 Kudos