VMware vCenter Backup and Restore

VMware vCenter Backup and Restore

The ADAM data is backed up every 5 minutes into the vCenter Server database. To backup the latest update of ADAM data, ensure that the VMware VirtualCenter Management Webservices service is running for at least 5 minutes before stopping the other vCenter services.

Backup

Stop the VMware VirtualCenter Service, VMwareVCMSDS, and the Database service.

Back-up the vCenter Server database.

This backup includes backing up ADAM information. For more information, see the vSphere Upgrade Guide.

Backup the SSL certificate folder at:

  • On Microsoft Windows 2003: %ALLUSERSPROFILE%\Application Data\VMware\VMware VirtualCenter
  • On Microsoft Windows Vista and Microsoft Windows 2008 Server: %ALLUSERSPROFILE%\VMWare\VMware VirtualCenter

Restore

Restore the database. For more information, see the vSphere Upgrade Guide.

Restore SSL certification.

Copy the backed up SSL certificate folder to the same path on the destination.

Create the folder if it does not already exist.

Prepare a DSN that points to the database.

Install vCenter Server 4 and connect it to the database during installation steps. ADAM information is restored by this process.(If vCenter Server 4 was installed on the target operating system to restore, you need to uninstall it prior to the restoration.)

EsxI Backup Configuration via PowerCLI

EsxI Backup Configuration via PowerCLI The following PowerCLI script will backup the configuration of your ESXi servers: $backpath = “C:\backups\” $eVMHs = Get-View -ViewType HostSystem |?{$_.config.product.ProductLineId -eq “embeddedEsx”} |?{$_.Runtime.ConnectionState -eq “connected”} Foreach ($eVMH in $eVMHs) {Set-VMHostFirmware -VMHost $VMH.name -BackupConfiguration -DestinationPath $backpath} To restore the configuration Step#1, put the ESXi host is maintenance mode, this is a requirement: set-VMHost -vmhost MyESXiHost -state Maintenance Step#2, restore the config bundle: Get-VMHost MyESXiHost | Set-VMHostFirmware -Restore -SourcePath C:\Temp\configBundle-MyESXiHost.tgz You can eventually add the -Force if the bundle is mismatched, that is when you restore to a different ESXi build.

ESXi – Deployment Steps for BL465c G7 / c-Class blades

ESXi : Deployment Guide

1)       If VMFS LUNs are presented, unpresent LUNs or remove Virtual Connect FC SAN configuration from the servers virtual connect profile. There is a risk these LUNs will be formatted during setup if this is not completed.

 If this is a rebuild of an existing host, perform the following steps:

 1.       In Command View, find the VMware cluster “host” entry.

2.       Identify the pair of WWNs that relate to the host to be removed – cross-reference with fabric zones or Virtual Connect profile.

3.       In the example image, WWNs for EUVM06 have been circled. The entries are not always adjacent so take care!

4.       Click ‘Delete Port’ and choose the WWN from the pull down.

5.       Only 1 port can be deleted at a time.

 

 2)       Create new VC profile for the ESX server (NOTE you can copy an existing EUVM profile to save a lot of time)

 

Port 1 + 2 Multiple Network Configuration

Click the paper/pencil icon to access this screen

 

Port 3 + 4 Multiple Network Configuration

Click the paper/pencil icon to access this screen

         Port 5 + 6 Multiple Network Configuration

        

3)       Set BIOS Power Management Configuration:

a.       Reboot the server and enter the Rom Based Setup Utility (RBSU)

b.       Select Power Management Options

c.        Select HP Power Profile

d.       Select Maximum Performance

e.        Verify that HP Power regulator is now set to HP Static High Performance Mode

4)       Upgrade firmware:

a.       BIOS – mount BL465cG7_A19October2010 as a virtual USB driver and boot server.

b.       CNA – Boot from OneConnect-Flash-2.102.517.7.iso

c.        ILO – flash ILO3 via Web Interface using ilo3_115.bin

5)       Install ESXi 4.1 (HP OEM version) – The ISO file is HP-ESXi_41.iso

 

6)       Present VMFS LUNs / new data stores to ESXi host – via Command View. Note you will have to shutdown the ESXi server and re-enable the SAN Fabric connections on the servers Virtual Connect profile if these were disabled previously.

7)       Perform post-configuration requirements: (note there is no root password by default)

  • Set root password – use the configure password option in the ILO console
  • Set vmnic0 and vmnic1 as management NICS:

 

 

You will need to set the VLAN ID of the management network using the VLAN (optional) menu, set the VLAN to 120

 Set IP address, DNS servers, hostname (upper case hostname, lower case domain name)

 

 8)       Create forward and reverse DNS lookup records in Active Directory DNS for the new ESXi server (manual requirement for VMware HA to function correctly)

 9)       Enable SSH Tech Support Mode from ILO console

 

 

 10)   Modify hosts file, add entries for EUVCENTER01/02 both with IP 10.144.110.110, essential for VMHA. Login via SSH and enter the command vi /etc/hosts

 

 Press ‘i’ to insert new text and add the following lines:

 10.144.110.110 EUVCENTER01.domain.local EUVCENTER01

10.144.110.110 EUVCENTER02.domain.local EUVCENTER02

 

 Press Escape, then enter the following characters ‘:wq’ This will save the file and exit the text editor.

 11)   Import the new VM host into vCenter at the Datacenter level

 

 12)   Configure Time Server Settings, (per server). To access this console, login to the vCenter GUI, select a host and then select the configuration tab. Finally select the Time Configuration option.

 Click the Options button:

 Select NTP Settings

 

Click Add, and enter 10.44.90.1, then perform the same for 10.44.90.2:

 

 13)   Configure Distributed Switch Networking (as per Virtual Connect configuration)

 Adapters must be added to the dvSwitch as follows:

 

Vmnic0

Management/vMotion dvSwitch

Vmnic1

Management/vMotion dvSwitch

Vmnic2

Internal dvSwitch

Vmnic3

Internal dvSwitch

Vmnic4

Ecommerce dvSwitch

Vmnic5

Ecommerce dvSwitch

 To add host adapters to Distributed Switches browse to Home > Networking

 

 Expand the list of distributed switches:

 

 Referring to the table above we’ll now add the correct physical adapters to the distributed virtual switches. Right-click the distributed switch you wish to add the host to, in this case dvSwitch_Management/vMotion and select ‘Add host to vNetwork Distributed Switch…

 

 Select the host and then select the correct adapters for the Distributed Switch, then click Next

 

 You must migrate the vmk0 (management interface) to port group dvPortGroup_Internal_VLAN120 otherwise you will lose connectivity with the ESXi host, click the assign port group button:

 

 Select dvPortGroup_Internal_VLAN120 then click OK:

 

 Click Next

 

  Click Next

 

 Click Finish, wait for the task to finish – you can see the status in the task status window.

 

 14)   Now add the adapters to the Internal and Ecommerce distributed vSwitch, you do not need to migrate any vmk interfaces, just click next on this window.

 15)   In the Hosts and Clusters window select the new host, then the configuration tab, select Networking and finally vNetwork Distributed Switch. Click Manage Virtual Adapters

 

We must now define the vMotion and Fault Tolerance vmk interfaces (vmk1 vMotion and vmk2 FT)

The following configuration should be present when you have finished configuration at this stage:

  • vmk0 – VLAN120 – Management
  • vmk1 – VLAN121 – vMotion
  • vmk2 – VLAN122 – Fault Tolerance

 Click Add

 

Click Next

 

 Click Next

 

 Select the correct VLAN port group for the virtual adapter function (as per definitions above) then select the correct function for the virtual adapter; in this case VLAN 121 and vMotion, then click Next

 

 Enter an IP address for the correct VLAN, don’t change the Default Gateway, the host can only have a single default gateway. Finally click Next

 

Click Finish to apply the change

 

 Perform the same for vmk2 for VMware FT:

 

 Final configuration should be as follows:

 

16)   Ensure that the host can see all of the data stores, select the host, then the configuration tab and select Storage

 17)   Install patches/updates using the VMware vSphere CLI

Place host you wish to update in maintenance mode

 Copy the SVE-be2net-2.102.554.0-offline_bundle-347594.zip, hpq-esxi4.1uX-bundle-1.0a.zip and hp-nmi-bundle-1.1.02.zip files to your local C:\.

Using the vSphere CLI install the network driver update for the CAN, you’ll need to change the hostname:

    vihostupdate.pl –server server01 –install –bundle “C:\SVE-be2net-2.102.554.0-offline_bundle-347594.zip” –bulletin SVE-be2net-2.102.554.0

 Now copy the hp-esxi4.1uX-bundle-1.0a.zip and hp-nmi-bundle-1.1.02.zip files to c:\ then execute the following vSphere CLI commands:

vihostupdate.pl –server server01 –install –bundle “C:\hp-esxi4.1uX-bundle-1.0a.zip” –bulletin hpq-esxi4.1uX-bundle-1.0a

 vihostupdate.pl –server server01 –install –bundle “C:\hp-nmi-bundle-1.1.02.zip” –bulletin hp-nmi-driver-1.1.02

18)   For active/active storage (EVA8400) you must configure the multi-path options for the host.

 This can be completed in two ways, the easiest of which is using the VMWare PowerCLI

 Once installed, change the server name and use the following commands to configure the storage correctly on the new host:

connect-viserver euvcenter01

$vmhost = get-VMhost server01.domain.local

Get-VMHost $vmhost | Get-ScsiLun -CanonicalName “naa.6001438005*” | Where {$_.MultipathPolicy -ne “RoundRobin”}

Get-VMHost $vmhost | Get-ScsiLun -CanonicalName “naa.6001438005*” | Where {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “roundrobin”

Using the GIU, the same result can be achieved from the Hosts and Clusters tab, select the new host, select Configuration, then select Storage.

Right-click the VMFS datastore you wish to change the settings on and select properties, the click Manage Paths:

 

 You can view the current multipath selection mode; click the drop-down box to change this to Round Robin, once done click Change.

 

 You must complete this for every EVA8400 volume.

 You can verify the change in the host storage window:

 

 19.    Configure vMA logging; open an SSH connection to vma01.domain.local

                vifp addserver server01.domain.local

(You’ll be prompted for a password)

 

 Now setup logging for the new host:

vilogger enable –server euvm05.domain.local –numrotation 20 –maxfilesize 10 –collectionperiod 10

 

       Verify that logging is working for the server (all servers will be listed, just look for the new one):

 

20.    Configure ServersAlive Alerts for the new server.

21.    Add the server to the cluster (if applicable) – simply drag and drop via the Hosts and Clusters window.

ESXi : Clone SQL Server

ESXi : Clone SQL Server

When cloning an SQL VM guest you’ll find that the server itself is unaware of the change in hostname. This can be verified using the command:

SELECT @@SERVERNAME

If you find that your cloned SQL server displays the wrong @@servername use the following commands to fix it:

sp_dropserver ‘OLDSERVERNAME\INSTANCENAME’
go

sp_addserver ‘NEWSERVERNAME\INSTANCENAME’, local
go

Finally restart the SQL service using services.msc. verify the name has changed using the same command as above, SELECT @@SERVERNAME.

 

ESXi : Clone Windows 2008 R2

ESXi : Clone Windows 2008 R2

I ran into some issue recently when cloning an existing Windows 2008 R2 system, when manually using sysprep or using VMware to customise it I eventually ended up with the clone failing to boot with a C0000021C BSOD error.

The get around this I performed the following steps:

  1. Power off Source
  2. Change Windows 2008 R2 source type to Windows 2008 64-bit
  3. Clone VM
  4. Change source back to Windows 2008 R2 and power on
  5. Power on Clone allow to run sysprep
  6. Shutdown Clone
  7. Change clone to Windows 2008 R2

Don’t ask me why it works, it just does….

vSphere : Semi-automate Bulk Datastore Creation

vSphere : Semi-automate Bulk Datastore Creation

Use the following command to output new LUNs that are on the EVA8400 (these will not be set to RoundRobin):
Get-VMHost $vmhost | Get-ScsiLun -CanonicalName “naa.6001438005*” | Where {$_.MultipathPolicy -ne “RoundRobin”} | ft –autosize

Copy output to text file and then open with Excel as below, adding the CapacityGB, Name and LunID columns. Use the vCenter GUI to obtain LUN IDs that can then be translated into the correct name as per the your sites LUN/Datastore naming convention.

CanonicalName

ConsoleDeviceName

LunType

LunID

Name

CapacityMB

CapacityGB

MultipathPolicy

naa.6001438005deea3c0000900003030000

/vmfs/devices/disks/naa.6001438005deea3c0000900003030000

disk

9

EUVMCL01_8400_DS09

491520

480

MostRecentlyUsed

naa.6001438005deea3c00009000030f0000

/vmfs/devices/disks/naa.6001438005deea3c00009000030f0000

disk

13

EUVMCL01_8400_TEST_DS04

716800

700

MostRecentlyUsed

Save the new CSV file to C:\new_datastores.csv

Now create the script to perform the task, copy the text below into C:\storage_setup.ps1. Modify the text in RED to suit your environment:

$CSVFile = “C:\NewDisk.csv

$vmcluster = “vm cluster name

$vmhost = Get-VMHost “vmhost fqdn

write “Importing CSV: $($CSVFile)”

$CSV = Import-CSV $CSVFile

Foreach ($Item in $CSV){

$HostID = $Item.HostId

$LunID = $Item.LunID

$LunPath = $Item.CanonicalName

$Name = $Item.Name

Write “Creating: $($Name)…Path: $($LunPath) “

$vmhost | New-Datastore -Vmfs -Name “$($Name)” -Path “$($LunPath)” -BlockSizeMB 8

Write “Created, applying RoundRobin multipathing policy… for cluster: $($vmcluster) “

foreach ($vmhost in get-cluster $vmcluster| get-vmhost) {

write node: $($vmhost.Name)

Get-VMHost $vmhost | Get-ScsiLun -CanonicalName “$($LunPath)” | Where {$_.MultipathPolicy -ne “RoundRobin”} | Set-ScsiLun -MultipathPolicy “roundrobin”}

}

Open the vSphere PowrCLI and connect to your vCenter; connect-viserver vCentername

Now execute the new script saved above.

Finally, if you are using Enterprise Plus, use the vCenter GUI to set Storage IO Control, this is a drop down box that can be set across all hosts with one change per datastore.

vSphere : Converter Windows 2000 and vApp Issues

vSphere : P2V Windows 2000 and vApp Issues

In order to perform a Windows 2000 P2V you will be unable to use the most recent version of the VMWare converter. The last version to support Windows 2000 is 4.0.1 build-161434.

A big caveat with this version is that it does not support vApp’s as defined on vCenter. If you try to import to vCenter the converter will crash, the following event will be logged in the event log:

The VMware vCenter Converter Server service terminated unexpectedly.  It has done this 1 time(s).

On loading the converter application again you will receive an error:

VMware vCenter Converter Server is installed but not running. When Converter Server is not running you will not be able to connect to local server.
Do you want to start it now? 

The workaround for this issue is to connect directly to the/an ESX host instead of the vCenter.

The physical machine must be able to connect to the ESX host on ports 443 and 903 in order for the conversion to work.

vSphere : PowerCLI Create New VM

vSphere : PowerCLI Create New VM

The script below will semi-automate the creation of a new VM. Change the items in red to suit your environment.

$vmhost = Get-VMHost “hostname
$ds = Get-Datastore “datastore_name
$rp = get-resourcepool “pool_name

#Desired VM name

$vmname = “vm_name

New-VM -name $vmname -VMHost $vmhost -numcpu 2 -DiskMB 10240 -memoryMB 4096 -datastore $ds -guestID rhel5_64Guest -resourcepool $rp -cd -NetworkName dvPortGroup_Internal_VLAN110

To add an additional hard disk to the new VM:

Get-VM $vmname | New-HardDisk -CapacityKB (8*1gb/1024)

Alternative -guestID options:
windows7Server64Guest (2008 R2)
winNetEnterprise64Guest (2003 x64 Ent)