Saturday, 11 March 2017

Trace deleted virtual disk in VMware

Or, Tracing deleted VMDK files in VMware
Or, How to check who deleted the virtual disk of the virtual machine in VMware?

Descriptions: First thing first, Once you have deleted the virtual disk by selecting “Delete From Disk” option, VMware cant help you to get it back as they dont have any built-in recovery solution in VMware. You may consult data recovery vendors to check for any possibility of data restoration.

In common scenario, if the disk was deleted by someone else or it was done unknowingly, an administrator is always asked to trace the logs..

At first attempt, VMware administrators prefer to check the task and events of vSphere client which is very much useful in most of the cases but not for all the cases.

For example: If someone have deleted the disk of VM, modified RAM capacity, or Modified CPU capacity, vSphere will have almost similar kind of event for all these actions (like, Reconfigure Virtual Machine). In this case, you will not be able to understand at what stage HDD or deleted and at what stage CPU was updated.

In this article, we will see some available options to trace the logs more efficiently for deleted vmdks.

Steps: How to trace the logs for deleted VMDK?

1. Check for the Tasks and Events in vSphere Client for the affected Virtual Machine and note down the “Reconfigure” event details time stamps
2. Check for the associated Datastore from which the disk was deleted
3. Check for the Host on which this Virtual Machine was running when the Modify event was occurred.












SSH the Host in Putty and run the following commands sequencially

# ls -la
# cd vmfs/volumes
# ls -la
# cd Datastore
# ls -la
# cd VMName
# ls -la
# less vmware.log | less

Search for the logs:

1. (Destroying Virtual Dev for scsix:xxx vscsi=xxxx)
2. (DISKLIB-VMFS : ‘’vmfs/volumes/xxxx-xxxxx-xxxx-xxxx-VMName/VMName-Flat.VMDK” : Closed )





Above two highlighted events gives some clue about VMDK deletion. It was started from term “Destroying” and completed at term “Closed”.

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

Saturday, 25 February 2017

vCenter Server running out of space, vcenter_log.ldf consuming huge disk space

Or, vcenter_log.ldf consuming huge disk space on vCenter server.
Or, How to shrink vcenter_log.ldf database in vCenter server?
Or, How to release log file or .ldf file occupied space in SQL database?

Descriptions: Friends, this is a very common task for across all SQL Databases but in this article we will be exploring it in respect of vCenter server which is running on SQL database. You can shrink logs for any other databases as well by following the same steps but there may be some pros and cons for doing it according to applications for which it is being used and you should understand the risk of doing it.
In scenario of vCenter server, I don’t see any impact of shrinking of ldf database in my case.

Scenario: Your vCenter server is using SQL database and somehow the vcenter_log.ldf database file has occupied more than 90% of disk space on your server. Now you want to release the space occupied by the log files.

Prerequisites:
Admin rights on SQL database on which you are going to perform this action.
Please take backup of your database before performing shrink task


Reference Screenshot (too large log file before shrink):






Steps: shrinking .ldf database log files
Login to your vCenter server with Administrative privilege > Login to SQL Server using SQL Management Studio to access Databases > Navigate to your vCenter Server Database > Right Click on vCenter Database > Go to Properties

























Go to Options > Choose Simple under Recovery Model drop-down list > Click OK






















Once more right click on your vCenter Database > Go to Tasks > Select Shrink > Select Files





















In the General option, Choose Log under File Type drop-down list > Make sure filename_log is automatically populated under File Name drop-down option > Under Shrink Action, Select Release Unused Space > Click OK > Wait for Shrink action to be completed






















You are done. You can check your log file size, it should be appearing small in size. Also your disk space should be healthy now.

Reference screenshot (small log file after Shrink):








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

Saturday, 18 February 2017

Managing Guest OS, software or database inventory with VMware vSphere

Or, Way out to manage software inventory of Virtual Machine in VMware vSphere without any additional or third-party inventory tools
Or, Managing software inventory list of the Virtual machine without inventory tools

Description:  We understand that it is not possible or the priority for every small or mid-level company to have inventory tools to manage software inventory list of VMware infra Guest machines. Although, there are some free tools available in the market, but some companies may not be interested to have any kind of free tools even, due to security and compliance risks.

So what next? It's tough or easy, you have to manage the software inventory list of Virtual Machines.

The way out is to define Note and Folders for each virtual machines in your VMware Infrastructure, for their easy management for inventory or navigation purpose and then exporting the detailed report of all the VMs using PowerCLI.

This is a one-time job to write the Notes for each Virtual Machines and creating departmental or any relevant category based folders.

Once you have everything defined well as recommended, you would be able to see the VMs inventory report like below,





Based on my convenience, I have modified the yellowed columns manually after exporting it so that the report looks good and enough informative.

Here is the step-by-step instruction to achieve this requirement.

Let’s Prepare the VMware vSphere management console.

Step-1: Creating VMware Folders

Please create Department based or any relevant category based VM folders under your VMware Datacenter.

It may look like the below reference screenshot.













Step-2: Identifying and writing the notes for each Virtual Machines

Please Select the VMs one-by-one > go to Summary tab > Click on Edit under Annotations option > write your Software name/list in Notes section > Click OK to save the changes.














Step-3: Exporting the Virtual Machines report with VM Name, Guest OS, VM Folder, and Software Inventory Notes

Connect to your vCenter server using vSphere Power CLI > Type the command given below > Hit Enter to execute it

Get-VM | select Name, Guest, Folder, Notes | Export-CSV D:\test.csv

Updated: 24/02/2017

To add Info in the report like Datacenter etc.. you can use below command format:
Get-VM | select Name, Guest, Folder, Notes, @{N="Datacenter";E={Get-Datacenter -VM $_}} | Export-CSV D:\test.csv



Updated: 21/06/2018

To add info in the report like Guest IP address... you can use below command format
PowerCLI C:\> Get-VM | select VMHost, Name, Guest, Folder, Notes, @{N="Datacenter";E={Get-Datacenter -VM $_}}, @{N="IP Address";E={@($_.guest.IPAddress[0])}} | Export-CSV D:\test.csv


Note:  You should change the output file path from D:\test.csv to any other folder path suitable as per your scenario.

Once the command is completed, you will be able to see the report you have been looking for so far.

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

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..

Sunday, 5 February 2017

Configuring tape library with backup exec server

Or, Storage has not been configured for the Backup Exec Server
Or, Backup Exec Error: Storage has not been configured for the Backup Exec Server

Descriptions: In this article, we will see how to configure tape library with backup exec server. Also, the tape library configuration is required the same way when you are encountered with the error ‘storage has not been configured for the backup exec server’.

This is very common scenario where you have done all the backed stuff to make sure tape library is reachable to backup exec server but you forgot to configure the drives, which will be used with backup jobs.

Environment:
Backup Exec Server Version: Symantec Backup Exec 2012
Tape Library: IBM 3537 TL
Tape Library Drive: IBM ULT3580-TD4


Error Screenshot:






Resolution/Steps:

Open Backup Exec Server Console

Go to “Storage Tab” and the Click on “Configure Storage” Option as highlighted in below screenshot:









Select “Tape Storage” and Click “Next” as shown below












Now Select “Configure Robotic Library Partition” Option and click “Next “as shown below:














Select your “Robotic Library” and Click “Next” as shown below:












Now check mark on “Reconfigure Robotic Library Partition” and click “Next” as shown below:












Now you can configure your tape library storage partitions as you wish (I configured my library partitions as shown below for your reference) and Click “Next” > Click Ok if prompt












Now, library will configure partitions on it’s own, wait till the configurations completed successfully.

IMP Note: If you have some backup job scheduled with specific partitions, then you must check your all backup job and re-assign library partition to each backup job.

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.