Editing configuration files in VMware ESXi and ESX
search cancel

Editing configuration files in VMware ESXi and ESX

book

Article ID: 306494

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides steps to edit files in VMware ESX and VMware ESXi only when required while troubleshooting or when you want to create a backup of file.


Environment

VMware ESXi 3.5.x Installable
VMware vSphere ESXi 5.0
VMware vSphere ESXi 5.5
VMware ESXi 3.5.x Embedded
VMware ESX 4.0.x
VMware ESXi 4.1.x Embedded
VMware ESX Server 3.5.x
VMware ESXi 4.1.x Installable
VMware ESXi 4.0.x Embedded
VMware ESX 4.1.x
VMware ESXi 4.0.x Installable

Resolution

Datastore Browser

 
This section is applicable to all versions of VMware ESX and ESXi.
 
To download, edit and upload files to a datastore using the Datastore Browser:
  1. Open the vSphere Client and connect to the vCenter, ESX or ESXi machine using appropriate administrator-level credentials.
  2. Select an ESXi or ESX host that can access the datastore containing the files you want to edit.
  3. Click the Configuration tab > Storage.
  4. Right-click on the datastore and click Browse Datastore.
  5. In the left pane, navigate to the directory that contains the files.
  6. In the right pane, right-click on the file and click Download.
  7. Download the file and make note of its location.
  8. Open a preferred text editor. For more information about preferred editors, see Preferred Editors in this article.
  9. Open the downloaded file, edit it, and save the file.
  10. Return to the vSphere Client.
  11. Right-click on the original file and click Rename.
  12. Add a .bak extension to the file name. This step is optional but ensures that any changes can be reverted easily.
  13. Identify the folder in the left pane where you want to upload the modified file.
  14. Click the upload icon in the toolbox. The icon is a cylinder with a green arrow pointing up.
  15. Click Upload File.
  16. Navigate to and click the file you just modified.
  17. Click Open.
  18. A warning appears concerning file naming and the potential to overwrite files. Read the warning and click Yes.

vSphere Management Assistant and vSphere Command-Line Interface

This section is applicable to VMware ESX 3.5 Update 2 and later.
 
To download, edit and upload files to a datastore using the vifs utility:
  1. Open a console to your vSphere Management Assistant (vMA) appliance or a vSphere Command-Line Interface (CLI).
  2. Download the file and edit by executing:

    vifs.pl <connection parameters> --get '[<datastore>] <path>/<filename>' <localpath>/<filename>

    Where:
    • <connection parameters> specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    • <datastore> is the name of the datastore that contains the file.
    • <path> is the path within the datastore that contains the file.
    • <filename> is the name of the file.
    • <localpath> is the path where you can download the file to. Make note of this location.

      For more information and examples about the vifs utility, see Performing File System Operations with vifs in the vSphere CLI documentation.
       
  3. Modify the file as required using the vMA or transfer it to another system for modification. If you are using the vCLI, proceed to the following step.
  4. Open a preferred text editor. For more information about preferred editors, see Preferred Editors in this article.
  5. Open the downloaded file, modify it as required, and save the file.
  6. Return to the vMA appliance console or vSphere CLI.
  7. Make a backup copy of the original by executing:

    vifs.pl <connection parameters> --move '[<datastore>] <path>/<filename>' '[<datastore>] <path>/<filename>.bak'

    Where:
    • <connection parameters> specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    • <datastore> is the name of the datastore that contains the file. For our purposes, both <datastore> values should be the same.
    • <path> is the path within the datastore that contains the file. For our purposes, both <path> values should be the same.
    • <filename> is the name of the file. For our purposes, the second <filename> value should include a .bak extension to indicate a backup copy.

      Caution: Omitting the additional .bak extension to the destination file name will result in overwriting your original file.

      For more information and examples about the vifs utility, see Performing File System Operations with vifs section of the vSphere CLI documentation
      .

       
  8. Upload the modified file to the original location by executing:

    vifs.pl <connection parameters> --put <localpath>/<filename> '[<datastore>] <path>/<filename>'

    Where:
    • <connection parameters> specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    • <datastore> is the name of the datastore that contains the file.
    • <path> is the path within the datastore that contains the file.
    • <filename> is the name of the file.
    • <localpath> is the path where you will download the file to. Make note of this location.

      For more information and examples about the vifs utility, see Performing File System Operations with vifs section of the vSphere CLI documentation.

VMware ESXi or ESX Terminal

This section applies to VMware ESXi and ESX 4.1 and earlier.
 
To edit files using the VMware ESX Service Console or VMware ESXi Technical Support Mode:
  1. Log in to the VMware ESX host as the root user.
  2. Make a backup copy of the file by executing:

    cp <path>/<filename> <path>/<filename>.bak

    Where:
    • <path> is the full path of the file.
    • <filename> is the name of the file.


      Note: The second parameter in the cp command should have a filename with the .bak extension to indicate that it is a backup copy.
       
  3. Edit the file by executing:

    <editor> <path>/<filename>

    Where:
    • <editor> is your preferred editor. For more information about preferred editors, see Preferred Editors in this article.
    • <path> is the full path to the file.
    • <filename> is the name of the file.
       
  4. If prompted to overwrite, ensure that you have made a backup copy and type y. Press Enter to commit your changes.

Preferred Editors

There are different editors to choose from, depending on your running platform. This is non-exhaustive list of editors available in different platforms:
  • VMware ESX includes the open source terminal-based editors nano and vi.
  • VMware ESXi includes the open source terminal-based editor vi.
  • Windows-based machines include basic text editors such as Notepad and Wordpad. If you are using either of these text editors, you must ensure that you are saving files in their original format and encoding.
Notes:
  • The editors available in the shell (vi or nano) are meant for troubleshooting purposes only and must be used only when directed by VMware. The vSphere Client, vCLI, and PowerCLI should be the primary method of propagating changes to your ESX/ESXi host.
  • Notepad saves documents as ANSI text which may not be the same file format as the files downloaded from a VMware ESX or ESXi host. For more information, see Using different language formats in Notepad from Microsoft's Windows XP Professional Product Documentation.
 
Additional Information:
 
For translated versions of this article, see:
 


Additional Information

Recreating a missing virtual machine disk descriptor file
Tech Support Mode for Emergency Support
Unable to connect to an ESX host using Secure Shell (SSH)
El host ESX 4.x falla su proceso de inicio con el error: fsck.ext3: Unable to resolve UUID
Editando arquivos de configuração no ESXi e no ESX da VMware
VMware ESXi / ESX の設定ファイルの編集
Edición de archivos de configuración en VMware ESXi y ESX
vMotion が 14% の時点で失敗し、次のエラーが表示される: 移行開始要求の待機中にタイム アウトになりました
在 VMware ESXi 和 ESX 中编辑配置文件
ネットワークの瞬断が発生すると、仮想マシンから NFS 上の ISO イメージへの接続が切れる
Active Directory ドメインのアカウントを使用して ESXi ホストにログインすることができない