Sunday, December 31, 2017

Add a USB drive as the datastore of ESXi 6.5

  1. Connect to the ESXi host with SSH
  2. Stop the USB arbitrator service. This service is used to passthrough USB device from an ESX/ESXi host to a virtual machine. (When disabling it, you can no longer passthrough USB devices to VMs)
    ~ # /etc/init.d/usbarbitrator stop
  3. (optional) Use this command to permanently disable the USB arbitrator service after reboot.
    ~ # chkconfig usbarbitrator off
  4. Plug in the USB device to your ESXi host. While connecting the USB device you can either watch /var/log/vmkernel.log to identify the device name or identify it within /dev/disks.
    Devices are either named mpx.vmhbaXX or with an naa.X number.
    ~ # ls /dev/disks/
  5. Write a GPT label to the device (Assuming that the Device ID is naa.5000000000000001)
    ~ # partedUtil mklabel /dev/disks/naa.5000000000000001 gpt
  6. To create a partition you need to know the start sector, end sector, which depends on the device size and the GUID.
    The start sector is always 2048
    The GUID for VMFS is AA31E02A400F11DB9590000C2911D1B8
    The end sector can be calculated with the following formula (Use the numbers from getptbl):
    ~ # partedUtil getptbl /dev/disks/naa.5000000000000001
    gpt
    15566 255 63 250069680
    15566 * 255 * 63 - 1 = 250067789
    You can also calculate the end sector with the following command:
    ~ # eval expr $(partedUtil getptbl /dev/disks/naa.5000000000000001 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
    250067789
  7. Create the VMFS partition (Replace with your end sector)
    ~ # partedUtil setptbl /dev/disks/naa.5000000000000001 gpt "1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0"
  8. Format the partition with VMFS5 or VMFS6
    # VMFS v5
    ~ # vmkfstools -C vmfs5 -S USB-Datastore /dev/disks/naa.5000000000000001:1
    
    # VMFS v6
    ~ # vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/naa.5000000000000001:1
The USB-Datastore should now appear in your datastores view.
vmfs6-usb-datastore-esxi65
This is how your command output should look like:
[root@esx4:~] partedUtil mklabel /dev/disks/naa.5000000000000001 gpt
[root@esx4:~] eval expr $(partedUtil getptbl /dev/disks/naa.5000000000000001 | tail -1 | awk '{print $1 " \\* " $2 " \\* " $3}') - 1
250067789
[root@esx4:~] partedUtil setptbl /dev/disks/naa.5000000000000001 gpt "1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
0 0 0 0
1 2048 250067789 AA31E02A400F11DB9590000C2911D1B8 0
[root@esx4:~] vmkfstools -C vmfs6 -S USB-Datastore /dev/disks/naa.5000000000000001:1
create fs deviceName:'/dev/disks/naa.5000000000000001:1', fsShortName:'vmfs6', fsName:'USB-Datastore'
deviceFullPath:/dev/disks/naa.5000000000000001:1 deviceFile:naa.5000000000000001:1
ATS on device /dev/disks/naa.5000000000000001:1: not supported
.
Checking if remote hosts are using this device as a valid file system. This may take a few seconds...
Scanning for VMFS-3/VMFS-5 host activity (512 bytes/HB, 2048 HBs).
Creating vmfs6 file system on "naa.5000000000000001:1" with blockSize 1048576, unmapGranularity 1048576, unmapPriority default and volume label "USB-Datastore".
Successfully created new volume: 583b0efb-33b7ba1e-57e7-001fc69b9659

Migrate Microsoft Edge bookmark from old PC to new PC

A. To Backup Favorites from Microsoft Edge 
1. Open File Explorer, copy and paste the folder location:  %LocalAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default in the address bar of File Explorer, and press Enter. 
2. Copy the DataStore folder below to where you like as your backup. (see screenshot below)
B. To Restore Favorites in Microsoft Edge 
1. Close Microsoft Edge if open.
2. Open File Explorer, copy and paste the folder location: %LocalAppData%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC\MicrosoftEdge\User\Default in the address bar, and press Enter. 
3. Copy the backed up DataStore folder from step 2 into the Default folder below. (see screenshot above)
4. If prompted, click/tap on Replace the files in the destination.








Sunday, May 7, 2017

Virtual machine that appears as invalid for VMware ESX and ESXi

Open the vSphere Client, select the virtual machine wich is in invalid state
  1. Right-click the virtual machine and choose Remove from Inventory.
    Caution
    : Do not choose Delete from Disk.
     
  2. Click on the ESX host and, using the Summary tab, locate the appropriate datastore in which the virtual machine exists.
  3. Right-click the datastore and click Browse Datastore.
  4. Browse to the directory of the virtual machine.

    Note
    : If you have renamed the virtual machine in the VMware Infrastructure Client, use the original name given to it.
     
  5. Right-click the .vmx file of the virtual machine and choose Add to Inventory.
  6. Power on the virtual machine.

Saturday, May 6, 2017

Rename a vmdk with vmkfstools


Delete a Virtual machines appear as invalid with SSH

  1. Log in ESXi with SSH
  2. Open /etc/vmware/hostd/vmInventory.xml with vi, delete the revelent entry.
  3. restart the Management agents in ESXi by issue command /etc/init.d/hostd restart

Thursday, February 2, 2017

Update ESXi host in Esxi Shell

Cut and paste these commands into an ESXi shell to update your host with this Imageprofile
  • esxcli network firewall ruleset set -e true -r httpClient
  • esxcli software profile update -p ESXi-6.0.0-20161104001-standard \ -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
  • esxcli network firewall ruleset set -e false -r httpClient # # Reboot to complete the upgrade
Note: Replace the version number ESXi-6.0.0-20161104001 with version you want update to

Enabling and access ESXi Shell

Enabling ESXi Shell access using the vSphere Client
  1. Log in to a vCenter Server system using the vSphere Client.
  2. Select the host in the Inventory panel.
  3. Click the Configuration tab and click Security Profile.
  4. In the Services section, click Properties.
  5. Select ESXi Shell from this list:
    ESXi Shell
    SSH
    Direct Console UI
  6. Click Options and select Start and stop manually.
    Note: When you select Start and stop manually, the service does not start when you reboot the host. If you want the service to start when you reboot the host, select Start and stop with host.
  7. Click Start to enable the service.
  8. Click OK.
Enabling ESXi Shell access using the Direct Console User Interface
Use the direct console user interface to enable the ESXi Shell:
  1. From the Direct Console User Interface, press F2 to access the System Customization menu.
  2. Select Troubleshooting Options and press Enter.
  3. From the Troubleshooting Mode Options menu, select Enable ESXi Shell.
    Enable ESXi Shell
    Enable SSH
  4. Press Enter to enable the service.
Accessing the remote ESXi Shell
  1. Open an SSH client.
  2. Specify the IP address or domain name of the ESXi host.
    Notes:
    • Steps may vary depending on the SSH client you are using. For more information, consult the client documentation and support.
    • By default, SSH works on TCP port 22.
  3. Provide credentials when prompted.

Prevent or Prohibit Server Drives From Being Visible to Users

  To make changes to this policy for one of the seven default values: Start the Microsoft Management Console. On the Console menu, click  Ad...