Thursday, September 3, 2015

ESXi5.0 Host Partition Layout

During the installation of ESXi 5.0, the system creates at least five partitions whose size and layout the user cannot control.
Bootpartition (4 MB):
This partition is needed for booting
Bootbank (250 MB):
The compressed boot image is saved on this FAT partition.
It will be extracted during the boot process and loaded into the system memory.
At the time of vSphere 4 this file had a size of about 70 MB, with vSphere 5 it is now grown to 250 MB.
AltBootbank (250 MB):
This partition is empty after a fresh install. Once you perform an update of ESXi, the current image is copied from the bootbank partition here.
This makes it possible to return to the last known good configuration by typing “Shift + R” while booting if there occures an error during the update of an ESXi host.
Dump/crash partition (110 MB):
In the case of a total crash of the host a dump file is written on this partition.
Store (285 MB):
On this partition the different ISO files for the VMWare Tools are available for all supported operating systems.
Scratch partition (4 GB):
This partition is only created if the installation media has at least 5 GB of space. It is used for the log files of the VMKernel.
If this partition is missing, the logs of the host are lost after a reboot or shutdown.
VMFS partition:
This partition is only created if the installation medium is not a flash memory.
It extends over the total available space of the medium and is formatted with VMFS 5.
You can use the command “ls /dev/disks/ -l” to display all the created partitions:

=====================================================================
n ESXi the partitions schema is automatically defined by the installation process and there is no way to modify it (you can only choose where install the hypervisor). There is a great post from Rickard Nobel (ESXi 5 partitions) that explain the structure of the partitions, their size and their purpose. But it does not explain how to get this information.
To see the partition layout in ESXi 5, the fdisk command will not work on new GTP disk (this type is used for all new disks and for disks that are extended to more that 2 GB, as written in the post about the upgrade of VMFS).
The new partedUtil command must be used instead. The step to show the partition table with this new command are:
  • First identify under /dev/disks the name of the system disk (it will be easy because usually is the only disk with more partitions:
  • Then use the get or the getptbl options to see the partition size (but note that the partition size was already visible also in the first screenshot):
In this example you can see there are 7 partitions:
  • Partition 1: systemPartition 4MB
  • Partition 5: linuxNative 250MB -> /bootbank
  • Partition 6: linuxNative 250MB -> /altbootbank
  • Partition 7: vmkDiagnostic 110MB
  • Partition 8: linuxNative 286MB -> /store
  • Partition 2: linuxNative 4GB -> /scratch (not present if you install ESXi on a small disk or flash)
  • Partition 3: VMFS datastore (not present if you install ESXi on a flash media)
As you can see, a minimal installation can be feet also in small flash memory with only 1 GB. A curios thing the that some partitions are reported as linuxNative but they contain a FAT filesystem (are reported also by the dfutility).
As written in the Richard’s, the footprint of ESXi si increased to around 124MB in the 5.0 version, compare to the 70MB of 4.1 and the original 32MB or 3.5 version.

=================================================================

ESXi 5 Partition Layout

I’ve recently gone through an exercise to configure the scratch partition on a number of boot from san hosts, which got me thinking about partition layout in general on ESXi hosts.
When you install ESXi you do not get the opportunity to modify the partition layout, its automatically set by the installation process.
If you’re curious you can view the partition layout on ESXi 5 hosts using partedUtil (for earlier versions of ESXi, fdisk is used instead). First we need to identify the disk that we will examine further with partedUtil. We can do this by listing the contents of /dev/disks:
The disk we are looking for is the one with multiple partitions, easily seen in blue in the above screen shot.
Now we have the disk, we can run partedUtil to examine the partition table on the disk:
Disregarding the 11GB VMFS partition and the 4GB scratch partition in the screenshot above, you can see that an installation of ESXi can take up as little as 1 GB.
So what are these partitions?
The first and smallest partition is purely used for booting the system and locating the hypervisor image which is located on one of the next two partitions.
The system/hypervisor image is found on the first 250 MB partition. The image is called s.v00 (124MB compressed) and is decompressed during boot.
The actual system image is located on the first 250 MB partition, formatted with plain old FAT. The image itself, s.v00, is a 124 MB compressed file, which is decompressed on boot and contains the hypervisor operating system.
The next partition is also used for the system image. This is a copy of the last working image. Empty on first install, when the server is upgraded, the previous system image is copied to this partition. It can be accessed during the boot process when you press CTRL-R.
The next partition is the 110 MB core dump partition, which stores the dump file if your host has the dreaded PSOD.
The 286 MB partition is where the ISO files for the VMware Tools are found.
In minimal installs the above partitions may be all that you see, however as seen in our screenshot above, there are a couple of others that you may see.
If you install ESXi on local storage with more than 4 or 5 GB free space then a Scratch partition will be automatically created. Various log files amongst other things will be redirected to this partition. If you didn’t have the necessary free space for this partition, then those files would be stored on a RAM drive, and would be lost in the event of a power failure. More about this shortly…
The final partition on the host in this example is the VMFS partition which was created during install, using available unallocated space. On this host this partition is 11GB.
So, with the partitions coverered, back to my original issue – the scratch partition. With an installation on small disks, USB or boot from SAN, you will find that a dedicated scratch partition won’t be created and will be served out of a ramdisk instead.
ESXi selects one of these scratch locations during startup in order of preference:
  1. The location configured in the /etc/vmware/locker.conf configuration file, set by the ScratchConfig.ConfiguredScratchLocation configuration option
  2. A Fat16 filesystem of at least 4 GB on the Local Boot device.
  3. A Fat16 filesystem of at least 4 GB on a Local device.
  4. A VMFS Datastore on a Local device, in a .locker/ directory.
  5. A ramdisk at /tmp/scratch/
It should be said that the scratch partition is necessary for several functions on the ESXi host – you can get an idea of what you will find on there by seeing the symbolic links that are created to redirect files and directories to scratch. For example, /var/log -> /scratch/var/log/
For hosts where a scratch partition hasn’t been automatically created, the following steps can be followed:
  1. Select the ESXi host in the inventory.
  2. Click the Configuration tab.
  3. Click Storage.
  4. Right-click a datastore and select Browse.
  5. Create a uniquely-named directory for this ESXi host (eg, .locker-ESXHostname)
  6. Close the Datastore Browser.
  7. Click Advanced Settings under Software.
  8. Select the ScratchConfig section.
  9. Change the ScratchConfig.ConfiguredScrathLocation configuration option, specifying the full path to the directory (this needs to be unique for every ESXi host). For example:/vmfs/volumes/DatastoreName/.locker-ESXHostname
  10. Enable the ScratchConfig.ConfiguredSwapState (recommended as this is a requirement for HA: see KB 1004177)
  11. Put the ESXi host in maintenance mode and reboot for the configuration change to take effect.
Link1:
Link2:
Link3:

No comments:

Post a Comment