Monday, 11 April 2016

Reducing the size of the VMware Virtual Machine Disk

Reducing the size of the VMware Virtual Machine Disk (VMDK)


Login and connect to the VMware vSphere Host ESXi server which hosts the virtual machine.

Power OFF the Virtual Machine, and change to the datastore path where the VMware virtual machine disk (VMDK) is located.

cd /vmfs/volumes/<datastore name>/<VM foldername>
VM Folder PathWe need to edit the *.vmdk, which is the descriptor file, which contains the variables for the size of the *.-flat.vmdk. Using cat, this is what the descriptor file contains
VMDK Descriptor fileThe number highlighted above, under the heading #Extent description, after the letters RW, defines the size of the VMware virtual disk (VMDK).

this number - 83886080, and it's calculated as follows:

40 GB = 40 * 1024 * 1024 * 1024 / 512  =  83886080

We wanted to reduce the size of the VMware virtual machine disk (VMDK) from 40 GB to 20 GB. So the value we need to enter into the descriptor file is:-

20 GB = 20 * 1024 * 1024 * 1024 / 512  =  41943040

Using vi, edit the descriptor file, and change the number from 83886080 to 41943040, and save the file.
VMDK Edited with viMigrate or Copy the virtual machine to another datastore.

After the virtual machine disk (VMDK) has been moved, you will notice the disk size reflects the desired size of 20GB.
Size of virtual disk, as viewed from vSphere ClientSize of virtual disk as viewed from consoleAfter restarting the virtual machine, and checking with Disk Management, you will notice the 19.5GB unallocated storage space, has been removed, and disappeared.
Size of virtual disk as viewed from Disk Management in the OS
you have successfully Shrunk a VMware Virtual Machine Disk (VMDK)

Tuesday, 15 December 2015

Unable to configure replication for virtual machine VM_name because group group_name cannot be created. Another virtual machine configured_VM_name}' that has the same instance UUID instance_UUID already exists on protection site source_site_name.

Problem


The other site contains old information in the database, and prevents you from configuring  replications. You might see the following error message:

Unable to configure replication for virtual machine VM_name because group group_name cannot be created.
Another virtual machine configured_VM_name}' that has the same instance UUID instance_UUID already exists on protection site source_site_name.

Solution:

1. Login (SSH) Recovery Site vSphere Replication Appliance.

2. Go to cd /opt/vmware/vpostgres/9.3/bin

3. Take backup of DB ./pg_dump -U vrmsdb -Fp -c > /tmp/DBBackup.bak

4. login on DB ./psql -U vrmsdb

5. Open replciation VMs inventory table.
SELECT a.group_movalue AS "SECONDARY GID", b.name AS "VM Name", 'https://' || c.address || ':8043/mob/?moid=' || a.group_movalue || '&vmodl=1' AS "Link to Paste" FROM secondaryvirtualmachineentity a, virtualmachineentity b, localserverentity c WHERE a.movalue = b.movalue ORDER BY name;

6. Search for VM, which is occurring issue and copy Link to Paste URL of that VM (MOB). which will look like 
https://VRMS_IP:8043/mob/?moid=GID-87ae29b2-485f-4fd4-a19b-f5566c87e5
8b&vmodl=1
7. Now open this link in the browser.
8. Click on destroy in this list.
9. And new window click on Invoke Method.
10. Now go ahead and configure replication for that VM.

Friday, 15 May 2015

Configure SNMP for ESXi through SSH

Configure SNMP for ESXi through SSH

esxcli system snmp set --communities public

esxcli system snmp set --targets **IP SNMP SERVER*****@Port No/public

esxcli system snmp set --enable true

esxcli system snmp test

esxcli system snmp get

Cluster warning for ESXi SSH disable Command line

Cluster warning for ESXi SSH disable Command line

To disable SSH and warning using SSH:

vim-cmd hostsvc/advopt/update UserVars.SuppressShellWarning long 1


To enable SSH and warning using SSH:

vim-cmd hostsvc/advopt/update UserVars.SuppressShellWarning long 0