GhettoVCB: Difference between revisions

From Leo's Notes
This page was last edited on 16 July 2017, at 00:12.
m Leo moved page Ghettovcb to GhettoVCB: casing
No edit summary
Line 1: Line 1:
There's a script called GhettoVCB which creates and restores backups using snapshots, which means that the backup will be done online without needing to shut the guest down. The drawback with this script is that it is unable to back up guests with existing snapshots.
ghettoVCB is a script that allows VMware ESXi hosts to backup virtual machines using snapshots without requiring the guest to shut down.


== Backing Up with GhettoVCB ==
The drawback with this script is that it is unable to back up guests with existing snapshots.
On a linux machine:
<syntaxhighlight lang="bash" line start="1" enclose="div">
wget ghettoVCB-master.zip
scp ghettoVCB-master.zip root@esxi:/
</syntaxhighlight>


On the ESXi server:
== Installation ==
<syntaxhighlight lang="text" line start="1" highlight="1,10,11,12,13,14,22" enclose="div">
Get the script from their GitHub repository:
~ # unzip ghettoVCB-master.zip
* https://github.com/lamw/ghettoVCB
Archive: ghettoVCB-master.zip
 
    creating: ghettoVCB-master/
You may either install it using their .vib package, or save the script somewhere accessible by the ESXi server.
  inflating: ghettoVCB-master/README
 
  inflating: ghettoVCB-master/ghettoVCB-restore.sh
== Usage ==
  inflating: ghettoVCB-master/ghettoVCB-restore_vm_restore_configuration_template
Create a datastore (either NFS or disk) that you will backup to. For my usual use-case, I normally create a NFS share for backups which is also where I place the ghettoVCB script and configuration as well.
  inflating: ghettoVCB-master/ghettoVCB-vm_backup_configuration_template
 
  inflating: ghettoVCB-master/ghettoVCB.conf
{{highlight|lang=terminal|code=
  inflating: ghettoVCB-master/ghettoVCB.sh
## /data/vm is exported for the ESXi server.
~ # rm ghettoVCB-master.zip
## Edit the ghettoVCB.conf as desired (optional)
~ # cd ghettoVCB-master/
## The backup_vms file contains all the VMs I wish to back up (see below)
/ghettoVCB-master # chmod +x ghettoVCB.sh
 
/ghettoVCB-master # chmod +x ghettoVCB-restore.sh
leo@nas:/data/vm% ls
/ghettoVCB-master # ls
backup_vms esxi-backup/ ghettoVCB.conf  ghettoVCB.sh*
README
 
ghettoVCB-restore.sh
leo@nas:/data/vm% cat backup_vms
  ghettoVCB-restore_vm_restore_configuration_template
CentOS 7 Web
ghettoVCB-vm_backup_configuration_template
Fedora Compute
  ghettoVCB.conf
}}
  ghettoVCB.sh
 
 
To back up a machine named 'CentOS 7', run:
/ghettoVCB-master # vi ghettoVCB.sh
{{highlight|lang=terminal|code=
  (ensure that VM_BACKUP_VOLUME is set to your backup volume. eg: /vmfs/volumes/backups/)
[root@server:/vmfs/volumes/ee8ff6f0-af4dbc98] sh ./ghettoVCB.sh -m "CentOS 7"
</syntaxhighlight>
}}
 
To back up a machine named 'CentOS6', run:
However, if you want to backup a set of virtual machines, create a text file containing the name of each virtual machine you wish to back up and then run:
<syntaxhighlight lang="bash" line start="1" enclose="div">
{{highlight|lang=terminal|code=
/ghettoVCB-master # ./ghettoVCB.sh -m "CentOS6"
[root@server:/vmfs/volumes/ee8ff6f0-af4dbc98] sh ./ghettoVCB.sh -f backup_vms
</syntaxhighlight>
}}
 
== Scheduled Backups ==
To automatically backup virtual machines on a regular basis, you will need to create a cronjob on a separate server to trigger it.
 
Set up a root SSH key so that it can log in and run the script.


[[Category:VMWare_ESXi]]
[[Category:VMWare_ESXi]]

Revision as of 00:12, 16 July 2017

ghettoVCB is a script that allows VMware ESXi hosts to backup virtual machines using snapshots without requiring the guest to shut down.

The drawback with this script is that it is unable to back up guests with existing snapshots.

Installation

Get the script from their GitHub repository:

You may either install it using their .vib package, or save the script somewhere accessible by the ESXi server.

Usage

Create a datastore (either NFS or disk) that you will backup to. For my usual use-case, I normally create a NFS share for backups which is also where I place the ghettoVCB script and configuration as well.

## /data/vm is exported for the ESXi server.
## Edit the ghettoVCB.conf as desired (optional)
## The backup_vms file contains all the VMs I wish to back up (see below)

leo@nas:/data/vm% ls
backup_vms  esxi-backup/  ghettoVCB.conf  ghettoVCB.sh*

leo@nas:/data/vm% cat backup_vms
CentOS 7 Web
Fedora Compute

To back up a machine named 'CentOS 7', run:

[root@server:/vmfs/volumes/ee8ff6f0-af4dbc98] sh ./ghettoVCB.sh -m "CentOS 7"

However, if you want to backup a set of virtual machines, create a text file containing the name of each virtual machine you wish to back up and then run:

[root@server:/vmfs/volumes/ee8ff6f0-af4dbc98] sh ./ghettoVCB.sh -f backup_vms

Scheduled Backups

To automatically backup virtual machines on a regular basis, you will need to create a cronjob on a separate server to trigger it.

Set up a root SSH key so that it can log in and run the script.