Skip to content

Patch vSphere from SSH

August 8, 2017
tags:

Download ZIP from https://my.vmware.com/group/vmware/patch#search

Upload to datastore

from SSH: # esxcli software vib update -d “/vmfs/volumes/datastore1/patch-directory/ESXi500-201111001.zip”

vCenter 6.0 free space

August 8, 2017
tags:

 

To work around this issue, decrease the maximum backup size and the maximum backup index in the log4j.properties file.
Note: In external Platform Service Controller (PSC) environments, log in to the Platform Service Controller instead.

  1. Log in to the vCenter Server Appliance or PSC console as root user.
  2. Run this command to enable access the Bash shell:

    shell.set –enabled true

  3. Type shell and press Enter.
  4. Navigate to this directory:

    cd /usr/lib/vmware-sso/vmware-sts/webapps/sts/WEB-INF/classes/

  5. Run this command to back up the log4j.properties file:

    cp log4j.properties log4j.properties.bak

  6. Open the  log4j.properties file using a text editor.
  7. Locate the  log4j.appender.LOGFILE.MaxFileSize and  log4j.appender.LOGFILE.MaxBackupIndex parameters after this entry:

    log4j.appender.LOGFILE.File=${catalina.base}/logs/vmware-identity-sts.log

  8. Change the value of parameters to 50 and 5 respectively:

    For example:

    log4j.appender.LOGFILE.MaxFileSize=50MB
    log4j.appender.LOGFILE.MaxBackupIndex=5

    Note: The default values are MaxFileSize=100MB and MaxBackupIndex=10.

  9. Locate the log4j.appender.PERFLOG.MaxBackupIndex parameter after this entry:

    log4j.appender.PERFLOG.File=${catalina.base}/logs/vmware-identity-sts-perf.log

  10. Change the value of parameter to 3.

    For example:

    log4j.appender.PERFLOG.MaxBackupIndex=3

    Note: The default value is MaxBackupIndex=10.

  11. Run this command to restart the STS service:

    service vmware-stsd restart

  12. Navigate to:

    cd /storage/log/vmware/sso/

  13. Remove the old localhost_access_log,vmware-identity-sts and  vmware-identity-sts-perf log files by running these commands:

    rm localhost_access_log.*
    rm vmware-identity-sts.*
    rm vmware-identity-sts-perf.*

    Note: Restart the STS service again for new log files to be created in the  /storage/log directory.

 

 

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2143565

du -h -d1 /storage/log/vmware/

vSphere backup

May 4, 2017
tags:

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2042141

Backup:

powerCLI

Connect-VIServer -Server 192.168.2.19 -User root -Password whatever
Get-VMHostFirmware -VMHost 192.168.2.19 -BackupConfiguration -DestinationPath f:\zip

 


Backing up ESXi host configuration data

Using the ESXi Command Line

To synchronize the configuration changed with persistent storage, run this command:

vim-cmd hostsvc/firmware/sync_config

To backup the configuration data for an ESXi host, run this command:
vim-cmd hostsvc/firmware/backup_config
Note: The command should output a URL in which a web browser may be used to download the file. The backup file is located in the /scratch/downloads directory as configBundle-HostFQDN.tgz

Restoring ESXi host configuration data

Using the ESXi Command Line:

Note: When restoring configuration data, the build number of the host must match the build number of the host on backup file and UUID (can be obtained using the command  “esxcfg-info -u”) of the host should match the UUID of the host on backup file.
Use numeric 1 as force option to override the UUID mismatch.
Example: vim-cmd hostsvc/firmware/restore_config 1 /tmp/configBundle.tgz

  1. Put the host into maintenance mode by running the command:

    vim-cmd hostsvc/maintenance_mode_enter

  2. Copy the backup configuration file to a location accessible by the host and run the command:

    In this case, the configuration file was copied to the host’s /tmp directory. For more information, see Using SCP to copy files to or from an ESX host (1918).

vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz
 
Note: Executing this command will initiate an automatic reboot of the host after command completion.

Update vSphere CLI

May 3, 2017
tags:

profile list – https://esxi-patches.v-front.de/ESXi-6.5.0.html

DBCC progress

March 16, 2017
tags:

SELECT
percent_complete,
start_time,
DATEADD(ms,estimated_completion_time,GETDATE()) AS EstimatedEndTime,
status,
command ,
total_elapsed_time AS elapsed_time_ms
FROM sys.dm_exec_requests
where command like ‘%DBCC%’

Move SQL files

March 14, 2017
tags:
  • USE master;
    ALTER DATABASE SmartFactory
    MODIFY FILE (name=’SmartFactory_log’,filename=’S:\MSSQL\DB\SmartFactory_log.ldf’);
    (new file location)
  • ALTER DATABASE SmartFactory SET OFFLINE WITH ROLLBACK IMMEDIATE;
    (move files to new location)
  • ALTER DATABASE SmartFactory SET ONLINE;

Kill VM vSphere

January 26, 2017

find lock:

[root@esx01:~] vmkfstools -D /vmfs/volumes/Datastore/Server/Server.vmx
Lock [type 10c00001 offset 235544576 v 270, hb offset 3809280
gen 101, mode 1, owner 56f32abb-b98107ba-ba5c-ac1624ee27e8 mtime 5372
num 0 gblnum 0 gblgen 0 gblbrk 0]

mode 1 –  file is locked

ac1624ee27e8 – MAC address of the a physical NIC in the host, that owns the lock.

——————————–

To find the host i use RVTools to look for the MAC address in the vNIC tab, or us PowerCLI.

PowerCLI C:\> $vmhost = Get-VMHost | Get-VMHostNetworkAdapter | Where-Object {$_.Mac -eq "ac:16:24:ee:27:e8"}
PowerCLI C:\> $vmhost.vmhost

——————————–

[root@esx01:~] esxcli vm process list | grep Server -A 1 | grep -v “Display Name” | grep -v “Config File”
Server
World ID: 112261247

———————————-

[root@esx01:~] esxcli vm process kill -t hard -w 11226124

can try “force” instead

Thanks – https://www.virtual-allan.com/vm-operation-not-allowed-in-this-state/