The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘ESXi4’ Category

VMware ESXi – converting a thick disk to a thin disk – via: Server Fault

Posted by jpluimers on 2016/10/17

There are various places that tell you you cannot resize a thick disk to a thin disk using vmkfstools.

When you do it wrong, you get this error:

DiskLib_Check() failed for source disk. The file specified is not a virtual disk (15).

This happens when you directly try to resize the physical disk image:

# vmkfstools --clonevirtualdisk msmxp-flat.vmdk --diskformat thin msmxp-flat.thin.vmdk
DiskLib_Check() failed for source disk The file specified is not a virtual disk (15).

Whereas you should point vmkfstools to the disk descriptor file which has the shortest name:

# vmkfstools --clonevirtualdisk msmxp.vmdk --diskformat thin msmxp.thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.vmdk'...
Clone: 100% done.

(Note that many people shorten the --clonevirtualdisk to -i and --diskformat to -d).

For performance, it doesn’t matter much if your disk is thick or thin as explained by Death to false myths: The type of virtual disk used determines your performance.

But various people issues expanding a thick disk. With thin disks, that usually works fine.

This post explains the correct steps of resizing: VMWare ESXi 5.1–convert virtual disk (vmdk) from thick to thin provision.

Here is a summary:

Step zero: shutdown the VM and ensure you have a backup!

For instance with rsync is great for making a local backup:

# time ./850EVO1TBR1B/bin/rsync -aiv --info=progress2 --progress ./850EVO1TBR1B/Raid6SSD-VM/msmxp/ ./850EVO1TBR1A/Raid6SSD-VM/msmxp/

Step one: show the disk files:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk

There are two: msmxp.vmdk describes the disk and msmxp-flat.vmdk has the data.

Step two: ensure you have enough free space on the volume:

# ls -al /vmfs/volumes | grep "552f5788-33e30274-8dba-001f29022aed"
drwxr-xr-t    1 root     root          2660 Aug  5 04:35 552f5788-33e30274-8dba-001f29022aed
lrwxr-xr-x    1 root     root            35 Aug  5 06:11 850EVO1TBR1B -> 552f5788-33e30274-8dba-001f29022aed
# df -h | grep "850EVO1TBR1B\|Use%"
Filesystem   Size   Used Available Use% Mounted on
VMFS-5     930.8G 736.8G    194.0G  79% /vmfs/volumes/850EVO1TBR1B

Convert the disk:

# vmkfstools --clonevirtualdisk msmxp.vmdk --diskformat thin msmxp.thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.vmdk'...
Clone: 100% done.

Observe the size:

In my case the flat disk was almost full and fragmented, so the thin disk is not smaller:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thin-flat.vmdk
0   msmxp.thin.vmdk
0   msmxp.vmdk

Rename both disks

Use vmkfstools (do not use mv as that will not keep the descriptor/data vmdk files bound together) and check the rename.

You can replace --renamevirtualdisk with -E:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --renamevirtualdisk msmxp.thin.vmdk msmxp.vmdk
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -E msmxp.vmdk msmxp.thick.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk

Turn on the Virtual Machine to verify it still works.

If it does, then delete it (you can replace --deletevirtualdisk with -U) which will remove both both the descriptor and data vmdk file:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --deletevirtualdisk msmxp.vmdk 
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -U msmxp.vmdk 
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk

After shutting down the VM again and making a new backup, you can now expand the disk as described in VMware KB: Adding space to an ESXi/ESX host virtual disk.

You can replace --extendvirtualdisk with -X.

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk 
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -X 14G msmxp.vmdk 
Grow: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk


/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --renamevirtualdisk msmxp.vmdk msmxp.thick.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --clonevirtualdisk msmxp.thick.vmdk msmxp.vmdk --diskformat thin
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.thick.vmdk'...
Clone: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # diff msmxp.thick.vmdk msmxp.vmdk
--- msmxp.thick.vmdk
+++ msmxp.vmdk
@@ -7,18 +7,18 @@
 createType="vmfs"
 
 # Extent description
-RW 29360128 VMFS "msmxp.thick-flat.vmdk"
+RW 29360128 VMFS "msmxp-flat.vmdk"
 
 # The Disk Data Base 
 #DDB
 
-ddb.adapterType = "ide"
-ddb.thinProvisioned = "1"
-ddb.geometry.sectors = "63"
-ddb.geometry.heads = "16"
-ddb.geometry.cylinders = "29127"
-ddb.uuid = "60 00 C2 9f 5e f8 33 76-6e c5 48 3c f2 84 d8 1e"
-ddb.longContentID = "5659579edebed2ebdd8e0c8fda15abd4"
 ddb.toolsVersion = "9221"
 ddb.virtualHWVersion = "8"
 ddb.deletable = "true"
+ddb.longContentID = "5659579edebed2ebdd8e0c8fda15abd4"
+ddb.uuid = "60 00 C2 95 66 1b cf 7a-e3 db 3f 30 17 7e 00 2d"
+ddb.geometry.cylinders = "29127"
+ddb.geometry.heads = "16"
+ddb.geometry.sectors = "63"
+ddb.thinProvisioned = "1"
+ddb.adapterType = "ide"
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 15G msmxp.vmdk
Grow: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --deletevirtualdisk msmxp.thick.vmdk 
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # 

–jeroen

via: vmware esxi – vmkfstools returns error when trying to copy thin vmdk – Server Fault.

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

VMware KB: Configuring Network Time Protocol (NTP) on ESX/ESXi hosts using the vSphere Client

Posted by jpluimers on 2016/09/16

Often it is better to configure more than just a single pool.ntp.org server in case the IP-address of the name gets cached too long and it becomes unresponsive during that period.

So it is better to configure multiple, choose from this list from [WayBackpool.ntp.org: How do I setup NTP to use the pool?.

0.pool.ntp.org
1.pool.ntp.org
2.pool.ntp.org
3.pool.ntp.org

Here are the steps for one server where you need to repeat the steps after entering pool.ntp.org:

To configure NTP on ESX/ESXi 4.1 and ESXi 5.x hosts using the vSphere Client:

  1. Connect to the ESX/ESXi host using the vSphere Client.
  2. Select a host in the inventory.
  3. Click the Configuration tab.
  4. Click Time Configuration.
  5. Click Properties.
  6. Click Options.
  7. Click NTP Settings.
  8. Click Add.
  9. Enter the NTP Server name. For example, pool.ntp.org.
    1. Note: When entering the multiple NTP Server names, use a comma (,) followed by a space ( ) between the entries.
  10. Click OK.
  11. Click the General tab.
  12. Click Start automatically under Startup Policy.
    1. Note: It is recommended to set the time manually prior to starting the service.
  13. Click Start and click OK.
  14. Click OK to exit.

–jeroen

via:

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

vim-cmd suspending/resuming a bunch of VMs

Posted by jpluimers on 2016/09/13

These two vim-cmd scripts come in very handy:


#!/bin/sh
VMS=`vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'`
for VM in $VMS ; do
# echo "Probing VM with id: $VM."
PWR=`vim-cmd vmsvc/power.getstate $VM | grep -v "Retrieved runtime info"`
name=`vim-cmd vmsvc/get.config $VM | grep -i "name =" | awk '{print $3}' | head -1 | awk -F'"' '{print $2}'`
echo "VM with id $VM has power state $PWR (name = $name)."
done


#!/bin/sh
# https://wiert.me/2021/04/30/vmware-esxi-console-viewing-all-vms-suspending-and-waking-them-up-part-5/
RUNNING=0
vmids=`vim-cmd vmsvc/getallvms | sed -n -E -e "s/^([[:digit:]]+)\s+((\S.+\S)?)\s+(\[\S+\])\s+(.+\.vmx)\s+(\S+)\s+(vmx-[[:digit:]]+)\s*?((\S.+)?)$/\1/p"`
for vmid in ${vmids} ; do
# echo "Probing VM with id: $vmid."
powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`
name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/\(vim.vm.ConfigInfo\) \{/,/files = \(vim.vm.FileInfo\) \{/ s/^ +name = "(.*)",.*?/\1/p'`
vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = \(vim.vm.FileInfo\) \{/,/tools = \(vim.vm.ToolsConfigInfo\) \{/ s/^ +vmPathName = "(.*)",.*?/\1/p'`
# echo "VM with id ${vmid} has power state ${powerState} (name = ${name}; vmPathName = ${vmPathName})."
if [ "${powerState}" == "Powered on" ] ; then
RUNNING=1
echo "Powered on VM with id ${vmid} and name: $name"
echo "Suspending VM with id ${vmid} and name: $name"
vim-cmd vmsvc/power.suspend ${vmid} > /dev/null &
fi
done
while true ; do
if [ $RUNNING -eq 0 ] ; then
echo "Gone…"
break
fi
RUNNING=0
for vmid in ${vmids} ; do
# echo "Probing VM with id: $vmid."
powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`
name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/\(vim.vm.ConfigInfo\) \{/,/files = \(vim.vm.FileInfo\) \{/ s/^ +name = "(.*)",.*?/\1/p'`
vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = \(vim.vm.FileInfo\) \{/,/tools = \(vim.vm.ToolsConfigInfo\) \{/ s/^ +vmPathName = "(.*)",.*?/\1/p'`
# echo "VM with id ${vmid} has power state ${powerState} (name = ${name}; vmPathName = ${vmPathName})."
if [ "${powerState}" == "Powered on" ] ; then
RUNNING=1
echo "Waiting for id ${vmid} and name: $name"
fi
done
sleep 1
done
exit 0


#!/bin/sh
SUSPENDED=0
VMS=`vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}'`
VMstateToProcess="Suspended"
for VM in $VMS ; do
# echo "Probing VM with id: $VM."
PWR=`vim-cmd vmsvc/power.getstate $VM | grep -v "Retrieved runtime info"`
name=`vim-cmd vmsvc/get.config $VM | grep -i "name =" | awk '{print $3}' | head -1 | awk -F'"' '{print $2}'`
echo "VM with id $VM has power state $PWR (name = $name)."
if [ "$PWR" == "$VMstateToProcess" ] ; then
SUSPENDED=1
echo "Suspended VM with id $VM and name: $name"
echo "Resuming VM with id $VM and name: $name"
# you'd think power.suspendResume is the inverse of power.suspend, but actually power.on is:
vim-cmd vmsvc/power.on $VM > /dev/null &
fi
done
while true ; do
if [ $SUSPENDED -eq 0 ] ; then
echo "Gone…"
break
fi
SUSPENDED=0
for VM in $VMS ; do
PWR=`vim-cmd vmsvc/power.getstate $VM | grep -v "Retrieved runtime info"`
if [ "$PWR" == "$VMstateToProcess" ] ; then
name=`vim-cmd vmsvc/get.config $VM | grep -i "name =" | awk '{print $3}' | head -1 | awk -F'"' '{print $2}'`
echo "Waiting for id $VM and name: $name…"
SUSPENDED=1
fi
done
sleep 1
done

–jeroen

Posted in bash, Development, ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Power User, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

Some links on Hyperthreading, ESXi and vSphere

Posted by jpluimers on 2016/07/22

In case I bump into vSphere/ESXi machines that have hyper threading (HT) enabled:

–jeroen

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Lantronix SpiderDuo Remote KVM Switch: Affordable KVM Over IP Switches

Posted by jpluimers on 2016/05/02

Lantronix SpiderDuo Remote KVM Switch: Affordable KVM Over IP Switches.

Interesting KVM-over-IP solution.

–jeroen

via: A bunch of stuff broke this month, learned a lot fixing it all | TinkerTry IT @ Home.

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Network-and-equipment, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Accessing the ESXi Direct Console User Interface DCUI via SSH – Wahl Network

Posted by jpluimers on 2014/11/05

I just learned (thanks Chris Wahl!) about the dcui command: often easier to configure basic parameters than the other UIs.

The DCUI is normally available from the console after you login, for instance to enable SSH.

This was new to me:

DCUI is available over SSH.

Even more embarrassing: duic has been actually there since ESXi 4.1 (:

–jeroen

via: Accessing the ESXi Direct Console User Interface DCUI via SSH – Wahl Network.

Posted in *nix, ESXi4, ESXi5, ESXi5.1, ESXi5.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Windows 8.1 on VMware ESXi 5.1: Minimize/Maximize/Close buttons are invisible but functional

Posted by jpluimers on 2014/04/25

(Another one in the missed schedule list: this post was scheduled for this morning 06:00)

When you run a Windows 8.1 guest on VMware ESXi 5.1 with the VMware tools that belong to ESXi 5.1, the Minimize/Maximize/Close buttons are invisible but functional.

It doesn’t matter how you access that VM:

  • Through an RDP session (from either the MS RDP client on Mac OS X or MSTSC on a Windows machine).
  • Through a Console Window from vSphere Client connected to the ESXi host (if that client does not run on Windows XP).
  • Through a Console Window from VMware Workstation connected to the ESXi host.

It is good to know that this is just a visual artefact, the Minimize/Maximixe/Close buttons still work:

I was having the same exact problem with my Windows 8.1 VM.  If you click the location where the buttons should be, it still works like they are there.

But he uses a solution that is not really the kind I like:

I opened Device Manager on the VM and then uninstalled the VMware Display Adaptor, including the software for the driver.  After doing that, I scanned for hardware changes and it reinstalled the display adaptor using a windows driver.

The youngest VMware Tools version it fails with on my system is this one: 9.6.1.1378637.

Uninstalling the driver from the device manager indeed solves the issue, but:   Read the rest of this entry »

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, Power User, VMware, VMware ESXi, VMware Workstation | Leave a Comment »

7zip on ESXi through p7zip

Posted by jpluimers on 2014/04/13

A while ago, I wrote about getting rsync on ESXi: ESXi 5.1 and rsync – damiendebin.net.

Now I needed [WayBack7zip on ESXi to make sure I could test unpack some 7zip archives.

This turned out much easier than I thought, thanks to [WayBack7Zip for ESXI | Vladimir Lukianov: Заметки who pointed me to the [WayBackP7ZIP project. P7ZIP actually created three things:

  • p7zip (a POSIX 7zip),
  • J7ZIP (a Java port of 7zip)
  • java_lzma (the Java port of the [WayBack7zip lzma SDK which had the first implementation of [WayBack] lzma).

Here are the full steps to get 7zip on ESXi 5.x:

Read the rest of this entry »

Posted in *nix, *nix-tools, ESXi4, ESXi5, ESXi5.1, ESXi5.5, Linux, Power User, SuSE Linux, VMware, VMware ESXi | Tagged: , | 3 Comments »

VMware Front Experience: ESXi-Customizer

Posted by jpluimers on 2014/04/11

Interesting:

ESXi-Customizer is a user-friendly script that automates the process of customizing the ESXi install-ISO with drivers that are not originally included. Unlike other scripts and manuals that are available for this purpose ESXi-Customizer runs entirely on Windows and does not require any knowledge of or access to Linux.

Download latest version | Donate to support

Requirements:

  • The script runs on Windows XP or newer (both 32-bit and 64-bit) including the latest version Windows 8.1 and Server 2012 R2.
  • For customizing ESXi 4.1 Windows 7 (32-bit or 64-bit) or Windows Server 2008 R2 and administrative privileges are required.
  • You need to have a copy of the original VMware install-ISO. It is available at VMware (free registration required to download). The script currently supports ESXi version 4.1, 5.0, 5.1 and 5.5.
  • For ESXi 4.1 you need to have a OEM.tgz file with a custom driver.
  • For ESXi 5.x you need to have a OEM.tgz, a VIB file or an Offline Bundle ZIP file.
  • A good source for ESXi 4.1 and 5.x community drivers is Dave Mishchenko’s vm-help.com site. See the ESXi 4.1 Whitebox HCL and the forums there.

–jeroen

via: VMware Front Experience: ESXi-Customizer.

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, Power User, VMware, VMware ESXi | Leave a Comment »

VMware ESXi: renaming a VM and VMDK

Posted by jpluimers on 2014/04/09

This turned out to be much more manual work than I hoped: renaming a VM and the VMDK used by the VM in ESXi.

If you prefer to do all steps by hand on the command-line plus two vi sessions for the vmx* files and the main vmdk file: Just one more esxi-guy: How to Rename a Virtual Machine with the CLI in esxi 5.0.

If you have vCenter, you can do it from the guy. Note for Free ESXi users: vCenter is a payed product, but there is a trial of vCenter.

A bit less manual work, but a bit more scripting from the console (if you are comfortable with that) is at Howto: Rename a VM – Yellow Bricks to which you might want to add the script mentioned at Rename multiple files by replacing a particular pattern in the filenames using a shell script – Stack Overflow.

You can also script from vMA or vCLI: VMware KB: Renaming a virtual machine disk (VMDK) via the vSphere Management Assistant (vMA) or vSphere CLI (vCLI).

–jeroen

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, Power User, VMware, VMware ESXi | Leave a Comment »