ESXi: how to resize the OS partition

root's picture

Actually you cannot resize the OS partition on an existing ESXi installation but you can backup the configuration, reinstall with the right options and restore back the configuration.
You could probably also migrate during the installation process but I haven't tested that yet.

So, without much typing here we go.

1. Backup the existing ESXi configuration

a. Enable SSH on ESXi host

b. Execute the following command

[root@eeny:~] vim-cmd hostsvc/firmware/backup_config
[h4]c. Bundle can be downloaded at : http://*/downloads/52bfcef4-c345-f4a9-5c7a-98429dc49544/configBundle-eeny.tgz[/h4]

2. Take that URL, replace * with the IP of you ESXi server and download the bundle with your browser.

3. Shutdown ESXi and prepare the installation. At boot, press SHIFT+O and add the following

If you have 7.0 Update 1c: systemMediaSize=min
Values are min, small, default, max - check vmware KB websites for more details but be aware they did a mistake there, it is written 33GB but from what I have seen, min will give you around 25G of VMFSL partition, nowhere near 33GB.
If you have a lower version of if you want to go below min, you need to use an unsupported way: autoPartitionOSDataSize=5120
The example above means VMFSL partition will be around 5GB in size.

4. Once the installation is done, check if VMFSL partition is reduced and if all is good, just restore the previous configuration

a. Enable SSH on ESXi host

b. Copy the bundle to ESXi host

fmbp16$ scp configBundle-eeny.tgz eeny:/tmp/
(root@10.8.4.2) Password:
configBundle-eeny.tgz

c. Rename it by removing dash host (-eeny):

[root@eeny:/tmp] mv configBundle-eeny.tgz configBundle.tgz

d. Put the host in maintenance mode (recommended by VMware, not sure if at this stage is really necessary but it wont hurt doing it)

[root@eeny:/tmp] esxcli system maintenanceMode set --enable yes

e. Execute the restore command and be aware the system will reboot as soon as you run it:

[root@eeny:/tmp] vim-cmd hostsvc/firmware/restore_config /tmp/configBundle.tgz
Connection to 10.8.4.2 closed by remote host.
Connection to 10.8.4.2 closed.
fmbp16$

And done :)

More details on linked videos

VMware KB regarding systemMediaSize

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.