Taking a vCenter Server VAMI backup from the command line
search cancel

Taking a vCenter Server VAMI backup from the command line

book

Article ID: 373076

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

In situations where the vCenter Server Appliance Management Interface (VAMI) is inaccessible or non-functional, administrators cannot initiate file-based backups via the web UI. This article provides the steps to manually execute a vCenter Server file-based backup directly from the command line(CLI) to ensure environment data is secured for restores at a later time.

Environment

All versions of vCenter Server Appliance

Resolution

  1. SSH to the vCenter server.
  2. Verify the current shell environment. The Appliance Shell displays as "Command>", while the Bash shell displays as "root@hostname [ ~ ]#".
    • When you log into your SSH and you automatically arrive at a "root@hostname [ ~ ]#" you will need to enable the appliance shell by running:

      chsh -s /bin/appliancesh root

    • Toggle your shell environment as needed:
      • Bash to Appliance Shell: Type "exit" and press enter.
      • Appliance Shell to Bash: Type "shell"  and press enter.
  3. Initiate the backup. (In the below example, the SFTP protocol is used. Change to the desired backup protocol as needed):

    dcli com vmware appliance recovery backup job create --location-type SFTP --location sftp://<FQDN_OR_IP_OF_BACKUP_SERVER>/<BACKUP_LOCATION_DIRECTORY> --location-user <BACKUP_LOCATION_USER> --location-password <BACKUP_LOCATION_USER_PASSWORD> +username <administrator@EXAMPLE_DOMAIN> +password <VC_ADMIN_PASSWORD>

    Note: The following options will need to be changed in the above command:
    • FQDN_OR_IP_OF_BACKUP_SERVER will be the FQDN or IP address of the backup server.
    • BACKUP_LOCATION_DIRECTORY will be the path to the directory on the backup server for the backup to be saved to.
    • BACKUP_LOCATION_USER will be the username configured for access to the backup server.
    • BACKUP_LOCATION_USER_PASSWORD will be the password for the user configured for access to the backup server.
    • administrator@EXAMPLE_DOMAIN will be a vCenter server administrator account needed to run dcli commands. The default user of [email protected] can be used for this.
    • VC_ADMIN_PASSWORD will be the password for the vCenter server administrator account needed to run dcli commands.
  4. Example output of a successful initiation:
    start_time: YYYY-MM-DDThh:mm:ssZ
    end_time:
    messages:
       - args:
         default_message: Backup job started.
         id: com.vmware.applmgmt.backup.started
    
    progress: 0
    id: 20240725-125749-#######
    state: INPROGRESS
  5. Note backup job ID. In the above example, the backup job ID is 20240725-125749-#######.
  6. To get a status on the backup job, run the following command using the ID noted from the previous step:

    dcli com vmware appliance recovery backup job get --id 20240725-125749-####### +username <administrator@EXAMPLE_DOMAIN> +password <VC_ADMIN_PASSWORD>

    Note
    • administrator@EXAMPLE_DOMAIN will be a vCenter server administrator account needed to run dcli commands. The default user of [email protected] can be used for this. 
    • VC_ADMIN_PASSWORD will be the password for the vCenter server administrator account needed to run dcli commands.
  7. Example output of a successful backup:
    start_time: YYYY-MM-DDThh:mm:ssZ
    end_time: YYYY-MM-DDThh:mm:ssZ
    messages:
    progress: 100
    id: 20240725-125749-#######
    state: SUCCEEDED

Additional Information

To get a report on all backup jobs:

dcli com vmware appliance recovery backup job details list +username <administrator@EXAMPLE_DOMAIN> +password <VC_ADMIN_PASSWORD>