Shrink Windows Partition hosted on ESXi VMWare – Virtual Disk Drive .vmdk
Problem
I had a partition on a Windows Server (VM) that was used for log files and was 300GB, 200GB of which will never be used. I needed to shrink this drive to 100GB. This can not be achieved via the vSphere client so here are the steps I took.
Resolution
First open up Disk Management in Computer Management in your guest Windows environment.
Right click the volume on the disk you want to shrink.
Windows will inform you the maximum amount it can shrink the disk by. Choose an amount that you wish to actually shrink it by and click Shrink.
Once it is done and you are satisfied that the volume on the disk is the size you want.
Shut down the VM.
Enable SSH Access – This can be done via vSphere or by logging in to the iLo, depending on your infrastructure. I did it via vSphere as it was just quicker and easier.
Use Putty to SSH to the ESXi server itself and login as root
Navigate to the datastore path where the VMware virtual machine disk (.vmdk) is located.
cd /vmfs/volumes/<datastore name>/<vm name>
Make a backup copy of the .vmdk file, to be sure, just the descriptor file.
cp vmdiskname.vmdk vmdiskname-bak.vmdk
Need to edit the *.vmdk, which is the descriptor file, which contains the variables for the size of the *.-flat file. Using cat, this is what the descriptor file contains.
cat <vmdiskname>.vmdk
The number under the heading #Extent description defines size
e.g. 300GB = 300 X 1024 X 1024 X 1024 / 512 = 629145600
I wanted 100GB so… 100GB = 100 x 1024 x 1024 x 1024 / 512 = 209715200
Using vi, edited the descriptor file and changed the number.
Saved the file.
Exited out of SSH and started the VM.
Logged into Windows guest machine and opened Disk Management…Voila
Restarting the Management agents on ESXi
Problem: Restarting the Management agents on ESXi
Solution: To restart the management agents on ESXi:
From the Direct Console User Interface (DCUI):
Connect to the console of your ESXi host.
Press F2 to customize the system.
Log in as root.
Use the Up/Down arrows to navigate to Restart Management Agents.
Note: In ESXi 4.1 and ESXi 5.0, 5.1 and 5.5, this option is available under Troubleshooting Options.
Press Enter.
Press F11 to restart the services.
When the service has been restarted, press Enter.
Press Esc to log out of the system.
From the Local Console or SSH:
Log in to SSH or Local console as root.
Run these commands:
/etc/init.d/hostd restart
/etc/init.d/vpxa restart
Note: In ESXi 4.x, run this command to restart the vpxa agent:
service vmware-vpxa restart
Alternatively:
To reset the management network on a specific VMkernel interface, by default vmk0, run the command:
esxcli network ip interface set -e false -i vmk0; esxcli network ip interface set -e true -i vmk0
Note: Using a semicolon (;) between the two commands ensures the VMkernel interface is disabled and then re-enabled in succession. If the management interface is not running on vmk0, change the above command according to the VMkernel interface used.
To restart all management agents on the host, run the command:
services.sh restart
Symantec Backup 2012 Backups fail after upgrading from ESXi v5 to v5.1
Problem
Symantec Backup 2012 Backups fail after upgrading from v5 to v5.1
Explanation
Upgraded our vCentre & ESXi boxes from v5 to v5.1, then upgraded guests tools to latest version
vSphere:
Create virtual machine snapshot
Status: fault.ApplicationQuiesceFault.summary
Error Stack: The Guest OS has reported an error during quiescing. The error code was: 5 The error message was: ‘VssSyncStart’ operation failed: IDispatch error #8455 (0x080042307)
Windows Error Log:
Log Name: Application
Source: VMware Tools
Event ID: 1000
Level: Warning
User: SYSTEM
Description: [ warning] [vmvss:vmvss] CVmSnapshotRequestor::UnregisterProviderImpl():1878: failed to unregister provider, error 0x80042307 (I)
Solution
Instead of initiating an automatic VMware Tools upgrade I did it interactively and installing as “Standard” assuming that it would just “upgrade”, but it did a reinstall. This is what breaks the backup because if you have eg. a BackupExec VSS provider installed you cannot have another (VMware Tools) VSS provider on the same machine.
Try doing another interactive Tools upgrade, start the VMware Tools software installation and change the configuration by uninstalling the VMware Tools VSS provider only. Reboot the machine and there you go. Snapshot backups in BackupExec should always explicitly use the Microsoft Shadow Copy provider, my backups are right now running smoothly again.