0 Replies Latest reply on Oct 22, 2012 5:52 PM by ahoogerhuis

    ghettoVCB 2011_11_19_1 getting rsync symlinks wrong if pwd set (ESX 4.1U3)

    ahoogerhuis Enthusiast

      If run from a shell on ESX 4.1U3 it causes the rsync symlinks to be wrong.

       

      It's basically this line: ln -sf "${SYMLINK_DST1}" "${SYMLINK_SRC}"

       

      This will get it wrong, and derefence the existing symlink wrong, meaning the link will not be advanced from the previous existing to the currently freshly completed backup.

       

      For some reason this goes right if the current working directory is equal to VM_BACKUP_VOLUME/$VM, if cwd it's any other then it will mess up the links, placing the link to the new backup inside whatever the existing rsync symlink points to and leaving the existing intact.

       

      The quick fix is to change "ln -sf" to "ln -s" and add a line up fron delting the existing symlink first by running rm -f "${SYMLINK_SRC}".

       

      So in short, this is broken for some cases:

       

      ln -sf "${SYMLINK_DST1}" "${SYMLINK_SRC}"

       

      and this is somewhat more foolproof:

       

      rm -f "${SYMLINK_SRC}"

      ln -s "${SYMLINK_DST1}" "${SYMLINK_SRC}"

       

      alternatively, a safer solution is to add -n:

       

             -n, --no-dereference

                    treat destination that is a symlink to a directory as if it were a normal file

      and make the line:
      ln -nsf "${SYMLINK_DST1}" "${SYMLINK_SRC}"
      -A