vmSafeguard is a management, planning, backup system for a Vmware ESXi(s) solution, orchestrated through a Web Admin Panel. RTFM for more info. Under develop since Jun 2020

pushedAt 1 week ago


vmSafeguard - Project

vmSafeguard project has been created to facilitate the management and the VMs backup of an ESXi. With this tool, you will be able to backup a pool of VMs, Single Vm, Read the Backup logs etc. vmSafeguard can manage multiple ESXi since 5.0 version.

Enjoy :)

Table of contents

Check the readme (auto generate) table of contents, by clicking on the icon underlined in yellow :

📑 Prerequisite !

  • vmSafeguard can be installed under "Debian Family". For the devloppment of this project, I currently use Kali linux 2021.x, Php 7.4, Apache 2.4.X. To avoid unknow errors, I recommand you to use Ubuntu, Debian or Kali linux.

  • curl and sudo command need to be install !

  • An ESXi Server operational that can communicate with the machine that will host vmSafeguard (pinguable)

  • SSH service, and ESXi shell need to be activated ! (at the startup)

  • Administrator privileges on ESXi and your Linux host

Especially not to do

  • Don't add space between each word of a vm name. (VMs need to have a nomenclature like this : Debian-10-64Bits or Debian_10_64bits but not like that : Debian 10 64bits, otherwise vmSafeguard will crash
  • don't store you VM in a subfolder of a datastore. (VMs need to be stored at the root of a specific datastore like that :

And especially not like that

ESXi supported version

vmSafeguard is currently available for the following ESXi version :

  • 7.0.X (Follow step by step the readme)
  • 6.x (Read the readme of this branch, to setup vmSafeguard for an ESXi < 7.0)

📌 Installation (Easyest)

Easiest Way - Run setup.sh with curl, to automating the installation

WARNING: You need to be root or have sudo rights for executing these commands.

Update your server before to start the installation. apt update

if you used debian, please execute this command as root su - before to run the next command. :)

For ESXi version 7.X run this command :

sudo curl -sL https://raw.githubusercontent.com/archidote/vmSafeguard/master/setup.sh | bash

For old ESXi version (6.x), please run this command :

sudo curl -sL https://raw.githubusercontent.com/archidote/vmSafeguard/master/setup.sh | bash -s 6.x

Videos Tutorials

vmSafeguard with Docker - Install and setup the application : https://youtu.be/dsc6TYfgpRw

vmSafeguard docker - Schedulle a Pool Backup of VMs : https://youtu.be/2AuQU-mtRLc

vmSafeguard Standard installation - Install and setup the application + demo (Production environnement) : https://www.youtube.com/watch?v=GAi09Jx7kIk&ab_channel=Archidote

📑 Note that, if your machine is powered on, the backup folder will take a few moment before it's creation. vmSafeguard shutdown a VM with a safety mode. If the VM install some update, vmSafeguard, will wait until it's finished before to start the copy. (View the logs section for follow the backup process)

Docker install "On the fly" - Do you want to run vmSafeguard as a contaiener with docker ?

It's now possible ! But I don't recommanded this alternative for a production environnement !

Navigate to other/READMEDocker.md , to see a quick tutorial for setup vmSafeguard as a docker container.

WARNING : You need to be root or have sudo rights for executing these commands.

💻 Configuration 1/2 - On your server (Who host vmSafeguard) :

Once you have finished the installation process, you will need to do some stuff before to edit few files of the project (previous to access to the vmSafeguard trought the web.

🔑 Create your ssh-key pair as root if you don't already have it

ssh-keygen -t rsa 

⬆️ Upluad your public key on the ESXi server

Since, vmSafeguard 5.0 version, you can managed multiple ESXi. For that, upluad your public key on each ESXi hypervisor.

Remember ! You need to allow ssh on your ESXI, trought the Official Web panel of ESXi Vmware.

On vmSafeguard host :

cd /root/.ssh/
cat id_rsa.pub | ssh -p 22 [email protected] \ 'cat >> /etc/ssh/keys-root/authorized_keys'
# answer "yes"
# "you are connected to your esxi host"
ssh -p 22 [email protected]
# normally you are not going to provide the password of the target ESXi

This step is crutial for the following step.

💻 Configuration 2/2 - Specific datastore path

ℹ️ Location for the backup (Example)

On the ESXi host, you will need a specific datastore for store the futur VMs backup. In my case, I will use the datastore : datastore-backup as an example.

ssh -p 22 [email protected]
cd /vmfs/volumes/
# your datastore will be apears" 
# your datastore is identify by an inode (datastore-backup) and an id : 
# 5e566f71-06f2da78-82d5-441ea15ee924*
cd datastore-backup

*name of the folder

Example of the absolute path, that we will need for the next steps :


You can use any of them, that's okay. But I suggest you use the second method for more visibility

✏️ Edit the first .sh backup script (scripts/backup.sh) [1/2]

cd /var/www/html/vmSafeguard/scripts
nano backup.sh

at the top of the file this line :

# --- Global Variables ---
DATASTORE="datastore-backup" # Your specific datastore for the futur backup 

⚠️ Warning concerning the VMs storage path :

As I said previously your VMs can be stored in any datastores of your ESXi, BUT they need to be at the root of the datastore like /vmfs/volumes/datastore-backup/VMDebianFolder

if it's not the case, change the value of the variable "cutedpath=" in the function backupVM() (backup.sh)

That's it for the configuration of vmSafeguard , you will be able to start vmSafeguard trought the web

Access to the web panel

Authentification .htaccess / .htpasswd and first connexion

Setup your first connexion : http(s)://vmsafeguard-ip/vmSafeguard/scripts/router.php?action=welcome

When you access to vmSafeguard, you need to provide an id and a password :

Default credential :

  • ID : admin
  • Password : helloworld

Feel free to change them ASAP via the settings menu

If you want to disable the auth process, remove .htaccess / .htpasswd (location : root of the project)

Backup folder : /vmfs/volumes/datastore-backup/

  • place that will welcome the futur backup

Logs Path : /vmfs/volumes/datastore-backup/logsbackup.txt

  • vmSafeguard logs are stored on the datastore.

Fill all the fields and submit.

All the information have been stored into the db, click to "reload the dashboard", to access to the main menu of vmSafeguard.

vmSafeguard's Dashboard

This is the welcome page of vmSafeguard.

Execute Backup(s) from the Web interface

  • If you want to perfom a single backup , enter the machine's vmid, and then click to submit. (If your VM is started, the backup proccess will securely shutdown the VM before to continue. (if she has vmware tools on it system, otherwise the vmSafeguard will force powered off her. same process for a "pool backup" below) - it may take few minutes -)

  • Same thing for the pool VMs backup , but add each vmid separed with a space and submit the form. (If your VMs are started, the backup proccess will securely shutdown these VMs before to continue. - it may take few minutes - )

🎡 Automating the backup process with a cron task

With the web panel (Easyest way):

You can schedule a crontask for create a "Pool Backup", or just for one VM, with the Graphical Interface. Also, if you want in the futur to remove one crontask or all of them, you can use the "inline form" at the top of the screen.

Once you have submited the form, you will see the crontask (If the cron syntax has been respected)

Remove a crontask (www-data's crontab)

  • In case of you want to remove one crontask, enter the id of the task cron and then press "submit".

Other interesting features

Shutdown/Suspend/Start/Summary* vms

Example of the shutdown, suspend and start section (Action will be applied to all the VMs of your ESXi).

For exemple, when I press "Shutdown all VM", this is what will be displayed on your browser.

Example of the summary section. Very useful part if you want to know the vmid of a VM(s) and other information like the ip adress, the os type etc.

Settings Menu

This menu allow you to do a lot of different things like :

  • change your password
  • add an other ESXi to the database
  • convert a thick disk to thin and vice versa
  • etc.

(Maybe in the futur other features will be implemented. If you have any ideas, submit it to me)

Revive a VM from a backup

Following the next steps :

Warning, you can't revive an VM from a ESXi 7 to a 6.7 if the vmx file if your vmx file is upper than the the current esxi support.

💬 Notes / common questions

  • vmSafeguard is available only for debian based OS family
  • web panel logs are stored into the following file : /var/log/vmSafeguard-server.log
  • Backups process logs are stored into the backup datastore (at it's root) with the following name : logsbackup.txt

Know Issues

  • If the .htaccess / .htpasswd (not crutial for the project) auth does not work, please check the apache2.conf (/etc/apache2) and replace if you did not have the same result as the following picture :

  • Don't add comment into the description of a vm trought the official ESXI web panel (not multiple line, just one line. Otherwise the " number (total) of VMs will be false")

  • Don't turn off your server who host vmSafeguard 😊 , when a backup is running. Otherwise it will be cancel the ssh connexion between vmSafeguard and the ESXI

  • If you want to reinstall vmSafeGuard, just git clone the projet into /var/www/html, and put the correct rights and owner to the project folder.

git clone https://github.com/archidote/vmSafeguard
chmod 700 -R /var/www/html/vmSafeguard
chown www-data:www-data -R /var/www/html/vmSafeguard


If you detect an error in vmSafeguard, please open a github issue.

Releases details : https://github.com/archidote/vmSafeguard/projects/1 (section "version" (english))


ucloud ads