VMware vCenter error “Unable to access file since it is locked” during disk consolidation solved

My setup consists of a vCenter 6 appliance and VMware’s Data Protection (VDP) 6 appliance. Every day there is a scheduled job that backup differentially all the VMs in our organization. Unfortunately this does not work always smoothly, as I would like to. One day I came across the “Unable to access file since it is locked” error. The first encounter was a failed log of VDP appliance on my e-mail inbox, but I am used to logs like this since as I said VDPA does not work always smoothly. So I logged into vCenter web client, connected to Data Protection appliance and re-runned the failed job for the outdated VMs. Unfortunately the job failed again!

Then I noticed an error message on my vCenter client saying “virtual machine disks consolidation needed”.

2

ok, I said. It seemed that the backup job did not delete the backup snapshot, let’s wipe it out manually. I got into the snapshot manager window and pressed the “Delete All” button and after a few minutes a new error message appeared.

1

Pressing the “Consolidate” button did not solved the problem neither. It seemed that the problem is bigger than I first thought. The  events on the problematic VM matched with the whole picture of the problem.

5

My internet searches were not fruitful. I guessed that the VDP appliance was root of the problem, so I shut it down and tried to delete all the snapshots of the problematic VM. Voila, I was near the solution, since the virtual disks consolidated into one disk and the VM properties disk file linked to the right vmdk file.

3

Browsing the datastore of the VM I noticed that an old differential disk file was not deleted (it is the vmdk file that it’s filename ends with a number). This was the causing trouble virtual disk.

4

I wiped it out by right clicking the vmdk file on the datastore browsing window. I restarted the VM to check that everything is ok.

Then I powered on the Data Protection Appliance but it failed to boot up correctly with the following error:

7

This was the root of the problem, VDP appliance had mounted the problematic virtual disk, that’s why this file was locked on the VM. By editing the VDP appliance properties, I deleted the mounted virtual disk that belonged to my problematic VM and left only the four default virtual disks of the appliance.

6

The appliance powered on smoothly and I checked that the services were up and running via VDPA’s console.

Job automation is good when it does not fail! If it fails it causes only troubles. Good luck!

Avoiding the hidden pitfalls of VMware’s vCenter server appliance 6.0 upgrade

VMware’s vCenter appliance is missing parts, one of these is the easy upgrade method. I would prefer to mount the upgrade iso on to the vCSA and click a button that does the job. Instead of this, get ready to read the various walkthroughs of upgrading the vCSA and remember the old days of typing shell commands on linux. It’s not that bad but hey it’s 2015, user friendliness and user interface design are one of the main criteria of selecting products. VMware steps backward!

Ok, let’s start. First of all, check the console display of vCSA, it should be like this:

6.5

Open a browser, goto VMware’s Patch Download Center and download (in our case) the VMware-vCenter-Server-Appliance-6.0.0.5110-2656759-patch-FP.iso file. Now sftp this file to a datastore accessible from vCSA, probably the same datastore that the appliance resides. If you mount the iso patch file to the appliance from vSphere client the job will abort since during the installation the vSphere client disconnects from vCenter. So mount the iso file from an accessible datastore.

Get putty ready and ssh to vCenter Server Appliance. Login as root to install the patch.

1

Logging in as root, it doesn’t give me the same shell environment as logging in as an administrator but it returns the linux bash environment. At this point, if you execute software-package command it will return an error since this is not a bash shell command. You must execute appliancesh command to get into the vCSA shell environment.

By typing software-package command with a help flag you can get the various option of the command

2

we are interested on the iso flag. So execute software-packages install --iso command to start the patch installation

5

during the patch installation, both vSphere desktop and web clients will be disconnected.

During the installation, be careful with the EULA screens because you may press enter by accident when it asks you if you accept the terms and conditions. If you do so, the patch will be staged but not installed. Execute the command software-packages install --staged to install the patch.

3

4

When the installation finish, reboot vCSA appliance by issuing the command shutdown -r <remark> for example shutdown reboot -r patch_vca_upgrade6.0.0.b

6

Now the console screen displays the new vCSA version.

7

Finally disconnect the iso image from cd drive.

Good luck!

Installing VMware vCenter Appliance on vSphere

VMware‘s vCenter server provides a centralized platform for managing your virtual infrastructure. The vCenter Server Appliance (vCSA) is a preconfigured Linux-based virtual machine that is optimized for running vCenter Server and associated services. Note that this version does not support Microsoft SQL server and IBM DB2. vCSA has some limitations, so it is not prefered in production environments. There is an interesting article summarizing these VMware vCenter Server Appliance 5.1 (vCSA) Limitations.

Goto myVMware Downloads page and press the button “View Download” at VMware vCenter Server record.

myVMware downloads page

myVMware downloads page

Then press the “Download Manager” button at the VMware-vCenter-Server-Appliance line with File type OVA. An OVA (open virtual appliance or application) is merely a single file distribution of the OVF and VMDK files stored in the TAR format.

An OVF refers to the Open Virtualization Format, which is a “packaging standard designed to address the portability and deployment of virtualization appliances”. The OVF file is a descriptor file of the packaging and VMDK files are containers for virtual hard disk drives of the appliance. For example, our OVA file includes the following files:

The ova file

The ova file

You can see the manifest file and the certificate files as well.

Appliance Download

Appliance Download

And download the appliance file. Then open the vCenter client and connect to your hypervisor. Select “Deploy OVF Template” from the main menu, to start the import wizard. Browse the downloaded ova file and press Next.

Source File

Source File

OVF Template Details

OVF Template Details

Enter the name for the Appliance, for example “vCenter Appliance”.

Name and Location

Name and Location

Select  Thick Provision Eager Zeroed disk format since this is the fastest way to write to a virtual disk (without zeroing blocks first or extending the disk file). I copy the policies from VMware’s website:

Thick Provision Lazy Zeroed

Creates a virtual disk in a default thick format. Space required for the virtual disk is allocated when the virtual disk is created. Data remaining on the physical device is not erased during creation, but is zeroed out on demand at a later time on first write from the virtual machine.

Using the default flat virtual disk format does not zero out or eliminate the possibility of recovering deleted files or restoring old data that might be present on this allocated space. You cannot convert a flat disk to a thin disk.

Thick Provision Eager Zeroed

A type of thick virtual disk that supports clustering features such as Fault Tolerance. Space required for the virtual disk is allocated at creation time. In contrast to the flat format, the data remaining on the physical device is zeroed out when the virtual disk is created. It might take much longer to create disks in this format than to create other types of disks.

Thin Provision

Use this format to save storage space. For the thin disk, you provision as much datastore space as the disk would require based on the value that you enter for the disk size. However, the thin disk starts small and at first, uses only as much datastore space as the disk needs for its initial operations.

Disk Format

Disk Format

Select the Network Map.

Network Mapping

Network Mapping

Check the Power on after deployment checkbox and press Finish.

Ready to Complete

Ready to Complete

It will take some time to deploy the vCenter Appliance.

Deploying

Deploying

Deploying

Deploying

Finally the vCenter Appliance will appear on vSphere client. It will power on and get an ip from your DHCP server.

vCenter Appliance Console

vCenter Appliance Console

Open a browser and type in the url of the appliance at SSL port 5480. for example https://10.1.1.10:5480

vCenter Appliance Administrative Console

vCenter Appliance Administrative Console

The default login credentials are username root and password vmware.

13

Finally configure the appliance pressing the setup wizard button!