ESXi guest OS; how to change the working directory to an NFS

VirtualDallas
VirtualDallas used Ask the Experts™
on
Received some good instruction to solve an issues with snapshot size on a datastore with block size too small.

Have an inexpensive NAS and have successfully followed the instructions to create a Datastore on the host using the NAS NFS.

Making mistakes and not having luck in editing the VM .vmx file to add the workingDir=”"
that cuases the VM to use the NFS target as the snaphot datastore.  The path to the NFS is eluding me.  The NFS store is just a temporary fix to aid other issues

Creating the NAS datastore seemed to go well and simple.  The Datastore name is NAME and the path to the store is ip,ip.ip.ip:/nfs/store.  

How to code the .vmx to use workingDir=”ip,ip.ip.ip:/nfs/store" and does there need to be an additional folder inside the store, that is called out in the path?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
The first issue that you may have here, is the VMX sometimes can be cached by vCenter, which means, for you, you may have to turn off the VM, and remove the VM from the inventory, and then edit the VMX file and then Add the VM back to the Inventory for Changes to Take Effect.

add a line at the bottom of the VMX file as follows

workingDir = "new_path_location"

I would recommend creating a folder on the NAS called vm-snapshots

workingDir = "/vmfs/volumes/46f1225f-552b0069-e03b-00145e808070/vm-snapshots"

you then need to find the unique GUUID for the NAS datastore.

you can find these easily at the command prompt or use vSphere Client and look at Inventory Datastores

Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
at the command prompt, on the ESXi server type

ls -al /vmfs/volumes

you will see the friendly name symlinked to the GUUID (the long number this is what you want to use)

e.g. for me it's this

 nfs -> eff44beb-2c974ed7

we want to use the GUUID because it NEVER changes, and friendly name is for us humans!
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
and another tip it's only when you create the snapshot, you will see in the Summary Page for the VM, it will be using two datastores.

and you can test this, with using Snapshot Manager, no need to wait for Backup to start.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Thought so; and have removed, edited and added vm to host inventory.  Issue is do not see GUID in datastore name, as in other datastores.  The store is listed and browsable in client, right down to the folder I added.  But name in the vSphere client inventory is simply ip.ip.ip:/nfs/Store
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
did you give the datastore a name?

and if you look at

ls -al /vmfs/volumes

it must be there?
1st No.. there doesn't need to be a folder with the nfs store.. each VM will create a folder called "VM Name" and place the snap shot with it. BUT to keep your sanity you may want to create a folder in case you use this LUN for something else in the future.. Its just good practice to keep organized.

Here is how I set my snapshot redirection

using the vsphere powerCLI


Connect-VIServer "vCenterServerName"

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Files = New-Object VMware.Vim.VirtualMachineFileInfo
$vmConfigSpec.Files.snapshotDirectory = "[DataStore01] \VmSnapShotFolder"

$vm = Get-VM Server01 | Get-View
$vm.ReconfigVM($vmConfigSpec)

$vm = Get-VM Server02 | Get-View
$vm.ReconfigVM($vmConfigSpec)

$vm = Get-VM Server03 | Get-View
$vm.ReconfigVM($vmConfigSpec)

DONE

the [DataStore01] in the command above is simply what you called the LUN in vCenter when you imported it.. and the \VmSnapShotFolder is the folder that is in the [DataStore01] Lun you created to store your snapshots.

This script above is very simple and does exactly what you want.. it adds the workingDir line in the VMX file and sets it correctly. Once complete I would power off and on the VM and create a snapshot to test it.


Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
I only see ip.ip.ip:/nfs/Store when I look at Storage, and that's the device.

Author

Commented:
yes, gave it a name; embarssing but never cli and putty doesnt seem to want to
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
when you added the nfs storage, did you give it a friendly name?

can you rename the ip.ip.ip:/nfs/Store ?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
what's the server ESXi 4.1?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
if you click Inventory, Datastores? does it list ALL your Datastores?

Author

Commented:
I can rename; in the storage inventory the device has a name (nasstore) and the "device" column  has listed as ip/ip.ip.ip:/nfs/nfsfoldername

Author

Commented:
yes esxi 4.1 and yes all datastores are listed, nfs store is browsable
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
DS
what does yours look like?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
yes, this is the wrong place!!!!!

Click Home > Inventory > Datastores

Home is almost Top Left!

Are you connected to vCenter of the Client?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
sorry, connected to vCenter or direct to the ESXi server?
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
you'll not have datastores if connected direct to the server using vSpere Client.

you will have to go to the SSH remote or console.

Author

Commented:
no vCenter here, yet and SSH not behaving?  Crud, sorry...
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
your friiendly name for the datastore is called

IomegaNAS

so when you look at the results to

ls -al /vmfs/volumes

IomegaNAS ---> xxxxxxxxxxxxxxxxxxxxxxxxxx

the xs above are the GUUID
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
Select Configuration, Security Profile, Services (Properties) at the Top, SSH Options Start, ESXi Shell Options Start

Author

Commented:
ha; got ssh running
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
actually at the top Service Prioperties

and then

SSH > Options > Start,
ESXi > Shell Options > Start

and then try putty
VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017
Commented:
once logged in.....

type ls -al /vmfs/volumes

you can use putty to copy the GUUID name......

Author

Commented:
close; got guuid
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
so just work that GUUID into the VMX and you should be done.

Author

Commented:
Thank you; I feel so small, yet so happy!  Now onto the bigger issues.  Probably not until this weekend.  Thank you honestly for your patience.  Best personal regards...
Andrew Hancock (VMware vExpert / EE Fellow)VMware and Virtualization Consultant
Fellow 2018
Expert of the Year 2017

Commented:
No problems.

Just a small tip, because I do not know, how good the NAS performance will be, but when in snapshot mode, all the realtime writes will go to this delta virtual machine disk on the NAS.

NFS, NAS, Network could possible cause performance issues, so make sure the Backup/Veeam/Snapshot is completed at a quiet time, so the snapshot size is small.......

also DO NOT resize a disk with a snapshot, and becareful as well on the size, otherwise you could get issues, on closure of snapshot, when it writes and merges the changes from the NAS back to local disk.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial