Showing posts with label VMware. Show all posts
Showing posts with label VMware. Show all posts

Friday 17 February 2017

Multiple Virtual Machines snapshot using CSV file input and vSphere PowerCLI

Or, How to take snapshot of multiple VMs from CSV file VMs list?
Or, Import-CSV VMs snapshot using vSphere PowerCLI
Or, Taking snapshot of multiple VMs listed in CSV file

Descriptions: In my previous article, I explained how you could perform snapshot of multiple Virtual Machines using vSphere PowerCLI, but in that article, we just did the listing on VMs on the CLI console itself.

Now, in this article the approach of listing Virtual Machines is changed. We will use a CSV or excel file to import the list of VMs and then will perform snapshot on those VMs with vSphere PowerCLI.

Prerequisites:
1. List of VMs written in CSV file in the given/supported format
2. VMware vSphere PowerCLI

Preparing the CSV file:

In the CSV file, write the name of Virtual Machines in sequence under “Name” column as shown below:













Note: My CSV file contains two Virtual Machines (VM-1 and VM-2). You can add more VMs name as per your requirement.


Steps:
Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

Import-Csv D:\VMsList.csv | %{Get-VM $_.Name} | New-Snapshot -Name TestSnapshot -Description TestDescriptions


IMP Note: Change the following as per your convenience

Path: D:\VMsList.CSV (Change it to your CSV file path)
Name: TestSnapshot (Change the name of the snapshot as per your requirement)
Description: TestDescriptions (Change the description as per your requirement)

Once the command is completed, it should look like below:










Do not worry about the yellow warning appearing below the command. Snapshots of the virtual machines covered in the CSV file already initiated.





Cheers, please write me back if you have any query or feedback on this.

Thursday 16 February 2017

Taking multiple VMs snapshot – VMware vSphere PowerCLI

Or, How to create multiple VMs snapshot?
Or, How to take snapshot of multiple VMs at once?
Or, Command for taking multiple VMs snapshot.
Or, Taking snapshot of multiple VMs at once.

Descriptions: When you think of snapshot of virtual machines, its easy if you are doing it for one or two machines but its easiest when you thinking to do it for multiple VMs, may be 10-20 or more VMs. Yeah, correct, its was not a typo. J Its even easiest to take snapshot of multiple virtual machines.

The only thing you need is, VMware vSphere PowerCLI.

There are two methods that I use frequently for taking snapshot of multiple virtual machines:

1. Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet
2. Typing VMs name manually and then using New-Snapshot cmdlet

Let’s see how?

Steps (Method-1): Setting up $VMs parameter pointing to the list of virtual machines and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

$VMs = Get-VM VM1, VM2, VM3, VM4


Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).



Now, run the below command and hit enter to start the snapshot process:

New-Snapshot -VM $VMs -Name NameOfSnsphot -Description DescriptionOfSnapshot






That’s it, all VMs (VM1, VM2, VM3, and VM4), now would be having a snapshot.

Steps (Method-2): Typing VMs name manually and then using New-Snapshot cmdlet

Open vSphere PowerCLI > Connect to your vCenter server > Type the command given below and hit enter:

New-Snapshot -VM VM1, VM2, VM3, VM4 -Name NameOfSnsphot -Description DescriptionOfSnapshot

Note: replace VM1, VM2, VM3, and VM4 with your Virtual Machines name. You can add more VMs name here after coma (,).







Cheers, Please write me back if you have any query or feedback..

Saturday 4 February 2017

Virtual Machines name, snapshot name, and snapshot descriptions export to CSV file –VMware vSphere PowerCLI

Or, Virtual Machines snapshot report export to csv file using VMware vSphere PowerCLI.
Or, Finding Virtual Machines with snapshot details using VMware vSphere PowerCLI.
Or, vSphere PowerCLI command to get VMs list with snapshot name and descriptions.

Descriptions: Remember the storage optimization task?, the very first thing we do is we check for the VMs having snapshot. Sometime we end up with having few VMs with very large snapshot data size.

If you have 10-20 VMs, its easy for you to check each VMs individually to see which are the VMs having snapshot but what if you have 100 or 1000 VMs?? Its not possible or even not a wise decision to check each and every VMs individually for this reason.

Therefore, here you have some cool stuffs to do in vSphere PowerCLI. Just few sequential command arrangements and you are done. You can have the list of VMs having snapshot on the CLI dashboard or you can choose to export the list of such VMs in CSV file.…

Steps: Connecting vCenter Server with vSphere Power CLI
Open vSphere PowerCLI > Type the command below and hit enter

Connect-VIServer IPAddressOfvCenterServer












Enter the vCenter Server credentials and say OK (in my case the user name is ‘administrator@vsphere.local)’





















Steps: Getting VMs list with snapshot details on vSphere CLI dashboard
Once you connected successfully with your vCenter server, type the command below and hit enter. Now you will have the VMs List, Snapshot Name Details, and Snapshots Descriptions details as highlighted in below screenshot.

Get-VM | Get-Snapshot | select VM, Name, Description













Steps: Exporting VMs list report with snapshot details in CSV file
To export the VMs list with snapshot details in a CSV file, type the below command and hit enter

Get-VM | Get-Snapshot | select VM, Name, Description | Export-Csv D:\temp\testreport.csv






Note: Please change the Export CSV path to your preferred folder path.

Upon successful completion of the command, you would be having csv report details like below:





Updated 4th Feb 2017
You can try few more commands as given below for detailed report:

To get VM list with VM Name, Snapshot Name, Snapshot Description, Snapshot Creation Date
Get-VM | Get-Snapshot | select VM, Name, Description, Created

To get VM list with VM Name, Snapshot Name, Snapshot Description, Snapshot Creation Date, Snapshot Size in GB
Get-VM | Get-Snapshot | select VM, Name, Description, Created, SizeGB

Cheers, please write me back if you have any query or feedback.

Friday 20 January 2017

Increasing/reducing RAM and CPU capacity of a VM after taking snapshot.

Or, is it possible to increase RAM/CPU capacity of a VM after taking snapshot?
Or, is it possible to reduce RAM/CPU capacity of a VM after taking snapshot?

Descriptions: If wondering whether CPU/RAM capacity of a virtual machine can be increased/reduced or not, the answer is Yes. You can reduce or increase the Memory as well as CPU capacity of a VM even after taking snapshot of the VM.

Logically, when you take snapshot of the Virtual Machine, the CPU and Memory state of the Virtual Machine get preserved. Means, no matter whether you want to increase or decrease the CPU/RAM capacity of the VM, whenever you will revert the snapshot the earlier configurations and status will be restored.

Test Case: When I tested this concept in my lab environment, I found that I am able to change the CPU and RAM configurations (increase or decrease) after taking snapshot of the Virtual Machine. When reverting the snapshot, the original status of the Virtual Machine is enforced.

No, No, No, you can’t increase or decrease drive capacity of any Virtual Machine after taking snapshot. J


Cheers, Please write me back if you have any query or feedback.

Thursday 19 January 2017

Step by step guide for installing ESXi 6.0

Or, How to install VMware ESXi 6.0
Or, Installing VMware ESXi 6.0

Descriptions: Its not a big deal for experienced VMware administrators to install or upgrade ESXi server with any of the installation/upgrade methods but for friends who have just begin learning VMware, they may need to have a look at steps and options available to perform ESXi installation.

Yes, there are many ways of doing it, you can choose to do it with ISO if you have KVM supported on your hardware host, you can do it using VMware Update Manager, you can do it using CD/DVD drive attached with the physical hots etc..

In my scenario, I am using my lab environment to show you what all are the steps are there to complete the ESXi installation.

Steps: (installing ESXi hypervisor).

Boot your server with VMware ESXi 6.0 OS Disk or ISO image (in my case, I have VMware ESXi 6.0 Custom CISCO Installer) > Select the OS and hit Enter > Wait for the progress bar to be completed.













Hit Enter to continue when asked














Press F11 to accept the license terms and continue















Select the Installation storage/local storage and Hit Enter to continue















Select the desired language and hit Enter to continue
















Press F11 to start the Installation













Wait for installation to be completed













Upon successful ESXi host installation, you may receive below message. Hit Enter to reboot the server.















After the reboot completion, you should be getting ESXi 6.0 DCUI like below. From this window onward, you can do the ESXi configuration you wish e.g. network, DNS etc configurations.













Cheers, Please write me back if you have any query of feedback on this..

Wednesday 18 January 2017

VMware converter tool error “The File System On "Datastore1" Does Not Support File This Large. Please Check the File System Block Size.”

Or, P2V conversion error “the file system on datastore1 does not support file this large. please check the file system block size.”

Descriptions: This error was encountered while performing P2V conversion of a Physical server containing large storage capacity (more than 6-7 TB of drive capacity).

The error screenshot (how it looks like):









Possible reasons of this error:
1. One of the volume size on this server is more than 2TB (Here I am referring to whole Volume Size of one of the RAID volume configured in this server on hardware level).

Example:  It’s possible that one of the RAID volume on your physical server is having 4TB of total capacity. This 3TB RAID volume may have multiple logical disk partitions inside the OS e.g. D, E, F etc…).

2. The VMware Converter tool you are using is not the latest one as per your VMware vSphere Infra.

Solution/Workaround:
1. Use latest version of VMware Converter tool.
2. Instead of default option, use Advance Feature of Data Copy Type Selection
3. Use only occupied disk conversion method selection. To do this, you can edit data copy option (shown in error screenshot) and choose only occupied disk. Don’t be afraid, you can easily increase the partitions size once this physical machine is converted in Virtual Machine.

Cheers, if you have any query or feedback, please write me back...

VM shutdown when performing snapshot restore in VMware vSphere.

Or, VM shutdown automatically when restoring to previous snapshot restore point.

Descriptions: This not an error… Its normal behaviour of Virtual Machine snapshot restoration feature. Depending upon the state when the snapshot was taken, virtual machine will go to that state while performing the snapshot restore.

Example-1: If the Virtual Machine is Powered On and you have taken a snapshot in this state, this is not going to reboot or shutdown the VM when you perform the Revert Snapshot task from Snapshot manager.

Example-2: If you the Virtual Machine is Powered Off and you have taken a snapshot in this state, this is going to shutdown the Virtual Machine when you perform the Revert Snapshot task from snapshot manager.


Note: No worries, in both conditions you should be able to get your VM up and running. If the VM get powered off while performing the snapshot restore, you can just power it on soon after the snapshot restore operation is completed successfully.

Cheers, If you have any query of feedback on this, please write me back..

Tuesday 17 January 2017

Understanding, Zeroing, Lazy Zeroed, Eager Zeroed, and Thin Provision concepts in VMware vSphere.

Or, VMware Disk Provisioning Concepts about Lazy Zeroed, Eager Zeroed and Thin Provision.
Or, Lazy Zero Vs Eager Zero Disk Provisioning.
Or, Difference between Thick Provision Lazy Zeroed, Thick Provision Eager Zeroed, and Thin Provision Disk Provisioning.

Zeroing
Before the VM can actually use the allocated drive space, there are some operations that take place on ESXi host level. When you allocate a disk space from your Datastore, Datastore also maintain itself to allocate that amount of Disk space with clean/formatted sectors.

This disk sectors cleaning process is basically referred as Zeroing term. As you do disk formatting at Guest level to make it ready to use, the same task is performed by ESXi Host at Datastore level when you add any partition/disk to a VM from any Datastore.






Thin Provisioned Disk: Allocate and zeroed on first write. When you create a disk with thin provisioning method, it only writes a small amount of metadata to the Datastore where it resides. When the write operation is performed, vSphere first updates the allocation metadata of the VMDK, then zeros out the blocks, lastly it writes the data. Thin provisioned VMDKs have the lowest performance logically at some points.

Once the Zeroing is completed for allocated disk blocks, almost all disk types performs equally.

Thick Provisioned Lazy Zeroed Disk: Allocate in advance and zero on first write. Do nothing to empty blocks, it zeros all the blocks at first access... Provisioning of this disk type is little faster than other disk type. Performance of this disk type is slower than Eager Zeroed Disk type and it is not supported for clustering.

Example: If you have 10GB disk size and having only 5GB data in it, then 5GB will be zeroed at first access, rest 5GB will be left.

Thick Provisioned Eager Zeroed Disk: Allocate and zero in advance. Writes 0 to empty blocks. Write is performed on whole allocated disk.  Means, its pre-zeroing all the blocks on the disk. Performance of this disk type is better than all others but provisioning time may take little longer than other disk types. 
It also supports clustering features.

Example: If you have 10GB disk size and have only 5GB Data in it, then 5GB will be used and rest 5GB will be written with 0. No further Zeroing is required while any write operations.

Cheers, Please write me back if you have any query or feedback on this..

Sunday 15 January 2017

Understanding Thick Provisioning and Thin Provisioning in VMware

Or, Difference between Thick Provisioning and Thin Provisioning in VMware
Or, How Think Provisioning and Thin Provisioning works in VMware

Descriptions: Thin Provisioning disk allocation method in VMware vSphere is one of the cool feature to use your storage to a limit beyond the storage capacity limit… There are some pros and cons of each provisioning method whether it is Thick or Thin but it’s all depends on your requirement and criticality of servers and how you want to use it.

e.g. For database servers, I rarely think of allocating Thin Provisioned Disk. Because, Database log files and even Database can increase anytime drastically and if you don’t have enough free space on the respective Datastore, This VM will go in Answer mode (its equal to down till the time you fix it).

Thick Provisioning: This provisioning refer to disk provisioning method where all the allocated disk space is occupied by the Virtual Machine.

Example: When you allocate 40GB drive space to a Virtual Machine with thick provisioning method, it reserves all 40GB allocated disk space from your Datastore. Even if the VM is having 10GB of data inside that drive, it will take complete 40GB space from the associated Datastore. There are further two type of thick provisioning, Lazy Zeroed and Eager Zeroed.

Thin Provisioning: This provisioning method refers to disk provisioning method where only used space is occupied by the Virtual Machine.

Example: When you allocate 40GB drive space to a virtual machine with thin provisioning, it does not reserve the complete 40GB allocated disk space from your Datastore. If your VM is using only 10GB of out of 40GB allocated drive space, then thin provisioning helps remaining free 20GB disk space to be released from that particular VM. Means, no matter how much drive space you have allocated for your VM, it will utilize only what it required.

You can try it by assigning 40GB drive space with Thin Provisioning method to any VM even if you have 30GB of drive space free in your Datastore. It will allow you to do so.

Reference screenshot-1: I have 20GB free space in Datastore and adding a Disk with 40GB capacity to my Test-VM-1 with Thick Provisioning Method.














If you will dare to go with this option, you are going to end up with below error.














Reference Screenshot-2: I have 20GB free space in Datastore and adding a Disk with 40GB capacity to my Test-VM-1 with Thin Provisioning Method.














 Cheers, please write me back if you have any query or feedback on this…

Saturday 14 January 2017

How Limit, Shares and Reservation works in VMware?

Or, Understanding Limit, Reservation and Shares in VMware.
Or, How to use VMware Virtual Machine’s resources features Limit, Shares and Reservations

Descriptions: For small VMware Infrastructure, these features may not be so important to consider but in large scale VMware Infrastructures these features play very crucial roles in managing different type of Servers and applications depending on their nature criticality and availability commitments.

Virtualization is a platform where we forget about most of limitations that exist at hardware level, but it means not that we should forget about limitations of Virtualization.

In Virtualization, we over provision the resources being it CPU or RAM and just to keep your critical applications and servers safe from over provisioning caused contention scenarios, these features of resources allocation come in to the picture.

Let’s see this example below:




In the above, example you have One ESXi Server, with 40 Logical CPUs after enabling HT on the Physical CPU and you have 20 Virtual Machines each having 4 vCPUs allocated. So, now if you will calculate the total allocation of vCPUs, its 20*4=80. Imagine, you have only 40 logical CPUs at ESXi Host level but you have allocated just double number of vCPUs to your Virtual Machines.

Its real that, all of these Virtual Machines will work well as per the Virtualization concept, but the Situation will be just opposite if in case at any point of time, all VMs demand their complete allocations. ESXi host going to be dead due to contentions.. J

So, here my friends you still have a chance to keep your CRITICAL VMs alive if this situation occurs in your environment. Yes, you are right... You have to use the Reservation, Shares and Limit features here…

Let’s see how…….

Limit: Limit means Limit...that a Virtual Machine can be entitled for. You can define limit at both CPU or Memory level. Memory limit defines the maximum capacity of physical memory that a Virtual Machine can use. Same way, CPU limits defines the maximum capacity of CPU can be used by a VM.

Memory Limit: Be careful while settings up memory limit as setting it up wrongly may drastically decrease the performance of the Virtual Machine.

Example: If you have allocated 8GB RAM to a VM, and have set the limit of 4GB, this VM is going to give you very slow performance as it will not be able to get required resources when in need.  Inside Guest OS, its 8GB RAM but on top of it its only 4GB what ESXi will allow this VM to use.
Now, this VM will create ballooning and multiple vMotions among available hosts.

CPU Limit: Likewise, RAM limit, CPU limits also limits the CPU resources that a VM can use. Even if the Resources are available on the base ESXi host, the Virtual Machines sets with certain limits can’t go beyond the defined limit for them. In some cases, its useful but in most of the cases ESXi is intelligent enough to manage how much resources should be given to which VMs.

You can use this method more practically on Development of Test Servers where you may need to assign more CPU account to a VM but can limit the usage of allocated CPUs when work test/development is done.

Share: By default, Shares are equally distributed among Virtual Machines. The reason shares are equally distributed is, VMware does not know which Virtual Machine is important for you. So, it treated all your Virtual Machines equally important.. J
Shares defines, which Virtual Machine is going to have priority to be kept alive with enough resource allocation in any kind of contentions in VMware Infrastructure.

Example: If you have two VMs (VM-1 and VM-2) and both having shares value 1000, means the ESXi host will allow both of them to use 50% of available resources in case of any contention.
If there is no contention and no VMs are struggling for resources, no shares will come in to the picture. Shares are to prioritize the VMs resources availability in case of resources crunch.

Let’s see the below calculations, how shares will work in case of contentions if two VMs are struggling for resources on the same ESXi Host.











Reservations: Reservation defines the amount of resources that remains reserved forever for the Virtual Machine. This is majorly used in most CRITICAL VMs where you can’t compromise to slow down the performance of the Virtual Machine in any case.

Reservation helps a VM to reserve the specified amount or resources whether it’s being used or not. Even if contention situation pop-ups, the Virtual Machine will be having its reserved resources.

Example: If you have a VM with 8GB memory and you have set the reservation of 4GB, This VM will reserve 4GB memory always. When contention occurs, this VM will have at least 4GB of memory to ensure the applications in this server are having enough compute to perform well.

If there is no contention and this VM requires 8GB of memory, it can use it. Because, the allocated memory size of the Virtual Machine is 8GB.

Cheers, please write me back if you have any query or feedback on this...

VMware vSphere Comparisons 5.5 vs 6.0 vs 6.5 vs 6.7 at one place

Or, What all are the major capacity supporting changes or enhancements across VMware vSphere 5.5, 6.0, 6.5, and 6.7.
Or, Major maximums differences of VMware vSphere 5.5, 6.0, 6.5, and 6.7

Descriptions: As the new release 6.7 of VMware vSphere is out in the market, it’s important for you to check out what all are the major capacity support enhancements or changes are done in this release before you think of upgrading your current ESXi Infra to any of the next releases.

In this article, I will take through some major difference within vSphere version 5.5, 6.0, 6.5, and 6.7. This article is focused on checking out capacity enhancement/maximums and not covering other enhancements and features which may be ESXi OS level, Graphics or etc... I tried consolidating some data points from all datasheets of vSphere Maximums which really effects each level of VM Infra.


Here are the comparisons

Updated: 02/05/2017
There may be some further maximum and minimum supported capacity of ESXi hosts and other VMware components. To know more in-depth and explore all possible segregation of supported capacity limits, please refer the below VMware KB:
https://kb.vmware.com/1003497

Updated: 02/01/2019
Added vSphere 6.7 in the list of comparison.

Cheers, please write me back if you have any query or feedback on this…

Thursday 12 January 2017

Understanding and performing P2V or V2V Conversion in VMware?

Or, How to convert a Physical Machine to a Virtual Machine?
Or, How to do V2V or P2V migration of a Virtual Machine?

Descriptions: One of the best loving feature of VMware is, converting Physical Machine to a Virtual Machine or Converting Virtual Machine to Virtual Machine (V2V migration required rarely in some tricky situation). I mentioned it here because, you should not be surprised when someone asks “Can you do V2V conversion?” ….

Scenario-1: (P2V): It is required when you are going to convert your physical server in to a Virtual Machine due to business requirements (may be you don’t have much memory available on the physical box and want to allocate more memory capacity to the server to full fill the application’s demand for better performance, etc…). In this situation you simply convert your physical machine to a Virtual Machine and add resources as much as you can (subjected to maximum supported capacity by the OS and availability of resources on the ESXi host). No need to worry of a long procurement process of additional hardware capacity… 

Scenario-2: (V2V): Guys this is something you are going to says, hmmmm…. See, decreasing Drive Capacity of a Virtual Machine is not supported by VMware. Means, if you have allocated 500GB disk space to a VM’s drive D:\, you can’t decrease it to 200GB latter... Off course, if you want to increase the drive’s capacity from 500GB to 600GB, its 4-5 clicks of job...

This is where the V2V trick works like charm. Yes, by using V2V conversion method you can decrease the Drive capacity of a Virtual Machine. It’s easy but needs downtime.
All the steps for performing V2V will be almost same like P2V. Here in V2V, you need to select the Powered On Virtual Machine option instead of Local Machine.

See Also:

Steps: P2V conversion in VMware

Install VMware vCenter Converter Standalone Client on your Physical Machine which to be converted to a Virtual Machine.

Open Console of VMware vCenter Converter Standalone Client.









Go to File > New > Convert Machine
















Select Source Type: Powered-on Machine > Check on This Local Machine (means your local physical machine to be converted to a VM) > Click Next

















Now as shown in below screenshot, select Destination Type: VMware Infrastructure Virtual Machine > Fill required credentials and IP of your ESXi Host Server > Server- ESXi server IP > User Name- ESXi Server User Name (root) > Password- ESXi server root password > Click Next...



















Click on Ignore to ignore certificate warning message > Click Next






















Verify if the Source and Destination are correct > Hit Next

















Select desired Datastore and Virtual Machine Version > Hit Next

















If no errors on this page hit Next to Continue….














Click Next….


















Click Finish….




















P2V Conversion will start now…and the screen will appear like this (as highlighted below).


















Wait till the time this P2V Conversion process is completed successfully. 

Please Note, it may take longer depending on your physical machine storage and data size. Once its completed, you can shutdown your physical machine and power on the Virtual Machine.

Wohoo, enjoy the virtualization now...

Cheers, If you have any query or feedback on this, please write me back..

VMware tool Installation Error 2203 on windows server 2008 R2

Or, VMware tools installation failed with ‘internal error 2203’.
Or, Error 2203 while installing VMware tool, Installation Error 2203.

Descriptions: If you have tried too many random KBs and still struggling with this small issue, you must give a try to the solution explained in this KB.

In my case, the cause of the problem was, Program Files directory’s permission was not inherited to its parent folder and the current user I am logged in with is not having any permission on ‘VMware Tool’ folder.

Steps: workaround to get rid of this error.
1. Navigate to C:\Program Files\VMware
2. Assign Full Permission to Everyone on "VMware Tool" folder or assign Full Permission 3. to the current user with which you are logged in on the windows machine.
4. Assign Full Permission to Everyone on "Windows\Temp" folder.
5. Once the above trick steps completed, take a reboot of the machine and then you can proceed to initiate the VMware Tool Installation again.

Cheers. Please write me back if you have any query of feedback..