Controles
Trades
Câmeras
Clientes
Chips 4G
KB
Projetos
Senhas
Servidores
Tarefas

VMWARE/ESXi: Backup e Restore de VMS

30/10/2023
image_pdfimage_print

Para refazer o backup do ESXI basta fazer ssh no console da ESXI e rodar o comando para remontar o crontab

 

vi /tmp/crontabRootAtual.txt

Adicione as linhas abaixo

# SCRIPTS DE BACKUPS DIARIOS

30 03 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmon1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmmon1-1717576208.log
00 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmysql1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmmysql1-1717576208.log
30 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmportal.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmportal-1717576208.log
00 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmsmtp1-proxy1-ftp1-sftp1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmsmtp1-proxy1-ftp1-sftp1-1717576208.log
30 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmdocker1 > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmdocker1-1717576208.log

 

cat /tmp/crontabRootAtual.txt >> /var/spool/cron/crontabs/root

para ver se ficou ok

cat /var/spool/cron/crontabs/root

rode o crond

/usr/lib/vmware/busybox/bin/busybox crond

 

IPC: Verifique se o datastore esta montado.

ll /vmfs/volumes/9f07758c-31382dda-0000-000000000000

 


Ultimo local.sh

##############################################################################

#!/bin/sh ++group=host/vim/vmvisor/boot

# local configuration options

# Note: modify at your own risk! If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading. Changes are not supported unless under direction of
# VMware support.

# Note: This script will not be run when UEFI secure boot is enabled.
/bin/echo “30 03 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmon1.lst > /vmfs/volumes/9f07758c-31382dda-0000-00000000000/VMS/ghettoVCB/logBackup-vmmon1-1717576208.log”
/bin/echo “00 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmysql1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmmysql1-1717576208.log”
/bin/echo “30 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmportal.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmportal-1717576208.log”
/bin/echo “00 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmsmtp1-proxy1-ftp1-sftp1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmsmtp1-proxy1-ftp1-sftp1-1717576208.log”
/bin/echo “30 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmdocker1 > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmdocker11717576208.log”

/usr/lib/vmware/busybox/bin/busybox crond

exit 0

##############################################################################

 


 

 

BACKUP

https://communities.vmware.com/t5/VI-VMware-ESX-3-5-Documents/ghettoVCB-sh-Free-alternative-for-backing-up-VM-s-for-ESX-i-3-5/ta-p/2773570

./bin/ghettoVCB.sh -m vmportal1.lst -g ./ghettoVCB.conf

 

 

RESTORE

https://communities.vmware.com/t5/VI-VMware-ESX-3-5-Documents/Ghetto-Tech-Preview-ghettoVCB-restore-sh-Restoring-VM-s-backed/ta-p/2792996

 

CRON

/etc/rc.local.d/local.sh
Lembrar que é UTC então adicionar mais 3h ao horário que deseja que o cron rode
adicione antes do exit 0
/bin/kill $(cat /var/run/crond.pid) > /dev/null 2>&1
/bin/echo “00 01 * * * /bin/sh /vmfs/volumes/4a3c0c5b-4111b3c5/BACKUP/ghettoVCB/ghettoVCB.sh -m vmportal1.lst > /vmfs/volumes/4a3c0c5b-4111b3c5/BACKUP/ghettoVCB/ghettoVCB-backup-$(date +\%s).log” >> /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond
Rode o comando abaixo para gravar

##############################################################################

 

Coloque o host em manutenção

Efetue o reboot

Tire de manutenção e verifique se o schedule foi criado em

/var/spool/cron/crontabs/root

Exemplo do Crontab em 05/06/2024

#min hour day mon dow command
1 1 * * * /sbin/tmpwatch.py
*/5 * * * * python ++group=host/vim/vmvisor/systemStorage,securitydom=systemStorageMonitorDom /sbin/systemStorageMonitor.pyc
1 * * * * /sbin/auto-backup.sh ++group=host/vim/vmvisor/auto-backup.sh
0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py
*/5 * * * * /bin/hostd-probe.sh ++group=host/vim/vmvisor/hostd-probe/stats/sh,securitydom=hostdProbeDom
00 1 * * * localcli ++securitydom=storageDevicePurgeDom storage core device purge
0 */6 * * * /bin/pam_tally2 –reset
*/10 * * * * /bin/crx-cli ++securitydom=crxCliGcDom gc
30 03 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmon1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmmon1-1717576208.log
00 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmmysql1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmmysql1-1717576208.log
30 04 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmportal.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmportal-1717576208.log
00 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmsmtp1-proxy1-ftp1-sftp1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmsmtp1-proxy1-ftp1-sftp1-1717576208.log
30 05 * * * /bin/sh /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/ghettoVCB.sh -m vmcloud1.lst > /vmfs/volumes/9f07758c-31382dda-0000-000000000000/VMS/ghettoVCB/logBackup-vmcloud11717576208.log
contato@lstimelapses.com.br
Top apartmentuserssmartphonemagnifiercrosslistarrow-left