Wypowiedzi
-
VMware vSphere 5.1
NEW_VIMCMD_SNAPSHOT="no"
${VMWARE_CMD} vmsvc/snapshot.remove 2>&1 | grep -q "snapshotId"
[[ $? -eq 0 ]] && NEW_VIMCMD_SNAPSHOT="yes"
if [[ "${EMAIL_LOG}" -eq 1 ]] && [[ -f /usr/bin/nc ]] || [[ -f /bin/nc ]]; then
if [[ -f /usr/bin/nc ]] ; then
NC_BIN=/usr/bin/nc
elif [[ -f /bin/nc ]] ; then
NC_BIN=/bin/nc
fi
logger "dryrun" "TOTAL_VM_SIZE_TO_BACKUP: ${TOTAL_VM_SIZE} GB"
if [[ ${HAS_INDEPENDENT_DISKS} -eq 1 ]] ; then
logger "dryrun" "Snapshots can not be taken for indepdenent disks!"
logger "dryrun" "THIS VIRTUAL MACHINE WILL NOT HAVE ALL ITS VMDKS BACKED UP!"
fi
ls "${VMX_DIR}" | grep -q "\-delta\.vmdk" > /dev/null 2>&1;
if [[ $? -eq 0 ]]; then
if [ ${ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP} -eq 0 ]; then
logger "dryrun" "Snapshots found for this VM, please commit all snapshots before continuing!"
logger "dryrun" "THIS VIRTUAL MACHINE WILL NOT BE BACKED UP DUE TO EXISTING SNAPSHOTS!"
else
logger "dryrun" "Snapshots found for this VM, ALL EXISTING SNAPSHOTS WILL BE CONSOLIDATED PRIOR TO BACKUP!"
fi
fi
if [[ ${TOTAL_VM_SIZE} -eq 0 ]] ; then
logger "dryrun" "THIS VIRTUAL MACHINE WILL NOT BE BACKED UP DUE TO EMPTY VMDK LIST!"
fi
logger "dryrun" "###############################################\n"
#checks to see if the VM has any snapshots to start with
elif [[ -f "${VMX_PATH}" ]] && [[ ! -z "${VMX_PATH}" ]]; then
if ls "${VMX_DIR}" | grep -q "\-delta\.vmdk" > /dev/null 2>&1; then
if [ ${ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP} -eq 0 ]; then
logger "info" "Snapshot found for ${VM_NAME}, backup will not take place\n"
VM_FAILED=1
continue
elif [ ${ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP} -eq 1 ]; then
logger "info" "Snapshot found for ${VM_NAME}, consolidating ALL snapshots now (this can take awhile) ...\n"
$VMWARE_CMD vmsvc/snapshot.removeall ${VM_ID} > /dev/null 2>&1
fi
fi -
Używam ESXi 5.1, natomiast za wiele nie ma możliwości z opcją ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP , uruchamiaem 0 i opcją 1, sytuacja taka sama.
-
Jeszcze jedna kwestia, po wykonaniu pierwszej kopii ghettovcb.sh więcej nie chce zrobić twierdząc że już jest utworzony snapshot. W ustawieniach mam jak poniżej
# User Definable Parameters
##################################################################
LAST_MODIFIED_DATE=2013_26_11
VERSION=2
# directory that all VM backups should go (e.g. /vmfs/volumes/SAN_LUN1/mybackupdir)
VM_BACKUP_VOLUME=/vmfs/volumes/Backup_VMware/mms
# Format output of VMDK backup
# zeroedthick
# 2gbsparse
# thin
# eagerzeroedthick
DISK_BACKUP_FORMAT=thin
# Number of backups for a given VM before deleting
VM_BACKUP_ROTATION_COUNT=3
# Shutdown guestOS prior to running backups and power them back on afterwards
# This feature assumes VMware Tools are installed, else they will not power down and loop forever
# 1=on, 0 =off
POWER_VM_DOWN_BEFORE_BACKUP=0
# enable shutdown code 1=on, 0 = off
ENABLE_HARD_POWER_OFF=0
# if the above flag "ENABLE_HARD_POWER_OFF "is set to 1, then will look at this flag which is the # of iterations
# the script will wait before executing a hard power off, this will be a multiple of 60seconds
# (e.g) = 3, which means this will wait up to 180seconds (3min) before it just powers off the VM
ITER_TO_WAIT_SHUTDOWN=3
# Number of iterations the script will wait before giving up on powering down the VM and ignoring it for backup
# this will be a multiple of 60 (e.g) = 5, which means this will wait up to 300secs (5min) before it gives up
POWER_DOWN_TIMEOUT=5
# enable compression with gzip+tar 1=on, 0=off
ENABLE_COMPRESSION=0
# Include VMs memory when taking snapshot
VM_SNAPSHOT_MEMORY=0
# Quiesce VM when taking snapshot (requires VMware Tools to be installed)
VM_SNAPSHOT_QUIESCE=0
# default 15min timeout
SNAPSHOT_TIMEOUT=15
# Allow VMs with snapshots to be backed up, this WILL CONSOLIDATE EXISTING SNAPSHOTS!
ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=0
##########################################################
# NON-PERSISTENT NFS-BACKUP ONLY
#
# ENABLE NON PERSISTENT NFS BACKUP 1=on, 0=off
ENABLE_NON_PERSISTENT_NFS=0
# umount NFS datastore after backup is complete 1=yes, 0=no
UNMOUNT_NFS=0
# IP Address of NFS Server
NFS_SERVER=192.168.2.146
# NFS Version (v3=nfs v4=nfsv41) - Only v3 is valid for 5.5
NFS_VERSION=nfs
# Path of exported folder residing on NFS Server (e.g. /some/mount/point )
NFS_MOUNT=/upload
# Non-persistent NFS datastore display name of choice
NFS_LOCAL_NAME=backup
# Name of backup directory for VMs residing on the NFS volume
NFS_VM_BACKUP_DIR=mybackups -
Super, dzięki wielkie, pomogło. Teraz mogę spokojnie spać:)
-
Witam, chciałem zrobić kopię maszyn wirtualnych za pomocą ghettoVCB.sh.
Tam gdzie nie było wcześniej robionych snapshotów nie ma problemu, natomiast problem pojawia się na maszynach na których wcześniej utworzyłem ręcznie snapa, ponieważ krzyczy że jest utworzony. Proszę o info co można w tej sytuacji jeszcze zrobić, usunąłem już wszystkie pliki które można było usunąć, zostały tylko: .vmdk, .vswap, .ldk., .vmx, .nvram, vmxf.
Dzięki za info