Link to home
Start Free TrialLog in
Avatar of VirtualDallas
VirtualDallasFlag for United States of America

asked on

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

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?
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

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

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!
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.
Avatar of VirtualDallas

ASKER

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
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.


I only see ip.ip.ip:/nfs/Store when I look at Storage, and that's the device.
yes, gave it a name; embarssing but never cli and putty doesnt seem to want to
when you added the nfs storage, did you give it a friendly name?

can you rename the ip.ip.ip:/nfs/Store ?
if you click Inventory, Datastores? does it list ALL your Datastores?
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
yes esxi 4.1 and yes all datastores are listed, nfs store is browsable
yes, this is the wrong place!!!!!

Click Home > Inventory > Datastores

Home is almost Top Left!

Are you connected to vCenter of the Client?
sorry, connected to vCenter or direct to the ESXi server?
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.
no vCenter here, yet and SSH not behaving?  Crud, sorry...
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
Select Configuration, Security Profile, Services (Properties) at the Top, SSH Options Start, ESXi Shell Options Start
ha; got ssh running
actually at the top Service Prioperties

and then

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

and then try putty
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
close; got guuid
so just work that GUUID into the VMX and you should be done.
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...
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.