I get a lot of questions of students and customers about resizing a virtual disk. This is the reason for this blog.
The following procedure will guide you step by step through the process of resizing (increasing) a disk of a virtual machine.
Before you make virtual hardware changes be sure you have taken a full backup of the virtual machine.
NOTE: If you do not want any troubles only increase the disk size. Decreasing can cause loss of data.
Increase Disk using diskpart
Step 1: Edit the virtual machine settings and increase the size of the disk (VMDK).
Step 2: Open the console of this virtual machine and start a command prompt.
Step 3: Start diskpart and execute following steps.
à this gives you a list of the available partitions
select volume x
à select the partition number you want to increase
à this will add the empty disk space into the partition.
Now the partition has increased in size.
NOTE: On Windows 2008 this can be done via the Device Manager / Storage, but I have seen some weird things like showing incorrect partition sizes.
Increase Disk using Third Party tool
Step 1: Be sure you have a boot image (ISO) of the Acronis Disk Director Tool that supports your guest OS.
Step 2: Boot your virtual machine using the boot image ISO. Use the ESC button during booting your virtual machine to activate the “one time boo menu”
Step 3: Select the partition you want to increase and right mouse click on it. Then select “Resize Volume”
Step 4: Increase the disk space of the selected partitions by decreasing the unallocated space to 0
Step 5: After increasing the partition you have to commit the changes.
Step 6: Now you need to reboot your virtual machine after disconnecting the boot image.
During a migration process from ESX to ESXi at a customer site we had a problem removing a server from the vCenter inventory.
We checked the permissions on this server and we saw that the user who wanted to remove the server was admin on datacenter level. Here the screen we got.
Knowing there is a PowerCLI command to remove a ESXi host from the vCenter, we walked that way with success.
I used this
PowerCLI script to remove this server from the inventory after moving the
server out of the cluster to the datacenter level.
Remove-VMHost “HostThatCannotBeRemovedViaGui” –confirm:$false
When you are using MS SQL Server in mixed mode, it is very important that you know your SA password.
There can be different reasons you lost the password
- Person who installed the SQL Server knows the password but has left the building.
- You did not write down the password in your password file
- Password file is lost
Steps to recover the SA password
Start SQL Server Configuration Manager
Stop the SQL services
Edit the properties of the SQL Service
Change the startup parameters of the SQL service by adding a –m; in front of the existing parameters
- Start the SQL services. These are now running in Single User Mode.
- Start CMD on tthe SQL server
Start the SQLCMD command. Now you will see following screen
Now we create a new user. Enter following commands
- CREATE LOGIN recovery WITH PASSWORD = ‘TopSecret 1’ (Remember SQL server has default strong password policy
- Now this user is created
Now we grant the user a SYSADMIN roles using the same SQLCMD window.
- sp_addsrvrolemember ‘recovery’, ‘sysadmin’
- Stop the SQL service again
Change the SQL service properties back to the default settings
- Start the SQL service again and use the new created login (recovery in my example)
Go via the security panel to the properties and change the password of the SA account.
- Now write down the new SA password.
When you use convertor to migrate a physical machine to a virtual machine you get a BusLogic Controller as SCSI controller. Following is tested on vSphere 4.1 with a Virtual Machine hardware version 7
In the Virtual Machine Settings you see this.
In your device manager it is present as a VMware SCSI controller
If you want to change this to a LSI Logic SCSI controller because some application may need it like Trend Micro Deep Security – vShield, you have to follow steps below to get it working
Steps to convert
- Install the latest VMware Tools.
- Power down the Virtual Machine (try to use the shutdown so your OS is closed correctly.)
- Edit Settings of the Virtual Machine and add a new disk (can be small because this will be removed afterwards). We cannot add a new SCSI controller without adding a disk.
When you add a new disk select a different SCSI-id then the existing SCSI Controller. First number in the ID is the number of the SCSI controller.
When the disk is updated, the type of the SCSI controller must be changed.
- When the configuration is updated, you can restart the VM
In your device manager you now see 2 types of SCSI controllers
When you see the LSI logic SCSI controller you can shut down the VM again. Then will remove the just added disk and change the type of SCSI Controller 0
- When this is finished you can restart the Virtual Machine
- After starting the Virtual Machine you see that new hardware is found, now you need to reboot once more. (Last time to reboot).
Now for best practices you need to remove all unused devices in you device manager. Therefor you need to start device manager using a special set parameter.
- set devmgr_show_nonpresent_devices=1
If you now select the SCSI and RAID Controllers, you will see some grayed-out devices. These devices should be uninstalled
- Now you are done.
I have done a lot of migration to VMware vSphere 4.1. Everytime I bumb into the same issue: When I open a Console to a Virtual Machine and want to copy / paste some info into the Virtual Machine, it does not work anymore.
This because in vSphere 4.1 VMware has introducted one of the setting out of the Security Hardening guide for vSphere 4.0. There ore 2 ways to bypass these settings:
- Use a RDP connection instead of a VMware Console connection to your Windows Machines and then the copy / paste still works (this is a best practice)
- Change the settings so copy / paste is allowed again. Read this VMware KB Article
During some consultancy projects @ SMB customers where we needed to install and configure VMware VDR to do some backups, we had some issues with Windows Machines and VSS. The result of the these errors with VSS was that the VDR backup jobs all failed.
Here some possible solutions (gonna try to keep the list up to date.)
- VSS could not be started on a Windows 2003 server
We had to reregister all VSS DLL’s, restart the server and everything was working again. (check this)
VMware KB Articles about possible VDR / VSS issues.
Because VDR is taking snapshots of your virtual machines this can also be a interesing KB
Doing a P2V is very easy using the VMware Converter (Standard / Enterprise). But after the machine has been migrated the P2V is not yet finished, we need to do some extra stuff.
- Remove all hardware related software via add / remove programs (if possible) or disable the service.
- Old unused devices should be removed using device manager after setting a special SET parameter (set devmgr_show_nonpresent_devices=1). This can be done manually are using a script.
- Update virtual hardware settings (CPU / Memory)
- Enter the IP configuration on the new NIC. (Can be automated)
- Depending on the MS license you are using you maybe need to reactivate.
On of the things I almways try to do is to set the EQL LUN’s to Round Robin as Multi Pathing Policy.
- For Existing LUN’s use following PowerCLI script
- For NEW LUN’s
- Install VMware vCLI
- Go to the vCLI command line
- Execute following commandline (you need to enter the password)
esxcli –server SERVERFQDN –username root nmp satp setdefaultpsp –psp=VMW_PSP_RR –satp=VMW_SATP_EQL
–> now each new Equallogic LUN will have Round Robin as default multipathing policy
In my home lab I have a setup with has 1 VC VM and 2 ESXi hosts (Dell PowerEdge T410) which are connected to a Equallogic PS5000 SAN.
The VC and the VC database are both on a different VM.
While I was debugging a powerCLI script for a customer I noticed that my vCenter Service stopped working (and tried to restart automaticaly) without success.
In the Eventviewer I saw following errors:
- In the System Log
The VMware VirtualCenter Server service terminated unexpectedly. It has done this 1 time(s). The following corrective action will be taken in 300000 milliseconds: Restart the service.
- In the Application Log
An unrecoverable problem has occurred, stopping the VMware VirtualCenter service. Error: Error[VdbODBCError] (-1) “ODBC error: (42000) – [Microsoft][SQL Native Client][SQL Server]The transaction log for database ‘VC’ is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases” is returned when executing SQL statement “UPDATE VPX_DATASTORE WITH (ROWLOCK) SET NAME = ? , STORAGE_URL = ? , CAPACITY = ? , FREE_SPACE = ? , TYPE = ? , DATACENTER_ID = ? , IORM_ENABLED = ? , IORM_CONGESTION_THRESHOLD = ? WHERE ID = ?”
- In the C:\Users\All Users\VMware\VMware VirtualCenter\Logs I saw erros like “Connection refused”
The answer to all this was lack of space on the drive the vCenter database was located. This because SQL Recovery option on the vCenter database was set to “Full Recovery” and there was NO maintenance plan active. This was the cause of a growing LOG file. After running the maintenance plan the log was emptied and a lot of disk space became available.