9 Replies Latest reply on Nov 18, 2012 9:52 AM by lamw

    vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"

    burki68 Lurker

      If you use the Download-Version "lamw-ghettoVCB-518cef7" , you must edit the file ghettoVCB.sh.

       

      If you start the unchange File , you will receive an Errormessage like this:

       

      You're not running ESX(i) 3.5, 4.x, 5.x!

       

      And the script stops to work without any backups.

      To make ghettoVCB runable under ESXi5.1 you must change the following line in ghettoVCB.sh

       

      ESX_VERSION=$(vmware -v | awk '{print $3}')
              if [[ "${ESX_VERSION}" == "5.0.0" ]]; then

       

      to

       

      ESX_VERSION=$(vmware -v | awk '{print $3}')
              if [[ "${ESX_VERSION}" == "5.0.0" ]] || [[ "${ESX_VERSION}" == "5.1.0" ]] ; then

       

      After this ghettoVCB will work fine under ESXi 5.1.0

        • 2. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
          PeterLaudy Lurker

          After fixing the version check, I ran into another small problem. The script checks if the user is root by calling "whoami". On my ESXi 5.1.0 installation this doesn't seem to exist, so the script fails. I made the following change:

           

          Replace the line

           

          if [ ! $(whoami) == "root" ]; then

          with

           

          if [ ! $(env | grep -e "^USER=" | awk -F = '{print $2}') == "root" ]; then

          Am I the only one where "whoami" fails?

          • 3. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
            JoergD Novice

            You are not the only one.

             

            I fixed the problem with $USER instead of $(whoami).

             

             


            • 4. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
              PeterLaudy Lurker

              That's a much cleaner solution.

               

              Another problem I've found was when compressing the backup. The script then tries to call busybox, which is also not found (but does exist of course). You can call "tar" directly, so I just removed the whole "if" statement and replaced it with the line that calls "tar", since I'm only running the script under 5.1.0.

              • 5. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
                makeijan Novice

                $USER alternative to $(whoami) worked great. Thanks.

                 

                I'm not compressing backups (yet) but you could solve tar issue by adding full path instead of removing if statement:

                /usr/lib/vmware/busybox/bin/busybox tar

                • 6. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
                  PeterLaudy Lurker

                  Of course you could, but since I don't have any other version to test this on, I don't know if the path is the same on every version. But perhaps other users which do have older installations can clear this up.

                   

                  Compression is not something I will be using on the production machine. It takes much to long to make a compressed backup. With thin provisioning we have plenty of disk space left at the moment. It is nice to create a backup that can be put on a DVD every once and a while, but then I just compress it "by hand".

                   

                  It's also not possible to restore compressed backups with this scipt. You would have to unzip by hand before restoring it. I know the command line option is there, but the code is missing. I've made an implementation of decompressing the backup in the script. In case somebody wants to use it:

                   

                   

                    #supports DIR or .TGZ from ghettoVCB.sh ONLY!
                    ARCHIVE_DIR=''
                    if [ -f "${VM_TO_RESTORE}" ]; then
                      # Remove everything after the last backslash
                      ARCHIVE_DIR=$(echo ${VM_TO_RESTORE} | sed -e 's/\(.*\)\(\..*\)/\1/')
                      WORK_DIR=$(echo ${VM_TO_RESTORE} | sed -e 's/\(.*\/\)\(.*\)/\1/')
                      logger "Decompressing VM backup \"${VM_TO_RESTORE}\"..."
                      tar -zx -C "${WORK_DIR}" -f "${VM_TO_RESTORE}"

                      # Verify compression
                      if [[ $? -eq 0 ]] && [[ -d "${ARCHIVE_DIR}" ]]; then
                        logger "Successfully decompressed backup for ${VM_TO_RESTORE}!\n"
                        VM_TO_RESTORE="${ARCHIVE_DIR}"
                      else
                        logger "Error in decompressing ${VM_TO_RESTORE}!\n"
                      fi
                   
                  fi

                    if [ -d "${VM_TO_RESTORE}" ]; then

                   

                  The first and last line of the code snippet are already part of the backup script (line 163-164). This code just decompresses the archive and then backups from the created directory. If you want to cleanup this directory afterwards, you could add the following code to the script:

                   

                   

                    # Remove the unpacked directory
                    if [ "" != "${ARCHIVE_DIR}" ]; then
                      logger "Removing ${ARCHIVE_DIR}"
                      rm -rf "${ARCHIVE_DIR}"
                    fi

                   

                  I've put this code at the end of the ghettoVCBrestore method, just above the last "fi" statement.

                   

                  No guarantees it works on other system to, but maybe it can be used as a starting point for you own solution.

                  • 7. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
                    alancondori Lurker

                    Hello.

                     

                    I have installed Esxi 5 and throws me the following error:

                     

                     

                     

                    ./ghettoVCB.sh: line 1207: awk: not found
                    ./ghettoVCB.sh: line 1207: awk: not found
                    You're not running ESX(i) 3.5, 4.x, 5.x!
                    Thanks a lot!!!!!
                    • 8. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
                      joffe Novice

                      Beste,

                       

                      Ik ben vanaf 29-10-2012 tot en met 2-11-2012 niet op kantoor.

                       

                      Vriendelijke groeten,

                       

                      Joffe De Peuter

                      De informatie die in deze e-mail staat is vertrouwelijk en uitsluitend bestemd voor de persoon aan wie ze gericht is. Indien u niet de bedoelde bestemmeling bent, gelieve dit bericht dan naar de verzender terug te sturen en de inhoud te verwijderen uit uw computer. Dit bericht geldt als informatie maar verbindt de dienstverlenende vereniging IOK en/of opdrachthoudende vereniging IOK Afvalbeheer niet. De inhoud geldt alleen als hij later wordt bevestigd met een brief ondertekend door een gemachtigd vertegenwoordiger. IOK noch IOK Afvalbeheer kunnen aansprakelijk gesteld worden op grond van de inhoud van dit bericht of van de bijlage(n). Tevens zijn IOK noch IOK Afvalbeheer verantwoordelijk voor mogelijke virussen.

                      • 9. Re: vghettoVCB under ESXi 5.1.0 "You're not running ESX(i) 3.5, 4.x, 5.x!"
                        lamw Guru
                        VMware EmployeesCommunity Warriors

                        Thanks for the feedback on whoami command, I'll add this to list of bugfixes to take care of in the next release