VMware Cloud Community
MikeS1983
Enthusiast
Enthusiast

Unable to delete flat.vmdk file.

Hi All,

I was recently having a problem with one of my template VM's. Whenever I tried to power it on to run updates it threw up an error saying that a file was locked.

Anyway I decided that I would recreate my template file and delete the old template server from VC. When I do this the folder remains in the datastore with the flat.vmdk file inside. I'm unable to delete this.

I have tried lots of commands at the console which all throw up a similar error of "device or resource busy". I have restarted all the hosts within the cluster and this still hasn't resolved my problem.

The datastores are FC San attached.

Can anyone help???

Mike.

Reply
0 Kudos
5 Replies
RParker
Immortal
Immortal

The problem is the file is locked because some other ESX server is locking the file. This is a hassle, because there really isn't a way to tell which server has it locked.

So pretty much your only hope is to put each one of your ESX servers in maintenance mode (with access to that datastore where the vmdk is) and reboot them. Then eventually it will be unlocked.

kjb007
Immortal
Immortal

One thing I've noticed with templates, is that if you deploy a vm from that template, and edit the vm's hardware settings at the same time, then the new vm may be using the template's hard drive. This may be what you are seeing right now. I'd edit the settings on the vm that you deployed from that template, and make sure the disk files that the deployed vm is using is not coming from the template's folder.

-KjB

VMware vExpert

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
MikeS1983
Enthusiast
Enthusiast

Hi,

Thing is I'd never actually deployed a VM from this template. It had been powered off since I built the template about 3 months ago. I will try the maintenance mode method and hope it works.

Thanks for your replies.

Mike.

Reply
0 Kudos
MikeS1983
Enthusiast
Enthusiast

I powered down each server (not reboot) and deleted the file that way.

Reply
0 Kudos
virtuallysi
Enthusiast
Enthusiast

Another way to find out which ESX host is locking the file is to logon to each ESX host and type "ps auxfww | grep <TEMPLATEVM>" where <TEMPLATEVM> is the name of your template. Do this on each ESX host until it returns a PID then do kill -9 PID.

Reply
0 Kudos