OpenMediaVault as ESXi backup store.

In this short tutorial i will show you how to backup guests by ghettoVCB on VMWare ESXI to OMV over SSHFS
 

Setup basic way ghettoVCB on VMWare ESXI

 
Enable SSH on your VMWare ESXI and login to it ( e.g. by Putty )
Change directory to /vmfs/volumes and list datastores
 
cd /vmfs/volumes/
ls
 
Now you will see list of datastores. There should be at least one datastore ( eg. datastore1 )
Perfect situation is when you have two datastores, one for production and one for backup.
But if not and you have enough space on one – this is ok too
I will show two datastores version but if you got one, just create Backups folder and ghettoVCB folder on this one datastore.
 
cd datastore2
mkdir Backups ghettoVCB
wget –no-check-certificate https://github.com/lamw/ghettoVCB/archive/refs/heads/master.zip
unzip master.zip -d ghettoVCB/
 
Your /vmfs/volumes/datastore2/ghettoVCB/ghettoVCB.conf should look like this
 
VM_BACKUP_VOLUME=/vmfs/volumes/datastore2/Backups/
DISK_BACKUP_FORMAT=thin
VM_BACKUP_ROTATION_COUNT=1
POWER_VM_DOWN_BEFORE_BACKUP=0
ENABLE_HARD_POWER_OFF=0
ITER_TO_WAIT_SHUTDOWN=3
POWER_DOWN_TIMEOUT=5
ENABLE_COMPRESSION=0
VM_SNAPSHOT_MEMORY=0
VM_SNAPSHOT_QUIESCE=0
ALLOW_VMS_WITH_SNAPSHOTS_TO_BE_BACKEDUP=0
ENABLE_NON_PERSISTENT_NFS=0
UNMOUNT_NFS=0
NFS_SERVER=172.30.0.195
NFS_VERSION=nfs
NFS_MOUNT=/nfsshare
NFS_LOCAL_NAME=nfs_storage_backup
NFS_VM_BACKUP_DIR=mybackups
SNAPSHOT_TIMEOUT=15
EMAIL_ALERT=0
EMAIL_LOG=0
EMAIL_SERVER=auroa.primp-industries.com
EMAIL_SERVER_PORT=25
EMAIL_DELAY_INTERVAL=1
EMAIL_USER_NAME=
EMAIL_USER_PASSWORD=
EMAIL_TO=auroa@primp-industries.com
EMAIL_ERRORS_TO=
EMAIL_FROM=root@ghettoVCB
WORKDIR_DEBUG=0
VM_SHUTDOWN_ORDER=
VM_STARTUP_ORDER=
 
 
Your /vmfs/volumes/datastore2/ghettoVCB/vm_list is a file with vm name list ( one per line ), names like in ESXI admin backend.
Files above can be created by vi editor or remotely by for eg. WinSCP + Notepad++.
 
 

Install SSHFS on OMV and mount VMWare ESXI datastore to OMV by sshfs

Login to your OMV by ssh and install or update sshfs, make mountpoint for ESXI datastore, 
paste ESXI ssh root public key and logout.
 
apt install sshfs
mkdir /mnt/your_esxi_hostname
mkdir /root/ssh_mount/.ssh/
nano /root/ssh_mount/.ssh/id_rsa
Paste public VMWare ESXI key, ctrl+x next yes, [Enter]
logout
 
Go to OMV backend [System -> Scheduled Tasks] and create new task.
[Enabled] Check checkmark, 
[Time Of execution] select [At reboot]
change ESXI_FQDN to your domain or ip address, 
[Command] sshfs -o auto_cache,cache=yes,kernel_cache,compression=no,allow_other,default_permissions,reconnect,identityfile=/root/ssh_mount/.ssh/id_rsa root@ESXI_FQDN:/vmfs/volumes/datastore2/Backups/ /mnt/your_esxi_hostname/
[Tags] Type SSH ESXI Mount
[Save]
Next run newly created task, and check if there are no errors in console.
 
 

Remotly run ghettoVCB on VMWare ESXI at 23:00 everyday.

Go to OMV backend [System -> Scheduled Tasks] and create new task.
 
[Enabled] Check checkmark, 
[Time Of execution] select [Certain date]
[Minute] [0]
[Hour] [23]
change ESXI_FQDN to your domain or ip address, 
[Command] ssh root@ESXI_FQDN -i /root/ssh_mount/.ssh/id_rsa /vmfs/volumes/datastore2/ghettoVCB/ghettoVCB.sh -g /vmfs/volumes/datastore2/ghettoVCB/ghettoVCB.conf -f /vmfs/volumes/datastore2/ghettoVCB/vm_list
[Tags] Run ghettoVCB backup on ESXI
[Save]
Next run newly created task, and check if there are no errors in ghettoVCB console output.
 
 

Setup Rsync task on OMV to copy backuped guests at 23:30 everyday.

Go to OMV backend [Services -> Rsync -> Tasks] and create new task.
[Enabled] Check checkmark, 
[Type] select [Local]
[Source shared folder] select one that contains /mnt/your_esxi_hostname
[Destination shared folder] select destination backup folder on OMV
[Minute] [30]
[Hour] [23]
[Send command output via email] Check checkmark, 
[Extra options] -v -h -S
[Tags] Copy Backup ESXI -> OMV
]Save]
Next run newly created task, and check if there are no errors in Rsync console output.
You may reboot your OMV to bee sure that mount at boot goes correctly.
 
After this setup yours OMV nas will be doing procedure:
1. Every boot OMV will mount ESXI by sshfs to mountpoint /mnt/your_esxi_hostname
2. Everyday at 23:00 OMV will connect to ESXI and run ghettoVCB 
3. After 30 minutes at 23:30 OMV will copy ESXI backup folder to OMV destination folder
 

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *