Friday, May 20, 2016

Using the partedUtil command line utility on ESXi and ESX



Note: VMFS datastores can be created and deleted using the vSphere Client connected to an ESXi/ESX host or to vCenter Server. It is not necessary to manually create partitions using the command line utility. For more information, see the Managing Storage section of theConfiguration Guide for your version of ESXi/ESX.
You can use the partedUtil command line utility to directly manipulate partition tables for local and remote SAN disks on ESXi and ESX.

The partedUtil command line only is supported for disk partitioning from ESXi 5.x. The command line utility fdisk does not work with LUNs formatted with VMFS5

Retrieving a list of disk devices

Each partedUtil command accepts a device argument specifying a local or SAN-based disk to operate against. This should be a path name beginning with /vmfs/devices/disks/. It should specify the whole block device rather than an existing partition on the device.

To obtain a list of disk device names that can be managed by partedUtil, run this command:

ls /vmfs/devices/disks/

Example of output under ESXi/ESX 3.x:

vmhba0:0:0:0 <-- disk device
vmhba0:0:0:1 <-- partition 1
vmhba0:0:0:2 <-- partition 2
vmhba0:0:0:3 <-- partition 3
vmhba0:0:0:5 <-- partition 5
vmhba3:0:0:0 <-- disk device
vmhba3:0:0:1 <-- partition 1

Example of output under ESXi/ESX 4.0 and later:

mpx.vmhba0:C0:T0:L0 <-- disk device
mpx.vmhba0:C0:T0:L0:1 <-- partition 1
mpx.vmhba0:C0:T0:L0:2 <-- partition 2
mpx.vmhba0:C0:T0:L0:3 <-- partition 3
mpx.vmhba0:C0:T0:L0:5 <-- partition 5
naa.60060160205010004265efd36125df11 <-- disk device
naa.60060160205010004265efd36125df11:1 <-- partition 1

Note: When specifying a block device using the partedUtil command, use the full path and enclose it in double quotes.

For more information on identifying a specific disk device, see Identifying disks when working with VMware ESX (1014953).

Printing an existing partition table

An existing partition table on a block disk device may be examined using the partedUtil command line utility. To obtain a list of partitions defined on a block disk device:
  • For ESXi/ESX 4.0 and earlier, run this command:

    partedUtil get "/vmfs/devices/disks/DeviceName"
  • For ESXi/ESX 4.1 and later, run this command:

    partedUtil getptbl "/vmfs/devices/disks/DeviceName"

    Example: To display the partition table for a device on an ESX 4.1 host:

    partedUtil getptbl "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0"
Example output:

msdos
17834 255 63 286513152
1 63 2249099 131 128
2 2249100 2474009 252 0
3 2474010 286487144 5 0
5 2474073 286487144 251 0


The first line is only present in the getptbl form of the command, and displays the disk label identifying the partitioning scheme being used. Common labels are bsd, dvh, gpt, loop, mac, msdos, pc98, and sun. Of these, only the msdos label and gpt partitioning scheme is used by ESXi/ESX.

Note: The label msdos does not mean that the device contains a Windows file system or is being used by a Windows machine. It only means that it is a MBR (Master Boot Record) partition.

The second line displays the disk geometry information read from the underlying device:

17834 255 63 286513152
| | | |
| | | \----- quantity of sectors
| | \-------- quantity of sectors per track
| \------------ quantity of heads
\------------------ quantity of cylinders


The remaining lines identify each defined partition. If no partitions are defined, this list is blank. The list may not be sorted.

Example: Here there are 4 partitions defined. The first partition (type 131 = 0x83 = Linux) is bootable. The second partition is a VMKcore coredump partition datastore (type 252 = 0xFC). The third partition is an Extended partition (type 5) containing additional Logical partitions. The fourth partition (numbered 5), is a Logical partition within partition number 5 and contains a VMFS Datastore (type 251 = 0xFB).

1 63 2249099 131 128
2 2249100 2474009 252 0
3 2474010 286487144 5 0
5 2474073 286487144 251 0
| | | | |
| | | | \--- attribute
| | | \------- type
| | \----------------- ending sector
| \------------------------- starting sector
\--------------------------- partition number


Properties of a partition:
  • The starting and ending sectors specify how much contiguous disk space a partition occupies. User-friendly sizes of partitions can be calculated from this information. For example, VMKCore partition 2 spans from sector 2249100 to 2474009, covering 224909 sectors of the disk. This disk has 512 bytes per sector, so this partition is 224909 x 512 = 115153408 bytes = 109 MB in size.
  • The partition type identifies the purpose of a partition, and may be represented by either a decimal identifier (for example, 251) or a GUID (for example, AA31E02A400F11DB9590000C2911D1B8). See the list of commonly used partitions in the Additional Informationsection.
  • The partition attribute is a number which identifies properties of the partition. A common attribute is 128 = 0x80, which indicates that the partition is bootable. Otherwise, most partitions have an attribute value of 0.

Creating a new partition table

A new partition table can be created on a block disk device using the partedUtil command line utility. To create a new partition on a block device, use a different command depending on the version of ESXi/ESX:
  • For ESXi/ESX 4.0 and earlier, use the command:

    partedUtil set "/vmfs/devices/disks/DeviceName" ["partNum startSector endSector type/guid attribute"]*
  • For ESXi/ESX 4.1 and later, use the command:

    partedUtil setptbl "/vmfs/devices/disks/DeviceName" DiskLabel ["partNum startSector endSector type/guid attribute"]*
The disk label is only specified in the setptbl form of the command, and sets the disk label identifying the partitioning scheme being used. Common labels are bsd, dvh, gpt, loop, mac, msdos, pc98, and sun. ESXi 5.x and higher supports both the msdos and gpt label and partitioning schemes, while ESXi/ESX 4.1 and earlier supports the msdos label and partitioning scheme exclusively.

The list of partitions to apply to the disk must be fully specified on the partedUtil command line. To add additional partitions to a disk with an existing partition, specify both the original and new partitions on the command line. If you do not, the existing partition is lost. The list of partitions are specified as quoted strings, each of which encapsulates a 5-tuple composed of the partition number, starting sector, ending sector, type ID, and attributes:
  • The startSector and endSector specify how much contiguous disk space a partition occupies. The starting sector is enforced to be before the ending sector for the same partition, but no guarantee is made that the partition defined does not overlap another partition.
  • The partition type identifies the purpose of a partition, and may be represented by either a a decimal identifier (for example, 251) or a GUID (for example, AA31E02A400F11DB9590000C2911D1B8). See the list of commonly used partitions in the Additional Informationsection. Partitions created on ESXi 5.x and higher with the gpt disklabel must be specified using the GUID.
  • The partition attribute is a number which identifies properties of the partition. A common attribute is 128 = 0x80, which indicates that the partition is bootable. Otherwise, most partitions have an attribute value of 0.
Example: To create two consecutive ~244 MB partitions of type 131 = 0x83, the first of which is bootable and starts at offset 128:
  • For ESXi/ESX 4.0 and earlier, run this command:

    partedUtil set "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" "1 128 500000 131 128" "2 500001 999999 131 0"
  • For ESXi/ESX 4.1 and later on an msdos label, run this command:

    partedUtil set "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" msdos "1 128 500000 251 0"
  • On ESXi 5.x and later on a gpt label, run this command:

    partedUtil setptbl "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" gpt "1 128 500000 AA31E02A400F11DB9590000C2911D1B8 128" "2 500001 999999 AA31E02A400F11DB9590000C2911D1B8 0"

    Note: Volumes that are upgraded from VMFS-3 to VMFS-5 continue to have the VMFS partition starting at sector 128, rather than at sector 2048.
Caution: There is no facility to undo a partition table change other than creating a new partition table. Ensure that you have a backup before marking any change. Ensure that there is no active I/O to a partition prior to modifying it.

Sizing of partitions is outside the scope of this article. For more information, see Recommended disk or LUN sizes for VMware ESXi/ESX installations (1026500).

Deleting a partition

A single partition can be deleted from a partition table on a block disk device using the partedUtil command line utility.

To delete a partition, run this command:

partedUtil delete "/vmfs/devices/disks/DeviceName" PartitionNumber

Example:

partedUtil delete "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" 2

Caution: There is no facility to undo a partition table change other than creating a new partition table. Ensure that you have a backup before making any change. Ensure that there is no active I/O to a partition before modifying it.

Resizing a partition

The partedUtil command can be used to resize an existing partition on ESXi/ESX 4.0 and higher. This does not resize the file system within the partition, and is no different from deleting and recreating the partition with a new starting or ending sector.

To resize a partition, run this command:

partedUtil resize "/vmfs/devices/disks/DeviceName" PartitionNumber NewStartSector NewEndSector

Example: To move partition 4 such that it starts in the same location (for example, 2474073) and ends at the new ending sector (1234567890), run this command:

partedUtil resize "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0" 4 2474073 1234567890

Caution: There is no facility to undo a partition table change other than creating a new partition table. Ensure that you have a backup before making any change. Ensure that there is no active I/O to a partition before modifying it.
The partition type identifies the purpose of a partition, and may indicate intended usage by a particular operating system. Partition types must be specified by the GUID only in the partition table (when running the partedUtil setptbl command).

You can obtain the GUID by running the command:

partedUtil showGuids

Partition types commonly used by ESXi/ESX include:


PartitionGUIDType (Hex)Type (Decimal)
VMFS DatastoreAA31E02A400F11DB9590000C2911D1B80xFB251
VMKCore Diagnostic9D27538040AD11DBBF97000C2911D1B80xFC252
VMware Reserved9198EFFC31C011DB8F78000C2911D1B8
Basic DataEBD0A0A2B9E5443387C068B6B72699C70x83131
Linux Swap0657FD6DA4AB43C484E50933C84B4F4F0x82130
Linux LVME6D6D379F50744C2A23C238F2A3DF9280x8E142
Linux RAIDA19D880F05FC4D3BA006743F0F84911E0xFD253
EFi SystemC12A7328F81F11D2BA4B00A0C93EC93B0xEF239
Microsoft ReservedE3C9E3160B5C4DB8817DF92DF00215AE
Unused Entry00000000000000000000000000000000
Fat160x66
Extended0x55
SFS0x4266
NTFS

vFlash Read Cache

vSphere Flash Read Cache is a brand new feature which is part of vSphere 5.5. It allows you to leverage host local SSDs and turn that in to a caching layer for your virtual machines. The biggest benefit of using host local SSDs of course is the offload of IO from the SAN to the local SSD. Every read IO that doesn’t need to go to your storage system means resources can be used for other things, like for instance write IO. That is probably the one caveat I will need to call out, it is “write through” caching only at this point, so essential a read cache system. Now, by offloading reads, potentially it could help improving write performance… This is not a given, but could be a nice side effect.
Just a couple of things before we get in to configuring it. vFlash aggregates local flash devices in to a pool, this pool is referred too as a “virtual flash resource” in our documentation. So in other words, if you have 4 x 200 GB SSD you end up with a 800GB virtual flash resource. This virtual flash resource has a filesystem sitting on top of it called “VFFS” aka “Virtual Flash File System”. As far as I know it is a heavily flash optimized version of VMF. 
Requirements and limitations:
  • vSphere 5.5 (both ESXi and vCenter)
  • SSD Drive / Flash PCIe card
  • Maximum of 8 SSDs per VFFS
  • Maximum of 4TB physical Flash-based device size
  • Maximum of 32TB virtual Flash resource total size (8x4TB)
  • Cumulative 2TB VMDK read cache limit
  • Maximum of 400GB of virtual Flash Read Cache per Virtual Machine Disk (VMDK) file
How do you enable / configure it? 
  • Open the vSphere Web Client
  • Go to your Host object
  • Go to “Manage” and then “Settings”
  • All the way at the bottom you should see “Flash Read Cache Resource Management”
    • Click “Add Capacity”
    • Select the appropriate SSD and click OK
  • Now you have a cache created, repeat for other hosts in your cluster. Below is what your screen will look like after you have added the SSD.
Now you will see another option below “Flash Read Cache Resource Management” and it is called “Cache Configuration” this is for the “Swap to host cache” / “Swap to SSD” functionalitythat was introduced with vSphere 5.0.
Now, you enable it on your virtual machine:
  • Right click the virtual machine and select “Edit Settings”
  • Uncollapse the harddisk you want to accelerate
  • Go to “Flash Read Cache” and enter the amount of GB you want to use as a cache
    • Note there is an advanced option, at this section you can also select the block size
    • The block size could be important when you want to optimize for a particular application
Now, you enable it on your host and then on a per virtual machine level and that is it… It is included with Enterprise Plus from a licensing perspective, so those who are at the right licensing level get it “for free”.

Thursday, May 19, 2016

vCenter Server for Windows Requirements

vCenter Server requires a 64-bit operating system, and the 64-bit system DSN is required for vCenter Server to connect to the external database.
The earliest Windows Server version that vCenter Server supports is Windows Server 2008 SP2. Your Windows Server must have the latest updates and patches installed. For a full list of supported operating systems, see http://kb.vmware.com/kb/2091273.





Minimum requirements for the VMware vCenter Server 6.x Appliance


The VMware vCenter Server Appliance can be deployed only on hosts that are running ESX/ESXi 5.x or later.

This table outlines the VMware vCenter Server Appliance requirements:

ResourceRequirement
Disk storage on the host machineEmbedded Platform Services Controller:
  • Tiny: 120GB
  • Small: 150GB
  • Medium: 300GB
  • Large: 450GB
External Platform Services Controller:
  • Tiny: 86GB
  • Small: 108GB
  • Medium: 220GB
  • Large: 280GB
External Platform Services Controller Appliance:
  • Tiny: 30GB
  • Small: 30GB
  • Medium: 30GB
  • Large: 30GB
Memory in the vCenter Server AppliancePlatform Services Controller Only: 2GB Ram

All components on one Appliance.
  • Tiny: 10GB RAM
  • Small: 18GB RAM
  • Medium: 26GB RAM
  • Large: 34GB RAM
CPUs in the vCenter Server AppliancePlatform Services Controller Only: 2 CPUs

All components on one Appliance.
  • Tiny: 2 CPUs
  • Small: 4 CPUs
  • Medium: 8 CPUs
  • Large: 16 CPUs

See Also

Configuring vSphere 6 Virtual SAN

Steps to creating a VSAN:

1. At least 3 ESXi hosts
2. VMKernal ports enabled for VSAN
3. Cluster enabled for VSAN
4. Creat disk groups
5. Allocate disks


Require 1 SSD for caching and HDD drive(s) for storage for VM files and cluster.
vSphere 6 allows for all SSD drives.




On each ESXi host create seperate VMKernal ports enabled for VSAN



Enable VMKernal for VSAN traffic.













Tip:  Changing a SSD drive as a HDD.

Change SSD to HDD























Also, change HDD to SSD










Enabled cluster for VSAN
















Allow for manual and automatic addition of storage.











Temporarily disbale HA for VSAN configuration.
















. Create disk groups

Claim disks allow identifying new disks and add them to groups.












Select eligible disks









































SSD cache drives are not counted towards the total capacity of VSAN storage.

















Change Keystore and Truststore Passwords of the vSphere Replication Appliance


The keystore and truststore passwords might be stored in an access restricted config file. vSphere Replication has the following keystores:

■
/opt/vmware/hms/security/hms-keystore.jks, which contains the vSphere Replication
appliance private key and certificate.
■
/opt/vmware/hms/security/hms-truststore.jks, which contains additional CA certificates
besides the ones that Java already trusts.

1

To change the hms-keystore.jks password, log in as root.
2

Obtain the current hms-keystore password.
# /opt/vmware/hms/hms-configtool -cmd list | grep keystore
Example of the output hms-keystore-password = old_password
3

Change the hms-keystore password.
 # /usr/java/default/bin/keytool -storepasswd -storepass old_password 
-new new_password -keystore /opt/vmware/hms/security/hms-keystore.jks
4

Change the vSphere Replication appliance private key password.
# /usr/java/default/bin/keytool -keypasswd -alias jetty -keypass
old_password -new new_password -storepass new_password -keystore
/opt/vmware/hms/security/hms-keystore.jks
5

Update the configuration with the new password.
/opt/vmware/hms/hms-configtool -cmd reconfig -property
'hms-keystore-password=new_password'
6

Reboot the appliance for the changes to take effect.
# reboot
7

To change the hms-truststore.jks password, log in as root.
8

Obtain the current hms-truststore password.
# /opt/vmware/hms/hms-configtool -cmd list | grep truststore
Example of the output: hms-truststore-password = old_password
9

Change the hms-truststore password.
# /usr/java/default/bin/keytool -storepasswd -storepass
old_password -new new_password -keystore
/opt/vmware/hms/security/hms-truststore.jks
10

Update the configuration with the new password.
/opt/vmware/hms/hms-configtool -cmd reconfig -property 
'hms-truststore-password=new_password'
11

Restart the vSphere Replication service.
# service hms restart