ghettoVCBg2 - Free alternative for backing up VMs in ESX(i) 3.5 and 4.x (no SSH console required!)

    Table of Contents:

      • Description
      • Features
      • Requirements
      • ESX/ESXi Version Support Table
      • Setup
      • Addings ESX/ESXi host(s) to VIMA/vMA
      • Configurations
      • Usage
      • Sample Execution 
        • Backup VMs located in a list
        • Backup VMs using individual backup policies
        • Dryrun Mode
      • Experimental Features
      • FAQ
      • Useful Links
      • Change Log

     

    Description:

    This tool is the follow up release of the ghettoVCB

    backup utility which allows users to perform backups of virtual machines residing on ESX(i) 3.5+/4.x+

    servers using methodology similar to VMware's VCB

    tool. By incorporating highly constructive feedback from the VMware  community and utilizing the existing VI API, ghettoVCB’s framework was  completely rewritten to be harder, better, faster, stronger

    .

     

    The primary motivation for ghettoVCBg2 was to provide ESXi users with  access to the utility without relying on unlocking and utilizing the  unsupported console. To satisfy this requirement, the rebuilt framework  takes advantage of the

    VI Perl Toolkit/vSphere SDK for Perl which is present in the

    VIMA/vMA virtual appliance provided by VMware. As a result, ghettoVCBg2 provides  a more proper backup solution that administrators can utilize in their  virtual infrastructure.

     

     

    As it stands, it is a requirement that ghettoVCB be invoked directly on  each of the ESX servers hosting virtual machines in need of a backup. By  taking advantage of VIMA/vMA, the entire backup process becomes  centralized in turn eliminating the abovementioned requirement.  Additionally, by leveraging the vi-fastpass library, unattended  authentication between VIMA/vMA and target ESX servers is made possible.  This alleviates the need to continually pass in credentials for each  ESX server.

     

     

    By centralizing the backup process, individual virtual machine backup  lists pertaining to their respective ESX(i) servers are no longer  required. ghettoVCBg2 has the ability to identify virtual machines and  their respective hosts, potentially eliminating any past confusion  associated with maintaining multiple lists.

     

     

    In its current configuration, the script will allow up to 3 unique  backups of the Virtual Machine before it will overwrite the previous  backups; this however, can be modified to fit procedures if need be.  Please be diligent in running the script in a test or staging  environment before using it on production live Virtual Machines; this  script functions well within our environment but there is a chance that  it may not fit well into other environments.

     

     

    Features

    • Support for logging (normal & verbose)
    • Single VM backup list across multiple ESX/ESXi host(s)
    • Credential-less backups (so long as host(s) are being managed by VIMA/vMA)
    • Online back up of VM(s)
    • Only valid VMDKs presented to the VM will be backed up
    • Support for multiple VMDK backup per VM
    • Preserve original powerState of VM(s)
    • Ability to shutdown guestOS, initiate backup process and power on VM afterwards with the option of hardpower timeout
    • Ensure that snapshot removal process completes prior to continuing the backup process
    • VM(s) that initially contain snapshots and Physical RDMs (raw device mapppings) will not be backed up
    • Support for VM(s) with Virtual RDMs
    • Ability to specify the number of backup rotations per VM
    • Output back up VMDKs in ZEROEDTHICK (default behavior), EAGERZEROEDTHICK, 2GB SPARSE or THIN format
    • Ouput backup VMDKs using either BUSLOGIC or LSILOGIC adapter type
    • Fully support VMDKs stored across multiple datastores
    • VM snapshot memory and quiesce options
    • Individual VM backup policy (supported on ESX(i) 3.5u2+ & ESX(i) 4.x+)
    • Email logs (Experimental Support) NEW!
    • Ability to include/exclude specific VMDK(s) per VM (requires individual VM backup policy setup) NEW!
    • Independent disk aware (will ignore VMDK) NEW!
    • Additional debugging information including dry run execution NEW!

     


    Requirements:

    VMs running on ESX(i) 3.5u2+ or ESX(i) 4.x+

    VMware VIMA 1.0 or VMware vMA 4.x

     


    ESX/ESXi Version Support Table

    VersionSupportAlternative
    ESX 3.5u2Requires at least Foundation/Essentials licenseghettoVCB\
    ESX 3.5u3Requires at least Foundation/Essentials licenseghettoVCB\
    ESX 3.5u4Requires at least Foundation/Essentials licenseghettoVCB\
    ESXi 3.5u2Works for freeghettoVCB\
    ESXi 3.5u3Works for freeghettoVCB\
    ESXi 3.5u4Requires at least Foundation/Essentials licenseghettoVCB\
    ESX 4.0Requires at least Foundation/Essentials licenseghettoVCB\
    ESXi 4.0Requires at least Foundation/Essentials licenseghettoVCB\
    ESX 4.1Requires at least Foundation/Essentials licenseghettoVCB\
    ESXi 4.1Requires at least Foundation/Essentials licenseghettoVCB\


     


    Setup:

    1) Download ghettoVCBg2.tar.gz

    to your VIMA 1.0/vMA 4.x system

     

    2) Extract the contents of the tarball

     

    [vi-admin@scofield ~]$ tar -zxvf ghettoVCBg2.tar.gz
    ghettoVCBg2/
    ghettoVCBg2/ghettoVCBg2-vm_backup_configuration_template
    ghettoVCBg2/ghettoVCBg2.pl

     

     

    3) The script should be in a directory called

    ghettoVCBg2

     


    Addings ESX/ESXi host(s) to VIMA/vMA

    Prior to starting, ensure that the VMware VIMA/vMA host is managing the appropriate ESX(i) 3.5u2/4.x+ host(s)

     

    1. Add ESXi hosts to VIMA/vMA managment using vifp

     

     

    A password prompt for the vi-admin account and root password to the pertinent ESXi host(s) will be presented.

     

     

    [vi-admin@vima-primp-industries ~]$ sudo vifp addserver olga.resnet.ucsb.edu
    root@olga.resnet.ucsb.edu's password:
    [vi-admin@vima-primp-industries ~]$

     

    2. Verify that the appropriate hosts are being managed by VIMA/vMA

    [vi-admin@vima-primp-industries ~]$ sudo vifp listservers
    olga.resnet.ucsb.edu
    himalaya.primp-industries.com

     

     


    Configurations

    The following variables (similar to that of ghettoVCB) need to be defined within the script prior to execution.

     

    Defining the datastore in which the backups are stored:

     

    my $VM_BACKUP_DATASTORE = "dlgCore-NFS-bigboi.VM-Backups";

    Defining the name of folder that will contain backups (if folder does not exist, it will automatically be created):

     

    my $VM_BACKUP_DIRECTORY = "WILLIAM_BACKUPS";

    Defining the backup rotation per VM:

     

    my $VM_BACKUP_ROTATION_COUNT = "3";

    Defining the backup disk format (zeroedthick, eagerzeroedthick, thin, and 2gbsparse are available):

     

     

    my $DISK_BACKUP_FORMAT = "zeroedthick";

    Defining the adapter type for backed up VMDK (buslogic, and lsilogic are available):

     

    my $ADAPTER_FORMAT = "buslogic";

    Defining whether the VM is powered down or not prior to backup (1 = enable, 0 = disable):

     

    Note: VM(s) that are powered off will not require snapshoting

    my $POWER_VM_DOWN_BEFORE_BACKUP = "0";

    Defining whether virtual machine memory is snapped and if quiescing is enabled (1 = enable, 0 = disable):

     

    Note: By default both are disabled

    my $VM_SNAPSHOT_MEMORY = "0";
    my $VM_SNAPSHOT_QUIESCE = "0";

    Defining the detail of logging (verbose or normal):

     

    my $LOG_LEVEL = "normal";

    *Defining VMDK(s) to backup from a particular VM either a list of vmdks or "all"

    VM_VMDK_FILES="myvmdk.vmdk"

     

    Experimental Support Configs:

    Note: Port 25 by default

    my $SEND_MAIL = "no";
    my $EMAIL_HOST = "emailserver";
    my $EMAIL_DOMAIN = "localhost.localdomain";
    my $EMAIL_TO = 'William Lam <william@primp-industries.com.com>';
    my $EMAIL_FROM = 'ghettoVCBg2 <ghettoVCBg2@primp-industries.com.com>';

    Ensure that you do not edit past this section:

     

    ########################## DO NOT MODIFY PAST THIS LINE ##########################

     

     


    Usage:

    [vi-admin@scofield ~]$ ./ghettoVCBg2.pl
    Required command option 'vmlist' not specified.

    Synopsis: ./ghettoVCBg2.pl OPTIONS


    Command-specific options:
       --config_dir
          Name of directory containing VM(s) backup configurations
       --dryrun (default '0')
          Set to 1 to enable dryrun mode (default 0)
       --output (default '/tmp/ghettoVCBg2.log')
          Full path to output log (default /tmp/ghettoVCBg2.log)
       --vmlist (required)
          A file containing a list of virtual machine(s) to be backed up on host

    Common VI options:
       --config (variable VI_CONFIG)
          Location of the VI Perl configuration file
       --credstore (variable VI_CREDSTORE)
          Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows
       --encoding (variable VI_ENCODING, default 'utf8')
          Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)
       --help
          Display usage information for the script
       --passthroughauth (variable VI_PASSTHROUGHAUTH)
          Attempt to use pass-through authentication
       --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')
          Pass-through authentication negotiation package
       --password (variable VI_PASSWORD)
          Password
       --portnumber (variable VI_PORTNUMBER)
          Port used to connect to server
       --protocol (variable VI_PROTOCOL, default 'https')
          Protocol used to connect to server
       --savesessionfile (variable VI_SAVESESSIONFILE)
          File to save session ID/cookie to utilize
       --server (variable VI_SERVER, default 'localhost')
          VI server to connect to. Required if url is not present
       --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')
          Service path used to connect to server
       --sessionfile (variable VI_SESSIONFILE)
          File containing session ID/cookie to utilize
       --url (variable VI_URL)
          VI SDK URL to connect to. Required if server is not present
       --username (variable VI_USERNAME)
          Username
       --verbose (variable VI_VERBOSE)
          Display additional debugging information
       --version
          Display version information for the script

     

    Note: There are some additional command line arguments that can be provided upon runtime: --debug, --output and --vmlist. --vmlist is the only parameter required. The rest will have defaults if not explicitly defined.

    --dryrun

    • Dry run information will be written to the log and no backup will take place

    --output

     

    • Name of the output log, if the same log is used, it will  automatically append (ensure you provide full path e.g.  /tmp/ghettoVCBg2.log)

    --config_dir

     

    • This directory will contain the individual VM backup policy files.  If a virtual machine has an associated policy file, the global  configuration will be ignored for that backup instance.

     

    The input to this script is a file that contains the display name of the  virtual machine(s) separated by a newline. When creating this file on a  non-Linux/UNIX system, you may introduce a ^M character which may cause  the script to misbehave. To ensure that this does not occur, please  create the file on the ESX/ESXi host.

     

     

    Provided is a sample of what the file should contain:

     

     

    [vi-admin@scofield ~]$ cat virtual_machine_backup_list
    VIMA
    vMA-2

     

     


    Sample Execution

    • Backup VMs located in a list
    • Backup VMs based on individual VM backup policies
    • Debug Mode
    • Dry run Mode

     

    Backup VMs located in a list

    • Log verbosity: info (default)
    • Log output: /tmp/ghettoVCBg2.log (default)

     

    DISK_FORMAT2gbsparse
    ADAPTER_FORMATbuslogic
    LOG_LEVELinfo
    VM_SNAPSHOT_MEMORY0
    VM_SNAPSHOT_QUIESCE0
    VMS_TO_BACKUP(VIMA,vMA-2)


     

    [vi-admin@scofield ~]$ ./ghettoVCBg2.pl --vmlist virtual_machine_backup_list

    [vi-admin@scofield ~]$ cat /tmp/ghettoVCBg2.log
            11-13-2009 23:34:53 --  info: ============================== ghettoVCBg2 LOG START ==============================
            11-13-2009 23:34:53 --  info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCBg2.log
            11-13-2009 23:34:53 --  info: CONFIG - VM_BACKUP_DATASTORE = dlgCore-NFS-bigboi.VM-Backups
            11-13-2009 23:34:53 --  info: CONFIG - VM_BACKUP_DIRECTORY = WILLIAM_BACKUPS
            11-13-2009 23:34:53 --  info: CONFIG - DISK_BACKUP_FORMAT = 2gbsparse
            11-13-2009 23:34:53 --  info: CONFIG - ADAPTER_FORMAT = buslogic
            11-13-2009 23:34:53 --  info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = NO
            11-13-2009 23:34:53 --  info: CONFIG - VM_SNAPSHOT_MEMORY = NO
            11-13-2009 23:34:53 --  info: CONFIG - VM_SNAPSHOT_QUIESCE = NO
            11-13-2009 23:34:53 --  info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2009-11-13
            11-13-2009 23:34:53 --  info: CONFIG - VM_VMDK_FILES = all

            11-13-2009 23:34:58 --  info: Initiate backup for VIMA found on himalaya.primp-industries.com
            11-13-2009 23:35:18 --  info: VIMA has 1 VMDK(s)
            11-13-2009 23:37:37 --  info: Backup completed for VIMA!

            11-13-2009 23:37:37 --  info: Initiate backup for vMA-2 found on himalaya.primp-industries.com
            11-13-2009 23:37:47 --  info: vMA-2 has 1 VMDK(s)
            11-13-2009 23:40:07 --  info: Backup completed for vMA-2!

            11-13-2009 23:40:10 --  info: ============================== ghettoVCBg2 LOG END ==============================

     

     

    Backup VMs based on individual VM backup policies and log output to /tmp/ghettoVCB.log

    • Log verbosity: info (default)
    • Log output: /tmp/ghettoVCB.log (default)

     

    VIMA

     

    VM_BACKUP_DATASTOREdlgCore-NFS-bigboi.VM-Backups
    VM_BACKUP_DIRECTORYWILLIAM_BACKUPS
    DISK_FORMATzeroedthick
    ADAPTER_FORMATbuslogic
    LOG_LEVELdebug
    VM_SNAPSHOT_MEMORY1
    VM_SNAPSHOT_QUIESCE1
    VM_VMDK_FILESVIMA_1.vmdk


     

    vMA-2

     

    VM_BACKUP_DATASTOREdlgCore-NFS-bigboi.VM-Backups
    VM_BACKUP_DIRECTORYvGHETTO_BACKUPS
    DISK_FORMATthin
    ADAPTER_FORMATlsilogic
    LOG_LEVELinfo
    VM_SNAPSHOT_MEMORY0
    VM_SNAPSHOT_QUIESCE0
    VM_VMDK_FILESall


     

    1. Create folder to hold individual VM backup policies (can be named anything):

     

    [vi-admin@scofield ~]$ mkdir backup_config

     

    2. Create individual VM backup policies for each VM and ensure each file  is named exactly as the display name of the VM being backed up (use  provided template to create duplicates):

    [vi-admin@scofield backup_config]$ cp ghettoVCBg2-vm_backup_configuration_template VIMA
    [vi-admin@scofield backup_config]$ cp ghettoVCBg2-vm_backup_configuration_template vMA-2

     

    4. Using a preferred editor (nano or vi), edit each VM backup policy file

    Listing of VM backup policy within backup configuration directory

    [vi-admin@scofield backup_config]$ ls
    ghettoVCBg2-vm_backup_configuration_template  VIMA  vMA-2

     

    5. Pass in the value, backup_config, into the --config_dir parameter

    (e.g.)
    --config_dir backupConfigs

    Example of two distinct VM backup policies will be applied to VIMA and vMA-2

    Backup policy for "VIMA" (backup only 1 specific VMDKs)

    [vi-admin@scofield backup_config]$ cat VIMA
    VM_BACKUP_DATASTORE = "dlgCore-NFS-bigboi.VM-Backups"
    VM_BACKUP_DIRECTORY = "WILLIAM_BACKUPS"
    VM_BACKUP_ROTATION_COUNT = "3"
    DISK_BACKUP_FORMAT = "zeroedthick"
    ADAPTER_FORMAT = "buslogic"
    POWER_VM_DOWN_BEFORE_BACKUP = "0"
    VM_SNAPSHOT_MEMORY = "1"
    VM_SNAPSHOT_QUIESCE = "1"
    LOG_LEVEL = "debug"
    VM_VMDK_FILES = "VIMA_1.vmdk"

     

    Backup policy for VM "vMA-2" (backup all VMDKs found)

    VM_BACKUP_DATASTORE = "dlgCore-NFS-bigboi.VM-Backups"
    VM_BACKUP_DIRECTORY = "vGHETTO_BACKUPS"
    VM_BACKUP_ROTATION_COUNT = "3"
    DISK_BACKUP_FORMAT = "thin"
    ADAPTER_FORMAT = "lsilogic"
    POWER_VM_DOWN_BEFORE_BACKUP = "0"
    VM_SNAPSHOT_MEMORY = "0"
    VM_SNAPSHOT_QUIESCE = "0"
    LOG_LEVEL = "info"
    VM_VMDK_FILES = "all"

     

    The following is an output of the script when utilizing the new --config_dir parameter with debug mode enabled.

    Note: --vmlist is still a required  parameter with the exception that backup policy files must exist for  each VM in the list else the VM will be ignored in the backup process.

    Execution of backup

    [vi-admin@scofield ~]$ ./ghettoVCBg2.pl --config_dir backup_config --vmlist virtual_machine_backup_list

    [vi-admin@scofield ~]$ cat /tmp/ghettoVCBg2.log
            11-14-2009 00:18:41 --  info: ============================== ghettoVCBg2 LOG START ==============================
            11-14-2009 00:18:45 --  info: CONFIG - USING CONFIGURATION FILE = VIMA
            11-14-2009 00:18:45 --  info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCBg2.log
            11-14-2009 00:18:45 --  info: CONFIG - VM_BACKUP_DATASTORE = dlgCore-NFS-bigboi.VM-Backups
            11-14-2009 00:18:45 --  info: CONFIG - VM_BACKUP_DIRECTORY = WILLIAM_BACKUPS
            11-14-2009 00:18:45 --  info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
            11-14-2009 00:18:45 --  info: CONFIG - ADAPTER_FORMAT = buslogic
            11-14-2009 00:18:45 --  info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = NO
            11-14-2009 00:18:45 --  info: CONFIG - VM_SNAPSHOT_MEMORY = YES
            11-14-2009 00:18:45 --  info: CONFIG - VM_SNAPSHOT_QUIESCE = YES
            11-14-2009 00:18:45 --  info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2009-11-14
            11-14-2009 00:18:45 --  info: CONFIG - VM_VMDK_FILES = VIMA_1.vmdk

            11-14-2009 00:18:45 --  info: Initiate backup for VIMA found on himalaya.primp-industries.com
            11-14-2009 00:18:55 --  debug: VIMA original powerState: poweredOn
            11-14-2009 00:18:55 --  debug: Creating Snapshot "ghettoVCBg2-snapshot-2009-11-14" for VIMA
            11-14-2009 00:19:45 --  info: VIMA has 2 VMDK(s)
            11-14-2009 00:19:45 --  debug: findVMDKFile: Found VMDK File: VIMA_1.vmdk
            11-14-2009 00:19:45 --  debug: backupVMDK: Backing up "[http://himalaya-local-SAS.Savvio|http://himalaya-local-SAS.Savvio] VIMA/VIMA_1.vmdk" to "[http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] WILLIAM_BACKUPS/VIMA/VIMA-2009-11-14/VIMA_1.vmdk"
            11-14-2009 00:19:45 --  debug: backupVMDK: Signal copyThread to start
            11-14-2009 00:19:45 --  debug: backupVMDK: Backup progress: Elapsed time 0 min
            11-14-2009 00:19:45 --  debug: copyTask: Wake up and follow the white rabbit, with status: doCopy
            11-14-2009 00:19:45 --  debug: CopyThread: Start backing up VMDK(s) ...
            11-14-2009 00:19:52 --  debug: copyTask: send copySuccess message ...
            11-14-2009 00:19:52 --  debug: copyTask: waiting for next job and sleep ...
            11-14-2009 00:20:46 --  debug: backupVMDK: Successfully completed backup for [http://himalaya-local-SAS.Savvio|http://himalaya-local-SAS.Savvio] VIMA/VIMA_1.vmdk Elapsed time: 1 min
            11-14-2009 00:20:49 --  debug: Removing Snapshot "ghettoVCBg2-snapshot-2009-11-14" for VIMA
            11-14-2009 00:20:51 --  debug: checkVMBackupRotation: Starting ...
            11-14-2009 00:20:57 --  debug: Purging [http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] WILLIAM_BACKUPS/VIMA/VIMA-2009-11-13--3 due to rotation max
            11-14-2009 00:21:05 --  info: Backup completed for VIMA!

            11-14-2009 00:21:05 --  debug: reConfigureBackupParams: VM - vMA-2
            11-14-2009 00:21:05 --  info: CONFIG - USING CONFIGURATION FILE = vMA-2
            11-14-2009 00:21:05 --  info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCBg2.log
            11-14-2009 00:21:05 --  info: CONFIG - VM_BACKUP_DATASTORE = dlgCore-NFS-bigboi.VM-Backups
            11-14-2009 00:21:05 --  info: CONFIG - VM_BACKUP_DIRECTORY = vGHETTO_BACKUPS
            11-14-2009 00:21:05 --  info: CONFIG - DISK_BACKUP_FORMAT = thin
            11-14-2009 00:21:05 --  info: CONFIG - ADAPTER_FORMAT = lsilogic
            11-14-2009 00:21:05 --  info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = NO
            11-14-2009 00:21:05 --  info: CONFIG - VM_SNAPSHOT_MEMORY = NO
            11-14-2009 00:21:05 --  info: CONFIG - VM_SNAPSHOT_QUIESCE = NO
            11-14-2009 00:21:05 --  info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2009-11-14
            11-14-2009 00:21:05 --  info: CONFIG - VM_VMDK_FILES = all

            11-14-2009 00:21:05 --  info: Initiate backup for vMA-2 found on himalaya.primp-industries.com
            11-14-2009 00:21:15 --  info: vMA-2 has 1 VMDK(s)
            11-14-2009 00:23:22 --  info: Backup completed for vMA-2!

            11-14-2009 00:23:25 --  info: ============================== ghettoVCBg2 LOG END ==============================

     

     

    Dry run Mode (no backup will take place)

    • Log verbosity: drymode
    • Log output: /tmp/ghettoVCB.log (default)

     

    [vi-admin@scofield ~]$ ./ghettoVCBg2.pl --config_dir backup_config --vmlist virtual_machine_backup_list --dryrun 1

    [vi-admin@scofield ~]$ cat /tmp/ghettoVCBg2.log
            11-14-2009 00:26:29 --  info: ============================== ghettoVCBg2 LOG START ==============================
            11-14-2009 00:26:34 --  info: CONFIG - USING CONFIGURATION FILE = VIMA
            11-14-2009 00:26:34 --  info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCBg2.log
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DATASTORE = dlgCore-NFS-bigboi.VM-Backups
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DIRECTORY = WILLIAM_BACKUPS
            11-14-2009 00:26:34 --  info: CONFIG - DISK_BACKUP_FORMAT = zeroedthick
            11-14-2009 00:26:34 --  info: CONFIG - ADAPTER_FORMAT = buslogic
            11-14-2009 00:26:34 --  info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = NO
            11-14-2009 00:26:34 --  info: CONFIG - VM_SNAPSHOT_MEMORY = YES
            11-14-2009 00:26:34 --  info: CONFIG - VM_SNAPSHOT_QUIESCE = YES
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2009-11-14
            11-14-2009 00:26:34 --  info: CONFIG - VM_VMDK_FILES = VIMA_1.vmdk

            11-14-2009 00:26:34 --  info: ---------- DRYRUN DEBUG INFO VIMA ----------
            11-14-2009 00:26:34 --  info: DEBUG - Host Build: VMware ESX 4.0.0 build-164009
            11-14-2009 00:26:34 --  info: DEBUG - Host: himalaya.primp-industries.com
            11-14-2009 00:26:34 --  info: DEBUG - Virtual Machine: VIMA
            11-14-2009 00:26:34 --  info: DEBUG - VM ConfigPath: [http://himalaya-local-SAS.Savvio|http://himalaya-local-SAS.Savvio] VIMA/VIMA.vmx
            11-14-2009 00:26:34 --  info: DEBUG - VMX File: VIMA.vmx
            11-14-2009 00:26:34 --  info: DEBUG - BackupConfigPath: [http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] WILLIAM_BACKUPS/VIMA/VIMA-2009-11-14/VIMA.vmx
            11-14-2009 00:26:34 --  info: DEBUG - BackupPath: [http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] WILLIAM_BACKUPS/VIMA/VIMA-2009-11-14
            11-14-2009 00:26:34 --  info: DEBUG - VM Datastore: himalaya-local-SAS.Savvio
            11-14-2009 00:26:34 --  info: DEBUG - VMDK(s):
            11-14-2009 00:26:34 --  info: DEBUG - [http://himalaya-local-SAS.Savvio|http://himalaya-local-SAS.Savvio] VIMA/VIMA.vmdk
            11-14-2009 00:26:34 --  info: DEBUG - [http://himalaya-local-SAS.Savvio|http://himalaya-local-SAS.Savvio] VIMA/VIMA_1.vmdk
            11-14-2009 00:26:34 --  info: ---------- DRYRUN DEBUG INFO VIMA ----------

            11-14-2009 00:26:34 --  debug: reConfigureBackupParams: VM - vMA-2
            11-14-2009 00:26:34 --  info: CONFIG - USING CONFIGURATION FILE = vMA-2
            11-14-2009 00:26:34 --  info: CONFIG - BACKUP_LOG_OUTPUT = /tmp/ghettoVCBg2.log
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DATASTORE = dlgCore-NFS-bigboi.VM-Backups
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DIRECTORY = vGHETTO_BACKUPS
            11-14-2009 00:26:34 --  info: CONFIG - DISK_BACKUP_FORMAT = thin
            11-14-2009 00:26:34 --  info: CONFIG - ADAPTER_FORMAT = lsilogic
            11-14-2009 00:26:34 --  info: CONFIG - POWER_VM_DOWN_BEFORE_BACKUP = NO
            11-14-2009 00:26:34 --  info: CONFIG - VM_SNAPSHOT_MEMORY = NO
            11-14-2009 00:26:34 --  info: CONFIG - VM_SNAPSHOT_QUIESCE = NO
            11-14-2009 00:26:34 --  info: CONFIG - VM_BACKUP_DIR_NAMING_CONVENTION = 2009-11-14
            11-14-2009 00:26:34 --  info: CONFIG - VM_VMDK_FILES = all

            11-14-2009 00:26:34 --  info: ---------- DRYRUN DEBUG INFO vMA-2 ----------
            11-14-2009 00:26:34 --  info: DEBUG - Host Build: VMware ESX 4.0.0 build-164009
            11-14-2009 00:26:34 --  info: DEBUG - Host: himalaya.primp-industries.com
            11-14-2009 00:26:34 --  info: DEBUG - Virtual Machine: vMA-2
            11-14-2009 00:26:34 --  info: DEBUG - VM ConfigPath: [http://himalaya-local-SAS.Constellation|http://himalaya-local-SAS.Constellation] vMA-2/vMA-2.vmx
            11-14-2009 00:26:34 --  info: DEBUG - VMX File: vMA-2.vmx
            11-14-2009 00:26:34 --  info: DEBUG - BackupConfigPath: [http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] vGHETTO_BACKUPS/vMA-2/vMA-2-2009-11-14/vMA-2.vmx
            11-14-2009 00:26:34 --  info: DEBUG - BackupPath: [http://dlgCore-NFS-bigboi.VM-Backups|http://dlgCore-NFS-bigboi.VM-Backups] vGHETTO_BACKUPS/vMA-2/vMA-2-2009-11-14
            11-14-2009 00:26:34 --  info: DEBUG - VM Datastore: himalaya-local-SAS.Constellation
            11-14-2009 00:26:34 --  info: DEBUG - VMDK(s):
            11-14-2009 00:26:34 --  info: DEBUG - [http://himalaya-local-SAS.Constellation|http://himalaya-local-SAS.Constellation] vMA-2/vMA-2.vmdk
            11-14-2009 00:26:34 --  info: ---------- DRYRUN DEBUG INFO vMA-2 ----------

            11-14-2009 00:26:37 --  info: ============================== ghettoVCBg2 LOG END ==============================

     

     


     

    FAQ

     

    0Q: I'm having some issues or would like to provide feedback

    0A: Please join the ghettoVCBg2 Group to post your comments/questions

     

    1Q: I'm using ESXi and free licensed version ( I did not pay for anyting ), will this script still work?

    1A: No, you need to have a licensed version of ESXi to use this script.

     

    2Q: I have a VM listed in my backup file but no backup of that VM  took place. The log stated that the VM could not be found. How could  this be? I know that it’s running on host X…

    2A: Ensure the ESX/ESXi host is being managed by VMware VIMA/vMA (sudo vifp listservers to verify)

     

    3Q: Can I schedule backups to take place hourly, daily, monthly, yearly?

    3A: Yes, do a search online for crontab.

     

    4Q: I want to schedule my backup on Windows, how do I do this?

    4A: Do a search for

    plink. Make sure you have paired SSH keys setup between your Windows system and VIMA/vMA.

     

    5Q: Do I have to use VMware VIMA/vMA to initiate the backup?

    5A: Yes, vi-fastpass is being used and only VIMA/vMA provides  this capability. However, you can kickoff the process from another host  (*nix/win)

     

    4Q: I only have a single ESXi host. I want to take backups and  store them somewhere else. The problem is: I don't have NFS, iSCSI nor  FC SAN. What can I do?

    4A: You can use local storage to store your backups assuming that  you have enough space on the destination datastore.  Afterwards, you  can use scp (WinSCP/FastSCP) or vifs (vCLI) to transfer the backups from the ESXi host to your local desktop.

     

    5Q: I’m pissed; the backup is taking too long. My datastore is of type X?

    5A: YMMV, take a look at your storage configuration and make sure it is optimized.

     

    6Q: I noticed that the backup rotation is occurring after a  backup. I don't have enough local storage space, can the process be  changed?

    6A: This is primarily done to ensure that you have at least one  good backup in case the new backup fails. If you would like to modify  the script, you're more than welcome to do so.

     

    7Q: What is the best storage configuration for datastore type X?

    7A: Search the VMTN forums; there are various configurations for the different type of storage/etc.

     

    8Q: I want to setup NFS Server to run my backups. Which is the best and should it be virtual or physical?7

    8A: Please refer to answer 7A. From experience, we’ve seen  physical instances of NFS servers to be faster than their virtual  counterparts.  As always, YMMV.

     

    9Q: When I try to use the script I get an error stating: "restricted version". What the heck is this?

    9A: Please take a look at the ESX/ESXi Version Support Table in this document. The reason is explained here.

     

    10Q: I'm getting error X when using the script or I'm not getting  any errors, the backup didn’t even take place. Oh what could be wrong?

    10A: First, you'll want to check the log (default  /tmp/ghettoVCBg2) and see if there are any obvious errors. If not,  please provide the entire output of the log, a short description of your  environment and the type of VM(s) you're trying to backup—I will try to  provide some assistance.

     

    11Q: I have VMs that have snapshots. I want to back these things up but the script doesn’t let me do it. How do I fix that?

    11A: VM snapshots are not meant to be kept for long durations.  When backing up a VM that contains a snapshot, you should ensure all  snapshots have been committed prior to running a backup. No exceptions  will be made…ever.

     

    12Q: I would like to restore from backup, what is the best method?

    12A: The restore process will be unique for each environment and  should be determined by your backup/recovery plans. At a high level you  have the option of mounting the backup datastore and registering the VM  in question or copy the VM from the backup datastore to the ESX/ESXi  host. The latter is recommended so that you're not running a VM living  on the backup datastore or inadvertently modifying your backup VM(s).

     

    13Q: When using the experimental feature: Individual VM backup policy, if I don't have a policy will it use the default configurations defined in the script?

    13A: No, this use case will not be supported, ever. If you decide  to use the per VM policy, then the global configuration in the script  is ignored. If a VM policy config is not found, the VM will not be  backed up even if it's in the –-vmlist.

     

    14Q: In vMA 4.0, vCenter target will be supported, can I just add vCenter target and assume this will work?

    14A: At the moment, this is not a supported feature. You will  need to add each ESX/ESXi host for the vi-fastpass library to be able to  locate the host(s).

     

    15Q: When I try to run the script I get: "-bash: ./ghettoVCBg2.pl: Permission denied", what is wrong?

    15A: You need to change the permission on the script to be executable, chmod +x ghettoVCBg2.pl

     

    16Q: Where can I download the latest version of the script?

    16A: The latest version is available on this page at the bottom. To get the version of the script run

    ./ghettoVCBg2.pl --version

     

    17Q: I'm running into an issue when I backup my VMs using NFS on  Linux, I'm able to either get 1 successful backup and all subsequent  backups fail OR I'm having issues where snapshots are not being removed  upon completition and future backups fail.

    17A: This problem/issue has been reported by quite a few users in  the community and only affects a very small percentage of users overall  under a specific configuration. The problem as I understand it today  which is still an on-going investigation by myself and the community is  as follows:

     

     

    The Setup

    Setup: NFS on Linux where the underlying volume is EXT3 filesystem

    and backups are failing primarily around larger sized VMs ( > 150GB).

     

    The Observed Problem

    The issue is during the final phase of a VM being backed-up in the  rotation function where a request is sent out to the NFS server to  either A) rotate/rename a directory B) delete an old backup. There is  either a disconnect or delay that severely affects the backup process  that may lead to a whole slew of "unexpected" behavior from having only 1  backup complete successful and all subsquent backups failing/etc.

     

    First off, there is nothing wrong with the script from what we've found  it and has to do with NFS server and specifically the volume that the  backup datastore is hosted on. Thanks to community user

    ralfoertner who had a simliar problem using

    ghettoVCBg2 using Debian with EXT3 base filesystem for his NFS volume. He decided  to do some additional troubleshooting to further isolate the problem and  actually found by changing the underlying filesystem from EXT3 to XFS  that the issue went away and resolve all issues he had ran into  regarding an NFS on Linux backup solution.

     

     

    The Theory

    Now, we're still 100% sure why the above solution has resolved the  problem or what the actual problem is but I'll explain the current  theory:

     

    EXT3 is a journaled filesystem, you can do a search online for more  information. There's a few advantages with EXT3 from it's predcessor  EXT2, but one difference is in the approach it takes with journaling as  explained here in greater detail:

    http://www.ibm.com/developerworks/library/l-fs7.html

     

    Basically EXT2 does only "metadata journling" whereas EXT3 does both  data and metadata journaling, this would ensure that all changes to the  filesystem where it's data or metadata is consistent in the event of an  unexpected system crash. With EXT3, there are 3 journaling options: (

    data=writeback mode,data=ordered mode,data=journal mode ) and by default it uses

    data=ordered mode to ensure the consistency as described from above.

     

     

    One easy method to check what mount options are configured, on a Linux system you can check /proc/mounts:

     

     

    [vi-admin@scofield ~]$ cat /proc/mounts
    rootfs / rootfs rw 0 0
    /dev/root / ext3 rw,data=ordered 0 0
    /dev /dev tmpfs rw 0 0
    /proc /proc proc rw 0 0
    /sys /sys sysfs rw 0 0
    /proc/bus/usb /proc/bus/usb usbfs rw 0 0
    devpts /dev/pts devpts rw 0 0
    /dev/VolGroup00/var /var/log ext3 rw,data=ordered 0 0
    /dev/sda1 /boot ext3 rw,data=ordered 0 0
    tmpfs /dev/shm tmpfs rw 0 0
    none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0

     

     

    So now what does this have to do with XFS and EXT3? With the defaults of  EXT3, it may not always give you the best performance due to the extra  overhead of the way it does its journaling, if you were to change the  options to

    data=writeback mode, you'll notice that this is simliar journaling method found in

    XFS,JFS and ResierFS as described here:

    http://www.ibm.com/developerworks/library/l-fs8.html

     

    The Conclusion

    I believe that there are some additional overheads that maybe caused by  using NFS on EXT3, which may explain the issue that users are seeing and  that moving from EXT3 to XFS has "seemed" to solve the issues for those  who have implemented the change. Though, before you go out and make  this change, you need to understand your environment and what this  change would exactly mean, please refer to differences in EXT2/XFS and  EXT3, especially around a power interruption or system crash.

     

    In conclusion, I'm not recommending one way or the other, it really  depends on your environment. Though this has shown to resolve the issue  as users have implemented to get around this problem, but it's  definitely worth while to really understand the problem in your  environment and figure out why and decide on the best solution. I would  also recommend users perform their own tests to further isolate the  problem in their environment and try local storage, using iSCSI to see  if they can pin-point the problem.

     

     


     

    Useful Links:

     

    If you have found this script or other scripts to be useful and would like to contribute back, please click

    here to donate! Thank You

     

     


     

    Change Log

     

    07/20/10 - build 4.3

     

    Enhancements:

     

    • Support for vSphere 4.1 (ESX and ESXi)

     

    Bug Fixes:

     

    • Due to changes in the VIFP Library introduced with vMA 4.1, the  script has been updated to work on both vMA 4.0 and vMA 4.1. Only  upgrade to vMA 4.1 if you're managing ESX(i) 4.1 hosts

     


     

    03/27/10 - build 4.2

     

    Enhancements:

     

    • Added a check to see if ESX(i) host is in a connected state
    • Added a check to see if ESXi host is using the free license, if so, skip host
    • Added FAQ #0

     

    03/27/10 - build 4.1

     

    Enhancements:

     

    • Updated FAQ #17 regarding "NFS" issue

     


     

    02/24/09 - build 4.1

    Bug Fixes:

     

    • There was a typo in handling the case of a VM's VMDK(s) being  distributed across multiple datastores in which the backup was not  creating the directory to reflect this layout, thanks to briandatamatters for finding this bug.

     

    05/26/09 - build 2.5.1

     

    Enhancements:

     

    • N/A

     

    Bug Fixes:

     

    • Implemented shorterm solution fix for bug in VMware vCLI's vifs
    • Updated logic to allow virtual RDM to be backed up

     


     

    04/25/09 - build 2.5

     

    Enhancements:

     

    • Added experimental feature Individual VM backup policy
    • Added VM snapshot memory & quiesce options

     

    Bug Fixes:

     

    • N/A

     


     

    02/21/09 - build 2.0

     

    Initial release