diff --git a/esxi/readme.md b/esxi/readme.md
index 62d14fd..f21c29f 100644
--- a/esxi/readme.md
+++ b/esxi/readme.md
@@ -102,6 +102,9 @@ Logs from systems in VMs are in >Virtual Machines > Name-of-VM > Monitor > Logs
* [github](https://github.com/lamw/ghettoVCB)
* [documentation](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)
+* [https://github.com/lamw/ghettoVCB/issues/233](https://github.com/lamw/ghettoVCB/issues/233)
+
+
The script makes snapshot of a VM, copies the "old" vmdk and other files
to a backup location, then deletes the snapshot.
This approach, where backup in time is full backup takes up a lot of space.
@@ -132,74 +135,83 @@ Looks like this `/vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090`
### Install
+* [Download](https://github.com/lamw/ghettoVCB/archive/refs/heads/master.zip)
+ the repo files on a pc from which you would upload them on to esxi
+* create a directory on a datastore where the script and configs will reside
+ `/vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/ghetto`
+* upload the files, should be 6, can skip `build` directory and `readme.md`
* ssh in to esxi
-* `cd /tmp`
-* `esxcli network firewall ruleset set -e true -r httpClient`
-* `wget https://github.com/lamw/ghettoVCB/releases/download/2021_10_20/vghetto-ghettoVCB.vib --no-check-certificate`
-* `esxcli software vib install -v /tmp/vghetto-ghettoVCB.vib -f`
-* check `ls /opt`
+* cd in to the datastore ghetto directory
+* make all the shell files executable
+ `chmod +x ./*.sh`
### Config and preparation
Gotta know basics how to edit files with ancient `vi`
-* Config file template is in `/opt/ghettovcb/ghettoVCB.conf`
- Make copy of it
- `cp /opt/ghettovcb/ghettoVCB.conf /opt/ghettovcb/ghetto_1.conf`
+* cd in to the datastore ghetto directory
+ `cp ./ghettoVCB.conf ./ghetto_1.conf`
* Only edit this file, for starter setting where to copy backups
`vi /opt/ghettovcb/ghetto_1.conf`
`VM_BACKUP_VOLUME=/vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/Backups`
* Create a file that will contain list of VMs to backup
- `touch /opt/ghettovcb/vms_to_backup_list`
- `vi /opt/ghettovcb/vms_to_backup_list`
+ `touch ./vms_to_backup_list`
+ `vi ./vms_to_backup_list`
```
OPNsense
Arch-Docker-Host
```
* Create a shell script that starts ghetto script using this config for listed VMs
- `touch /opt/ghettovcb/bin/ghetto_run.sh`
- `vi /opt/ghettovcb/bin/ghetto_run.sh`
+ `touch ./ghetto_run.sh`
+ `vi ./ghetto_run.sh`
```
#!/bin/sh
- /opt/ghettovcb/bin/ghettoVCB.sh \
- -g /opt/ghettovcb/ghetto_1.conf \
- -f /opt/ghettovcb/vms_to_backup_list \
+ GHETTO_DIR=/vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/ghetto
+
+ $GHETTO_DIR/ghettoVCB.sh \
+ -g $GHETTO_DIR/ghetto_1.conf \
+ -f $GHETTO_DIR/vms_to_backup_list \
&> /dev/null
```
Make the script executable
- `chmod +x /opt/ghettovcb/bin/ghetto_run.sh`
+ `chmod +x ./ghetto_run.sh`
* for my use case where TrueNAS VM cant be snapshoted while running because
of a passthrough pcie HBA card there needs to be another config
* Make new config copy
- `cp /opt/ghettovcb/ghetto_1.conf /opt/ghettovcb/ghetto_2.conf`
+ `cp ./ghetto_1.conf ./ghetto_2.conf`
* Edit the config, setting it to shut down VMs before backup.
- `vi /opt/ghettovcb/ghetto_2.conf`
+ `vi ./ghetto_2.conf`
`POWER_VM_DOWN_BEFORE_BACKUP=1`
* edit the run script, add another execution for specific VM using ghetto_2.conf
- `vi /opt/ghettovcb/bin/ghetto_run.sh`
+ `vi ./ghetto_run.sh`
```
#!/bin/sh
- /opt/ghettovcb/bin/ghettoVCB.sh \
- -g /opt/ghettovcb/ghetto_1.conf \
- -f /opt/ghettovcb/vms_to_backup_list \
+ GHETTO_DIR=/vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/ghetto
+
+ $GHETTO_DIR/ghettoVCB.sh \
+ -g $GHETTO_DIR/ghetto_1.conf \
+ -f $GHETTO_DIR/vms_to_backup_list \
&> /dev/null
- /opt/ghettovcb/bin/ghettoVCB.sh \
- -g /opt/ghettovcb/ghetto_2.conf \
+ $GHETTO_DIR/ghettoVCB.sh \
+ -g $GHETTO_DIR/ghetto_2.conf \
-m TrueNAS_scale \
&> /dev/null
```
-### Execution and scheduled runs
+To one time manually execute:
-To simply execute:
+* `./ghetto_run.sh`
-* `/opt/ghettovcb/bin/ghetto_run.sh`
+### Scheduled runs
+See "Cronjob FAQ" in
+[documentation](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#Cronjob-FAQ:)
-To execute it periodicly cron is used.
+To execute it periodicly cron is used. But theres an issue of cronjob being lost
+on esxi restart, which require few extra steps to solve.
* Make backup of roots crontab
`cp /var/spool/cron/crontabs/root /var/spool/cron/crontabs/root.backup`
@@ -207,13 +219,32 @@ To execute it periodicly cron is used.
add the following line at the end in [cron format](https://crontab.guru/)
`vi /var/spool/cron/crontabs/root`
```
- 0 4 * * * /opt/ghettovcb/bin/ghetto_run.sh
+ 0 4 * * * /vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/ghetto/ghetto_run.sh
```
To save read only file in vi use `:wq!`
* restart cron service
`kill $(cat /var/run/crond.pid)`
`crond`
+To make the cronjob permanent
+
+* Edit `etc/rc.local.d/local.sh` file, adding the following lines at the end,
+ replacing the part in quotes in the echo line with your cronjob line.
+ `vi etc/rc.local.d/local.sh`
+ ```
+ /bin/kill $(cat /var/run/crond.pid) > /dev/null 2>&1
+ /bin/echo "0 4 * * * /vmfs/volumes/6187f7e1-c584077c-d7f6-3c4937073090/ghetto/ghetto_run.sh" >> /var/spool/cron/crontabs/root
+ /bin/crond
+ ```
+ ESXi host must have disabled secure boot for local.sh to execute.
+* Run esxi config backup for change to be saved
+ `/sbin/auto-backup.sh`
+* Restart host, check if the cronjob is still there and if cron is running,
+ and check if the date is correct
+ `vi /var/spool/cron/crontabs/root`
+ `ps | grep crond | grep -v grep`
+ `date`
+
Logs about backups are in `/tmp`
### Restore from backup
@@ -221,10 +252,10 @@ Logs about backups are in `/tmp`
[Documentation](https://communities.vmware.com/t5/VI-VMware-ESX-3-5-Documents/Ghetto-Tech-Preview-ghettoVCB-restore-sh-Restoring-VM-s-backed/ta-p/2792996)
* In webgui create a full path where to restore the VM
-* The restore-config-template-file is in `/opt/ghettovcb/`
+* The restore-config-template-file is in th ghetto directory on datastore
named `ghettoVCB-restore_vm_restore_configuration_template`
Make copy of it
- `cp /opt/ghettovcb/ghettoVCB-restore_vm_restore_configuration_template /opt/ghettovcb/vms_to_restore_list`
+ `cp ./ghettoVCB-restore_vm_restore_configuration_template ./vms_to_restore_list`
* Edit this file, adding new line, in which separated by `;` are:
* path to the backup, the directory with date in name
* path where to restore this backup
@@ -287,7 +318,8 @@ Correctly functioning reclamation can save time and space for backups.
# links
-* https://www.altaro.com/vmware/ghettovcb-back-up-vms/
+* https://www.altaro.com/vmware/ghettovcb-back-
+up-vms/
* https://www.youtube.com/watch?v=ySMitWnNxp4
* https://forums.unraid.net/topic/30507-guide-scheduled-backup-your-esxi-vms-to-unraid-with-ghettovcb/
* https://blog.kingj.net/2016/07/03/how-to/backing-up-vmware-esxi-vms-with-ghettovcb/