1 Reply Latest reply on Jul 24, 2019 10:26 AM by ascotlx

    Option To Only Backup Running VMs?

    CinciTech Enthusiast

      I deployed GhettoVCB at a customer's site where they had a single vhost, where nightly backups go to a RAID1 array on a NAS on a separate VLAN and everyone's happy.  We've added a second vhost, and got another NAS for setting up High Availability (NFS shares).  Then everyone learned that the Essentials license wasn't enough for HA, and Essentials Plus was cost-prohibitive, and so now my customer is operating with two vhosts and one NAS and no vMotion.  In practice we have several VMs registered on both vhosts which live on the shared storage, and these run on one host or the other, and if a vhost needs taken down for maintenance they just power off the VM and power it on at the secondary vhost.  Each night when ghettoVCB runs, it attempts to back up all VMs on the vhost it's running on, which includes VMs running on the other vhost.  The result is errors because it can't access a VM which is locked on another host.  The nightly email log goes out crying about failures, but it's not REALLY failures so much as an overzealous script trying to access things outside of its control.

       

      So, with that scenario in mind, I'm curious if anyone has configured ghettoVCB to backup ONLY VMs which are currently running.  I don't want to manually maintain a config file of what VMs to backup, just backup all running VMs on the vhost.

        • 1. Re: Option To Only Backup Running VMs?
          ascotlx Lurker

          # at first you need all vm's and id's

          vim-cmd vmsvc/getallvms|grep ^[[:digit:]]|sed 's/\[.*//'

          # put this in an while loop and read the result in 2 variables (e.g. VID and VMName)

          # at next look at the status and put the VMName in your list ...

          if [ "$(vim-cmd vmsvc/power.getstate ${VID}|grep "Powered")" = "Powered on" ] ; then

            echo ${VMName} > listtosave

          fi