©XSIBackup-Free: Free Backup Software for ©VMWare ©ESXi

Forum ©XSIBackup: ©VMWare ©ESXi Backup Software


You are not logged in.

#1 2021-03-10 13:16:21

Robertkwild
Member
Registered: 2020-05-25
Posts: 43

exclude only one VM from being backed up (solved)

hi all,

is there anyway only to excluding one vm from being backed up, otherwise i would need to include all the vms to backup and then not include that vm in my command, like so

--backup-type=custom --backup-vms=lon-p-xrdp,aspcon,shares,dataio,lon-p-smtp... and the VM i wouldnt put down here is lon-p-fog

as you can see theres no universal convention going on here and the list goes on and on

would this work

--backup-vms=vim-cmd vmsvc/getallvms | awk '{ print $2}' | awk '(NR>1)' | grep -v lon-p-fog

thanks,
rob

Last edited by Robertkwild (2021-03-10 18:23:48)

Offline

#2 2021-03-10 18:30:55

Robertkwild
Member
Registered: 2020-05-25
Posts: 43

Re: exclude only one VM from being backed up (solved)

or can i just list running vms and exclude that vm like this

--backup-vms=esxcli vm process list | grep "Display Name" | awk '{ print $3}' | grep -v lon-p-fog

Offline

#3 2021-03-11 12:53:26

admin
Administrator
Registered: 2017-04-21
Posts: 2,057

Re: exclude only one VM from being backed up (solved)

Please, read the man page before asking for help:
(c)XSIBackup Regular Expressions

Offline

#4 2021-03-16 13:14:07

Robertkwild
Member
Registered: 2020-05-25
Posts: 43

Re: exclude only one VM from being backed up (solved)

ok its not working, i dont know what im doing wrong

./xsibackup --backup-point=/vmfs/volumes/datastore1/backup --backup-type=custom --backup-vms="REGEXP(^free)"

and im getting this error

Error NOVM2BAK: no VMs to backup

but i dont know why, as i have a vm called freeradius

Offline

#5 2021-03-16 16:31:43

admin
Administrator
Registered: 2017-04-21
Posts: 2,057

Re: exclude only one VM from being backed up (solved)

(c)XSIBackup is a command line tool, thus, apart from the built-in arguments and options you have all the available bash tools to help you achieve your goal.

The below code will return a list of all your available VMs

vim-cmd vmsvc/getallvms | awk -F '[' '{print $1}' | awk '{print $2}'

You can filter them with grep regexp below

vim-cmd vmsvc/getallvms | awk -F '[' '{print $1}' | awk '{print $2}' | awk '{print $2}' | grep -E "^free"

Then just change the new line characters by commas, only in case you happen to have more than one VM in your list.

vim-cmd vmsvc/getallvms | awk -F '[' '{print $1}' | awk '{print $2}' | awk '{print $2}' | grep -E "^free" | sed -e ':a;N;$!ba;s/\n/,/g'

Finally use the above expression to select your desired VMs and pass them to the --backup-vms argument

MYVMS="$( vim-cmd vmsvc/getallvms | awk -F '[' '{print $1}' | awk '{print $2}' | awk '{print $2}' | grep -E "^free" | sed -e ':a;N;$!ba;s/\n/,/g' )";./xsibackup --backup-point=/vmfs/volumes/datastore1/backup --backup-type=custom --backup-vms="$(MYVMS)"

This is about the same than our REGEXP function does, you keep control on what's going on though.

Offline

#6 2021-03-18 16:31:01

Robertkwild
Member
Registered: 2020-05-25
Posts: 43

Re: exclude only one VM from being backed up (solved)

thanks admin smile

Offline

Board footer