Extending a logical volume online

Posted by & filed under Server Admin, VMWare.

I’ve written about this in past posts. Here is an updated article straight from VMWare: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371

 

  1. Power off the virtual machine.
  2. Edit the virtual machine settings and extend the virtual disk size. For more information, see Increasing the size of a virtual disk (1004047).
  3. Power on the virtual machine.
  4. Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

    # fdisk -l

  5. Create a new primary partition:
    1. Run the command:

      # fdisk /dev/sda (depending the results of the step 4)

    2. Press p to print the partition table to identify the number of partitions. By default, there are 2: sda1 and sda2.
    3. Press n to create a new primary partition.
    4. Press p for primary.
    5. Press 3 for the partition number, depending on the output of the partition table print.
    6. Press Enter two times.
    7. Press t to change the system’s partition ID.
    8. Press 3 to select the newly creation partition.
    9. Type 8e to change the Hex Code of the partition for Linux LVM.
    10. Press w to write the changes to the partition table.
  6. Restart the virtual machine.
  7. Run this command to verify that the changes were saved to the partition table and that the new partition has an 8e type:

    # fdisk -l

  8. Run this command to convert the new partition to a physical volume:

    Note: The number for the sda can change depending on system setup. Use the sda number that was created in step 5.

    # pvcreate /dev/sda3

  9. Run this command to extend the physical volume:

    # vgextend VolGroup00 /dev/sda3

    Note: To determine which volume group to extend, use the command vgdisplay.

  10. Run this command to verify how many physical extents are available to the Volume Group:

    # vgdisplay VolGroup00 | grep “Free”

  11. Run the following command to extend the Logical Volume:

    # lvextend -L+#G /dev/VolGroup00/LogVol00

    Where # is the number of Free space in GB available as per the previous command. Use the full number output from Step 10 including any decimals.

    Note: To determine which logical volume to extend, use the command lvdisplay.

  12. Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

    # ext2online /dev/VolGroup00/LogVol00

    Notes:

    • Use resize2fs instead of ext2online if it is not a Red Hat virtual machine.
    • By default, Red Hat and CentOS 7 use the XFS file system you can grow the file system by running the xfs_growfs command.
  13. Run the following command to verify that the / filesystem has the new space available:

    # df -h /

VMWare — Rolling your own OEM branded image to include missing vibs

Posted by & filed under Virtualization, VMWare.

Problem: A fresh install of HPE branded ESXi 6.5 U1 cannot see the LUNs on the SAN during the installation. The server boots from SAN which means I need to be able to connect to the remote LUNs during installation. There is no local storage. Currently on 5.5u3, it is working fine. The HPE branded 6.5U1 installer does not see the LUNs presented by my SAN. A quick boot into the 5.5 installer confirms it can see the LUNS with no problems ruling out zoning issues, physical issues, etc.

The HPE ESXi 6.5 image seems to be lacking support for the Qlogic BR-815/Qlogic BR-825/Brocade-415/Brocade-825 FC cards which are all mostly the same card. After verifying compatibility of the server, and of the BR-815 FC cards, I determined that the driver simply is not included in the HPE image.

Here are the steps I took to roll my own installer using the HPE branded one as a base using the VMWare Image Builder toolset:

Resources:

  • Customizing installations with Image Builder: https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-48AC6D6A-B936-4585-8720-A1F344E366F9.html
  • Add VIBs to an image profile: pubs.vmware.com/vsphere-51/index.jsp#com…
  • Export image profile to a ISO: pubs.vmware.com/vsphere-51/index.jsp#com…
  • HPE vibs Depot: http://vibsdepot.hpe.com
  • Using vibsdepot with Image Builder: http://vibsdepot.hpe.com/getting_started.html
  • Applying VIBS to a image walkthrough: https://blogs.vmware.com/vsphere/2017/05/apply-latest-vmware-esxi-security-patches-oem-custom-images-visualize-differences.html
  • VMWare Compatibility Guide: https://www.vmware.com/resources/compatibility/search.php
  • HPE VMWare Support and Certification Matrices: http://h17007.www1.hpe.com/us/en/enterprise/servers/supportmatrix/vmware.aspx
  • Info on HPE Custom Images: https://www.hpe.com/us/en/servers/hpe-esxi.html
  • Supported driver firmware versions for I/O devices: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2030818

Basic steps:

  • Identify OEM’s software depot URL, in this case the HPE ESXi 6.5U1 image http://vibsdepot.hpe.com/index-ecli-650.xml
  • Identify where the VIB is available for the driver. In my case, the Brocade BR-815 driver was downloaded via the VMWare compatibility site: https://www.vmware.com/resources/compatibility/detail.php?deviceCategory=io&productid=5346 — Note the VIB is actually inside a zip file inside the zip you download. It will be looking for a index.xml file in the root of the zip.
  • Use the esx-image-creator.ps1 to generate a new image with the newly included software: https://github.com/vmware/PowerCLI-Example-Scripts/blob/master/Scripts/esxi-image-creator.ps1
  • Use Export-EsxImageProfile to generate a ISO for installation.

 

PowerCLI C:\Users\user> Add-EsxSoftwareDepot http://vibsdepot.hpe.com/index-ecli-650.xml

Depot Url
---------
http://vibsdepot.hpe.com/index-ecli-650.xml


PowerCLI C:\Users\user> Add-EsxSoftwareDepot -DepotUrl C:\Users\user\Downloads\BCD-bfa-3.2.5.0-00000-offline_bundle-2352086.zip

Depot Url
---------
zip:C:\Users\user\Downloads\BCD-bfa-3.2.5.0-00000-offline_bundle-2352086.zip?index.xml


PowerCLI C:\Users\user> Get-EsxSoftwareDepot

Depot Url
---------
http://vibsdepot.hpe.com/index-ecli-650.xml
zip:C:\Users\user\Downloads\BCD-bfa-3.2.5.0-00000-offline_bundle-2352086.zip?index.xml


PowerCLI C:\Users\user> .\esxi-image-creator.ps1 -LeaveCurrentDepotsMounted -NewProfileName ESXi_6.5.0U1_with_HPE_and_Qlogic -Files C:\Users\user\Downloads\VMware-ESXi-6.5.0-Update1-5969303-HPE-650.U1.10.1.3.3-Oct2017-depot.zip -Accepta
nce PartnerSupported

Depot Url
---------
zip:C:\Users\user\Downloads\VMware-ESXi-6.5.0-Update1-5969303-HPE-650.U1.10.1.3.3-Oct2017-depot.zip?index.xml

The following VIBs will not be included in ESXi_6.5.0U1_with_HPE_and_Qlogic:
tools-light

Finished creating ESXi_6.5.0U1_with_HPE_and_Qlogic


PowerCLI C:\Users\user> Export-EsxImageProfile -ExportToIso -ImageProfile "ESXi_6.5.0U1_with_HPE_and_Qlogic" -FilePath C:\Users\user\Downloads\VMWare-ESXi-6.5.0-U1-HPE-Qlogic-Custom-Oct2017.iso

Booting the server with the newly built ISO enables me to see the LUNs so I can complete my boot-from-san installation.

VMWare Update Manager Fails

Posted by & filed under Uncategorized, Virtualization, VMWare.

I received a fairly generic error when running VMWARE Update Manager against some hosts:

No real useful information. The actual log is available on the VCSA 6.5 at: /var/log/vmware/vmware-updatemgr/vum-server/vmware-vum-server-log4cpp.log

In my case it was as simple as the DNS being set incorrectly on the ESXi hosts due to some networking changes:

[2017-10-10 01:40:04:334 'VciScanTask.ScanTask{44}' 140420998207232 INFO]  [vciTaskBase, 1362] VciTask { id: ScanTask{44}, type: com.vmware.vcIntegrity.ScanTask }: Setting VC task state to: error
[2017-10-10 01:54:19:765 'HostUpdateDepotManager' 140421651932928 ERROR]  [scanHost20, 371] result for host: vm07.redacted.lan (entity: host-188) shows error :
<error errorClass="MetadataDownloadError">
  <errorCode>4</errorCode>
  <errorDesc>Failed to download metadata.</errorDesc>
  <msg>('http://vcenter.redacted.lan:9084/vum/repository/hostupdate/csco/csco-VEM-5.5.0-metadata.zip', '/tmp/tmp6q7F56', '[Errno 4] IOError: &lt;urlopen error [Errno -2] Name or service not known&gt;')</msg>
</error>

Other threads that might be related:

communities.vmware.com/thread/546976

Resetting the VMWare Update Manager Database: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2147284

PowerCLI – Get a VM’s Disks

Posted by & filed under Virtualization, VMWare.

PowerCLI snippets to get a VM’s disks

This command will retrieve the specified VM’s attached disk paths:

Get-HardDisk -VM Guest-VM-Name-Here

But we can also focus on the filename:

PowerCLI C:\> Get-HardDisk -VM VM-core | Select-Object Parent,Name,Filename

Filename
--------
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_16.vmdk
[EMC_Tier2_NotReplicated_VMFS11] VM-core/VM-core_7.vmdk
[EMC2_Tier2_Replicated_VMFS3] VM-core/VM-core_14.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_2.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_5.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_1.vmdk
[EMC_Tier2_Replicated_VMFS2] VM-core/VM-core_17.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core_1.vmdk
[EMC2_Tier2_Replicated_VMFS1] VM-core/VM-core.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_10.vmdk
[EMC2_Tier2_Replicated_VMFS4] VM-core/VM-core_3.vmdk
[EMC2_Tier2_Replicated_VMFS3] VM-core/VM-core.vmdk

We can also see the other columns available:

PowerCLI C:\> Get-HardDisk -VM VM-core | Get-Member


   TypeName: VMware.VimAutomation.ViCore.Impl.V1.VirtualDevice.FlatHardDiskImpl

Name             MemberType Definition
----             ---------- ----------
ConvertToVersion Method     T VersionedObjectInterop.ConvertToVersion[T]()
Equals           Method     bool Equals(System.Object obj)
GetHashCode      Method     int GetHashCode()
GetType          Method     type GetType()
IsConvertableTo  Method     bool VersionedObjectInterop.IsConvertableTo(type type)
LockUpdates      Method     void ExtensionData.LockUpdates()
ToString         Method     string ToString()
UnlockUpdates    Method     void ExtensionData.UnlockUpdates()
CapacityGB       Property   decimal CapacityGB {get;}
CapacityKB       Property   long CapacityKB {get;}
Client           Property   VMware.VimAutomation.ViCore.Interop.V1.VIAutomation Client {get;}
ConnectionState  Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.ConnectInfo ConnectionState {get;}
DiskType         Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.DiskType DiskType {get;}
ExtensionData    Property   System.Object ExtensionData {get;}
Filename         Property   string Filename {get;}
Id               Property   string Id {get;}
Name             Property   string Name {get;}
Parent           Property   VMware.VimAutomation.Sdk.Types.V1.VIObject Parent {get;}
ParentId         Property   string ParentId {get;}
Persistence      Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.PersistencePolicy Persistence {get;}
StorageFormat    Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.VirtualDiskStorageFormat StorageFormat {get;}
Uid              Property   string Uid {get;}

We could also do something like get the Disk paths for all guests:

PowerCLI C:\> Get-VM -Location $datacenter | ForEach-Object {Get-HardDisk -VM $_.Name | Select-Object Parent,Name,Filename}

Parent                                                                          Name                                                                            Filename
------                                                                          ----                                                                            --------
REDACTEDADCSVR01                                                                    Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDADCSVR01/disk0-000001.vmdk
REDACTEDUTLSVR                                                                      Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDUTLSVR/disk0-000001.vmdk
RP-BATCHMASTER2                                                                 Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] RP-BATCHMASTER2/disk0-000001.vmdk
RP-TS02                                                                         Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS1] REDACTED/disk0-000001.vmdk
REDACTEDFMSVR01                                                                     Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTEDFMSVR01/disk0-000001.vmdk
REDACTEDSVR01                                                                    Hard disk 1                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTED/disk0-000001.vmdk
REDACTEDSVR01                                                                    Hard disk 2                                                                     [EMC2_Tier1_NotReplicated_VMFS3] REDACTED/disk1-000001.vmdk