VMware Cloud Community
ldrose537
Contributor
Contributor

VMWare VI Remote CLI

Hello,

I am completely new to VMware. We are running ESXi 3.5 on an HP ProLiant DL380G5. While testing a UPS, the ESXi Server went down. After rebooting, one of the VMs would not power on. In another blog I saw a suggestion to create a new VM and use the existing *.vmdk - now I am getting "Unable to access file since it is locked." By the way - I have a call into support on this, and am waiting patiently.

My research suggests there may be a way to figure out what's going on by creating a SSH session to the server and using vmkfstools(?). I've no idea how to do this.

I have seen reference to RemoteCLI and PuTTY: What's the difference? Is one better than the other?

-also- I am aware that I need to make sure the ESXi Server will allow for the remote session; how do I do that?

This server was kind of thrown on me and I am reading the guides I'm discovering as fast as my eyeballs will allow, but I'm getting punchy and a little panicky. I should probably mention, we are not using VirtualCenter server.

Any assistance is welcome.

appreciatively,

Linda

0 Kudos
18 Replies
AndreTheGiant
Immortal
Immortal

Putty is just a SSH client.

The VMware CLI is a set of commands specific for ESX and you need the console or SSH access.

I don't know if there is a complete reference, but there are a lot of examples, like this:

http://www.petri.co.il/5-critical-vmware-esx-cli-network-commands.htm

http://b2v.eu/cli/

Andre

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
ldrose537
Contributor
Contributor

Andre,

Thanks for the links. The first one led me to the following page, which is one of the things I needed to see - a good visual example of how to get the SSH session allowed on ESXi:

I have gathered a lovely list of sample commands, including the "Remote Command-Line Interface Installation and Reference Guide" so I'm perfectly overwhelmed with info in that department.

So, if I understand correctly, Putty could be used to create a SSH session to anything (roughly) while RemoteCLI could only be used with ESX? Otherwise, for my purpose they'd be the same?

Thanks again for the response.

Linda

0 Kudos
AndreTheGiant
Immortal
Immortal

a good visual example of how to get the SSH session allowed on ESXi:

In ESXi 3.5 it's already open. But in ESXi 4 is closed by default.

There is also the tip to enable SSH root access. But I suggest to understand how sudo work and use it (on ESX not "i").

Putty could be used to create a SSH session to anything (roughly) while RemoteCLI could only be used with ESX?

SSH is the same to be on the console of your host.

RCLI is a way if you do not have SSH access (as ESXi 4 by default) or a way to execute all command from a single point (useful for example in scripting) Smiley Wink

An there is also the scripting language way, using SDK: in this case you can have more commands or functions (see for example PowerShell extension for VMware)

Andre

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
0 Kudos
DSTAVERT
Immortal
Immortal

Since you created a new virtual machine and used the existing drive you have a new folder for the virtual machine. Open the datastore browser ("double click" on the datastore anywhere it is visible) and browse to the old vmdk file. Right click on the vmdk and select move to. Select the new folder as the destination. Now edit the settings for the new virtual machine and add an existing disk. Browse to the folder and add your disk. You will need to remove the first reference to the vmdk file.

-- David -- VMware Communities Moderator
ldrose537
Contributor
Contributor

DSTAVERT,

I did move the old vdmk to the new VMs folder. What do you mean by...?

Now edit the settings for the new virtual machine and add an existing disk. Browse to the folder and add your disk. You will need to remove the first reference to the vmdk file.

Linda

0 Kudos
ldrose537
Contributor
Contributor

...oh, wait, do you mean that, since I moved it to the new location, I would have to re-add the vmdk and get rid of the one I opted for during the creation?

It's possible I already did this - but since I don't remember, I'll check this out.

Thanks,

Linda

0 Kudos
DSTAVERT
Immortal
Immortal

Yes. Remove the new disk you created and add the old (previous) vmdk.

-- David -- VMware Communities Moderator
0 Kudos
heyitspablo
VMware Employee
VMware Employee

Just wanted to let folks know we have a community dedicated to the vSphere Command Line Interface (vCLI) ..formerly known as RCLI

http://communities.vmware.com/community/developer/vsphere_cli

Keep up with latest info on vSphere PowerCLI http://blogs.vmware.com/vipowershell - Follow me on Twitter @heyitspablo
0 Kudos
ldrose537
Contributor
Contributor

DSTAVERT,

I followed the recommendation, but it didn't make a difference. I still get "Unable to access a file since it is locked," at 60% progress.

Thanks for the suggestion.

Linda

0 Kudos
DSTAVERT
Immortal
Immortal

Try an ESXi host restart.

-- David -- VMware Communities Moderator
0 Kudos
ldrose537
Contributor
Contributor

Good to know, thanks! Once I get the go-ahead from Tech Support, I expect I'll need it.

Linda

0 Kudos
atbnet
Expert
Expert

Hi Linda, sometimes when an ESX server or VM is not correctly shutdown a file can get locked stopping you from starting it again.

Take a look at this and see if this is the problem you have and it will help you fix it.

Andy

VCP / vExpert / MCTS

For Help, Guides and How Tos visit

If you found this information useful please award points using the buttons at the top of the page accordingly.

Andy Barnes
VCP / VCA-DT / MCITP:EA / CCIA
Help, Guides and How Tos... www.VMadmin.co.uk

If you found this information useful please award points using the buttons at the top of the page accordingly.
0 Kudos
ldrose537
Contributor
Contributor

Andy,

Thanks for the link. I am still (patiently) waiting for tech support - so I've been reluctant to go "in there" without a little guidance.

Am I being an overly paranoid newbie?

Linda

0 Kudos
ldrose537
Contributor
Contributor

Hello,

Just an update. Only half successful. The tech support guy did help get the vm to start; problem is, it can't find the operating system.

No idea what's that's about. This much I know: the original vm had two virtual hard drives: c:\ and d:\ - operating system and data directory respectively. While waiting to hear back from the tech guy, I used the iso to start Windows setup, and the Recovery Console. I typed 'dir' at Recovery Console prompt and got a listing, but of the original drive d:'s contents.

So here's my thought - would I be on the right track in thinking I could add a second disk and reinstall the OS? How do I control which disk it tries to boot to?

I know I'll have to reinstall the application the vm was running, but at least it looks like the data is possibly still there.

Linda

0 Kudos
DSTAVERT
Immortal
Immortal

I don't know what disks you can see from the datastore but you do want to preserve what you can. Were there any snapshots. Is this the original VM or new?

A somewhat useful recovery machine. Create a new VM and install the OS. Once up and going add a disk (edit settings/hardware/ add disk) Add an existing disk. Browse to the old data location and add the disk. If you have two disks add the second one. Now have a look from within your new VM at the new disks. If nothing else you can do whatever recovery you can from within.

I would also visit sanbarrow.com There are some very useful references. For future recovery situations consider creating a MOA or bartpe disk (iso).

-- David -- VMware Communities Moderator
0 Kudos
ldrose537
Contributor
Contributor

DSTAVERT,

There were no snapshots. It's the original VM.

I do have a template that I can work with, or should I just make a new VM from scratch?

I checked out sanbarrow, and it looks promising.

Thanks,

Linda

0 Kudos
DSTAVERT
Immortal
Immortal

It doesn't matter whether you use a fresh install or from a template. You just want to have a VM to use for recovery purposes. If your template can make a suitable windows install great use that. If you are able to mount both original drives you can at least recover whatever data you need or repair anything that might have caused the machine to not boot. Is the drive set "active" (set as the boot device) ?? etc.

You might also be able to use Converter to convert the disks to a new machine.

-- David -- VMware Communities Moderator
0 Kudos
ldrose537
Contributor
Contributor

Conclusion:

Turns out when the host went down, we somehow lost the *.vmdk for the OS drive (C:\) but retained the *.vmdk for the data drive (D:\). I mean it was gone. I have no explanation; the tech was flummoxed as well. That was one of two VMs I wasn't involved in setting up - so I wasn't familiar with it's makeup. Shame on me.

Cloning our template and adding the original secondary drive worked (had to modify the drive assignment to suit). I was able to access the application data. I installed the application, and it's working as I type.

It bugs me that I still don't know what caused this (aside from the shutdown, of course). But I sure have learned a lot - though the tech guy was a big help too, and rather comforting - I have now personally used SSH and am pleased to report that it's not as scary as I thought. I still have much to learn, so I keep reading...and reading...

Linda

0 Kudos