Monday, 7 September 2015

Partitions in ESXi 5

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.
Below content will explain you for more understanding

In this article we will look at the partition layout of ESXi 5. A change from earlier ESXi 4.x is that the older MBR partitioning system is replaced with a GPT style partition table. The first five partitions are mandatory and consumes exactly 900 MB together, while the last two is not technically necessary.
ESXi 5.0 partitions
The first small partition is just for booting the system and locating the hypervisor image which could be on one of the next two partitions.
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 250 MB FAT partition is used for inplace upgrades and is empty at start if a clean installation was done.


If the hypervisor itself should crash (“purple screen of death“) the 110 MB core dump partition is used for dumping crash information.
In this 286 MB partition we have mostly ISO files with the VMware Tools for the various supported guest operating system. We can also find the floppy images for the PVSCSI virtual disk controller, if in need to use these directly at installation on Windows Server guests.
If installing ESXi on a local hard drive and this drive is larger than about 5 GB a “scratch” partition will be created. This partition holds mostly the various log files for the vmkernel and other components. If installing on a very small drive, about 1 GB, or on USB, this scratch partition will be missing and the log files will be in RAM only. This means that in the case of power failure the log files will be lost.


A partition formatted with VMFS will be automatically created on the rest of the space of the install drive. In ESXi 5.0 the new VMFS 5 will be used with a standard block size of 1 MB no matter the size of the disk and better support for small files, e.g. VMX configuration and log files. When now using GPT(Guid Partition Table) we could also use disks with sizes over 2 TB.




If using the ESXi Shell you can access the different partitions through file system mounts. For example, the directory /bootbank is the first 250 MB partition where the actual hypervisor files are located. The /store directory is the 286 MB large repository for VMware Tools and other files.
ESXi partition mounts
The compressed image in the first 250 MB “boot bank” partition is larger in 5.0 than in 4.1, (where the image was 70 MB), but still a very small disk foot print with about 124 MB in 5.0. If you later update the active image it will first be copied to the alternative boot bank, as a “last known good configuration”.
If the update should fail you could press SHIFT + R early in the boot sequence and select to boot the system from the alternative boot bank.

No comments:

Post a Comment