lamw / ghettoVCB

ghettoVCB
MIT License
1.29k stars 365 forks source link

exclude vdmk #179

Open aecom opened 4 years ago

aecom commented 4 years ago

hi want to backup one of my ESXi servers c drive but exclude d drive

is it posible ?

thanks

TheNetworkIsDown commented 4 years ago

No, currently all virtual disks are being backed up always. However, this is a feature request that might make sense. 1) Being able to exclude certain disks 2) Alternatively being able to provide an inclusion list to back up only the VMDKs specified.

TheNetworkIsDown commented 4 years ago

An explicit list of VMDKs to include is possible using VMDK_FILES_TO_BACKUP

TheNetworkIsDown commented 4 years ago

This is not exactly documented except for a one-liner indicating that the feature exists AFAICS.

How to use: Example:

./ghettoVCB.sh -f vms_to_backup -c /vmfs/volume/datastore1/vm_backup_configs

The directory /vmfs/volume/datastore1/vm_backup_configs contains files whose names are those of the VMs to back up:

VM1
VM2
VM3
...

Each file contains a configuration like

VMDK_FILES_TO_BACKUP="disk1.vmdk,disk2.vmdk"

(see https://github.com/lamw/ghettoVCB/blob/master/ghettoVCB-vm_backup_configuration_template) This means that for each VM you can configure exactly which disks to back up, by creating one configuration file per VM. Not sure if you can still use the per-VM configuration files while using other parameters via the global file (-g).

In your case you list all disks except the one you don't want to back up.

2007joker commented 1 year ago

Hi all,

thanks for the hints. Unfortunately it seems to work only if all vmdks are in the same storage folder as the vm config. I'm using different storages to save the vm and virtual disks and it fails.

This is an example structure

[data3r1-980] winadmin.vs.ns/winadmin.vs.ns.vmdk

[data4r1-990] winadmin.vs.ns/winadmin.vs.ns_1.vmdk

[data2r10-hdd] winadmin.vs.ns/winadmin.vs.ns_2.vmdk

2023-11-16 15:13:44 -- info: WARNING: winadmin.vs.ns_2.vmdk not found in VMDKs for winadmin.vs.ns 2023-11-16 15:13:44 -- info: Initiate backup for winadmin.vs.ns 2023-11-16 15:13:44 -- info: Creating Snapshot "ghettoVCB-snapshot-2023-11-16" for winadmin.vs.ns

or trying to use full path

2023-11-16 15:17:18 -- info: WARNING: /vmfs/volumes/data3r1-980/winadmin.vs.ns/winadmin.vs.ns.vmdk not found in VMDKs for winadmin.vs.ns 2023-11-16 15:17:18 -- info: ERROR: No valid VMDKs in list of VMDKs to backup for winadmin.vs.ns 2023-11-16 15:17:18 -- info: ERROR: Failed to backup winadmin.vs.ns!

The VMDKs are existing.

Can the script be adapted to handle that? (probably easiest way to use/allow full path for vmdk's?)

2007joker commented 11 months ago

hi all

solved this without script modification

case: VMDKs are stored within the main directory (where vmx etc. is stored) , and additonal VMDKs on other datastores

you have to run the script with debug , then you will see the full resolved path to the VMDK , add these to the exclusion file