backup of vmware snapshots with bareos backup of vmware snapshots with ...€¦ · backup of vmware...

38
Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos

Upload: others

Post on 11-Jun-2020

41 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

­

Backup of VMware Snapshots withBareos

Backup of VMware Snapshots with Bareos

Page 2: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology
Page 3: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

The key technology is ChangedBlock Tracking.

What have blocks to do with my Backup?I want to backup files!

Page 4: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

filesystemfilesystem translates between files and blocks 

readwrite

Filesystem

Blockdevice

Applicationopen() write() read() close() ...()

bookkeeping of free/used blocks, translate filenames to blocks, etc.Files

Blocks

Page 5: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Day one

changedunchangedblocks

10 203050

406080100120140

7090110130

changed blocks:1-50

Page 6: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Day two

changedunchangedblocks

1030507090110130

20406080100120140

changed blocks:11-203154-6070

Page 7: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Day three

changedunchangedblocks

1030507090110130

20406080100120140

changed blocks:6090-100

Page 8: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Blocks backed upDay 1: Blocks 1­50Day 2: Blocks 11­20, 31, 54­60, 70Day 3: Blocks 60, 90­100

Page 9: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Restore of BackupDay 1: Blocks 1­50Day 2: Blocks 11­20, 31, 54­60, 70Day 3: Blocks 60, 90­100restore order must match backup order

Page 10: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Changed Block Backup ­ advantagesOS­independentno backup of never used blocksonly backup blocks that have changedfull, inc and diff possiblemuch faster as no timestamps have to be checked

Page 11: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How to do CBT in VMware:Two different APIs are needed to be able to do CBT Backups:

vSphere APIneeded to manage vSphere Infrastructure

VMware vSphere Storage APIs – Data Protection (VADP)needed to do the data transfer itself

Page 12: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

excursion: Bareos Python plugin APIpython­fd plugin loads into filedaemonstarts own python interpreterexecutes python functions during backup & restorefull access to plugin API via python

Page 13: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How Bareos connects to VMwareAPIs:

vSphere APIpyvmomi ­ VMware vSphere API Python Bindings

VMware vSphere Storage APIs – Data Protection (VADP)bareos_vadp_dumperdeveloped by Bareos' Marco van Wieringenuses vmware­vix­disklib

Page 14: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Putting everything together

Page 15: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

The Big Picture

VCenter

ESXi HostVM

Block Device (virt. HD)

Changed Block Tracking

bareos FDpython plugin

pyvmomi

vadp-dumper

VADP = VMware vSphere Storage APIs – Data Protection

VSphere API

VADP

vddk library

Page 16: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How does a Backup Work? (1)1.  connect to vSphere server via pyvmomi2.  get VM information3.  create VM snapshot4.  query disks of VM

Page 17: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Initiate Backup

VCenter

ESXi HostVM

Block Device (virt. HD)

Changed Block Tracking

bareos FDpython plugin

pyvmomi

vadp-dumper

VADP = VMware vSphere Storage APIs – Data Protection

vddk library

VM info

create snapshot

disk info

Page 18: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How does a Backup Work? (2)1.  query CBT info (= Changed Block List)2.  create two virtual files

json work file with theconnection parametersdiskinfoCBT data (changed block info)

data file that will contain the blocks in self­contained format3.  store .json data in restore object

Page 19: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How does a Backup Work? (3)1.  run "vadp_dumper dump" with json workfile2.  vadp_dumper connects to VADP3.  read output into data file4.  fetches the CBT blocks5.  writes the blocks to bareos­fd plugin

Page 20: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Backup

VCenter

ESXi HostVM

Block Device (virt. HD)

Changed Block Tracking

bareos FDpython plugin

pyvmomi

vadp-dumpervddk library

CBT infoCBT info

json work file

transfer blocks

request blocks

backup stream (stdout)

tostorage

WorkfileDatafile

Page 21: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How does a restore work?1.  json workfile is restored as restoreobject first2.  connection to vSphere via pyvmomi

check VM is offcheck disks match

3.  run "vadp_dumper restore" with json workfile4.  vadp_dumper connects to VADP5.  backup stream is restored into vadp_dumper6.  vadp_dumper writes blocks into block device

Page 22: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Restore

VCenter

ESXi HostVM

Block Device (virt. HD)

Changed Block Tracking

bareos FDpython plugin

pyvmomi

vadp-dumpervddk library

VM off?disks match?

json work file

transfer blocks

backup stream (stdin)

fromstorage

WorkfileDatafile

Page 23: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

How is it configured in Bareos?Fileset with Plugin= directive is defined for each VM toBackupParameters are passed to python­fd pluginEverything is configured in that call

Page 24: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Plugin configurationPlugin = "python:\  module_path=/usr/[...]/plugins/vmware_plugin:\  module_name=bareos­fd­vmware:\  dc=dass5:\  folder=/bareos/subfldr­bareos:\  vmname=stephand­test03:\  vcserver=virtualcenter5.dass­it:\  [email protected]:\  vcpass=vBak.Adm­1234"                                                             

      

Page 25: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Full Fileset and Job Configuration      FileSet {        Name = "PyTestSetVmware­test03"        Include {          Options {               signature = MD5               Compression = LZ4          }          Plugin = "python:\                    module_path=/usr/lib64/bareos/plugins/vmware_plugin:\                    module_name=bareos­fd­vmware:\                    dc=dass5:\                    folder=/bareos/subfldr­bareos:\                    vmname=stephand­test03:\                    vcserver=virtualcenter5.dass­it:\                    [email protected]:\                    vcpass=vBak.Adm­1234"        }      }      Job {        Name = "PyTestVmware3"        JobDefs = "DefaultJob"        FileSet = "PyTestSetVmware­test03"      }

      

Page 26: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

DemoMake Full Backup of VMAdd FilesMake incremental BackupRemove all filesMake restoreCheck all files are back

Page 27: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

3 testfiles in /data directory of VMgw52:/data # ls ­laSep 25 15:44 testfile_2015­09­25_154432_176669929.txtSep 25 15:44 testfile_2015­09­25_154433_347270708.txtSep 25 15:44 testfile_2015­09­25_154434_186187299.txt

     

Page 28: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Full Backup Job      *run job=PyTestVmware3 level=Full yes      Using Catalog "MyCatalog"      Job queued. JobId=484      

Page 29: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Snapshot is created

Page 30: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Job Output*messages Start Backup JobId 484, Job=PyTestVmware3.2015­09­25_15.45.12_05 Starting backup of /VMS/dass5/bareos/subfldr­bareos/\   stephand­test03/[ESX5­PS100] stephand­test03/\   stephand­test03.vmdk_CBT.json Starting backup of /VMS/dass5/bareos/subfldr­bareos/\   stephand­test03/[ESX5­PS100] stephand­test03/\   stephand­test03.vmdk Elapsed time=00:01:25, Transfer rate=4.567 M Bytes/seconddir JobId 484: Bareos vmw5­bareos­centos6­64­devel­dir 14.2.4 (23Mar15):  JobId:                  484  Job:                    PyTestVmware3.2015­09­25_15.45.12_05  Backup Level:           Full  FileSet:                "PyTestSetVmware­test03" 2015­09­10 16:44:29  Elapsed time:           1 min 25 secs  FD Files Written:       2  SD Files Written:       2  FD Bytes Written:       388,244,512 (388.2 MB)  SD Bytes Written:       388,246,224 (388.2 MB)  Rate:                   4567.6 KB/s  Volume name(s):         Full­0001  Last Volume Bytes:      784,924,409 (784.9 MB)  Termination:            Backup OK  

Page 31: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

added 4 more testfiles to VMgw52:/data # ls ­laSep 25 15:44 testfile_2015­09­25_154432_176669929.txtSep 25 15:44 testfile_2015­09­25_154433_347270708.txtSep 25 15:44 testfile_2015­09­25_154434_186187299.txt

Sep 25 15:51 testfile_2015­09­25_155157_995441659.txtSep 25 15:51 testfile_2015­09­25_155158_761028556.txtSep 25 15:52 testfile_2015­09­25_155159_535871117.txtSep 25 15:52 testfile_2015­09­25_155200_281914789.txt

     

Page 32: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Incremental Job*run job=PyTestVmware3 level=Incremental yesdir Start Backup JobId 485, Job=PyTestVmware3.2015­09­25_15.51.57_06fd JobId 485: Starting backup of /VMS/dass5/bareos/subfldr­bareos/\   stephand­test03/[ESX5­PS100] stephand­test03/\      stephand­test03.vmdk_CBT.jsonfd JobId 485: Starting backup of /VMS/dass5/bareos/subfldr­bareos/\   stephand­test03/[ESX5­PS100] stephand­test03/\      stephand­test03.vmdk25­Sep 15:52 vmw5­bareos­centos6­64­devel­dir JobId 485: Bareos vmw5­bareos­centos6­64­devel­dir 14.2.4 (23Mar15):  Job:                    PyTestVmware3.2015­09­25_15.51.57_06  Backup Level:           Incremental, since=2015­09­25 15:45:14  FD Files Written:       2  FD Bytes Written:       408,859 (408.8 KB)  Termination:            Backup OK  

Page 33: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Remove all testfiles on VM andshutdown

gw52:/data # rm ­f *gw52:/data # syncgw52:/data # poweroff

     

Page 34: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Restore Job (1)*restoreAutomatically selected Client: vmw5­bareos­centos6­64­devel­fd     6: PyTestSetVmware­test03Select FileSet resource (1­9): 6+­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­+|   484 | F     |        2 | 388,244,512 | 2015­09­25 15:45:14 ||   485 | I     |        2 |     408,859 | 2015­09­25 15:52:00 |+­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­­+You have selected the following JobIds: 484,485Building directory tree for JobId(s) 484,485 ...  2 files inserted into the tree.cwd is: /$ mark *2 files marked.$ find **/VMS/dass5/bareos/subfldr­bareos/stephand­test03/[ESX5­PS100] stephand­test03/\   stephand­test03.vmdk*/VMS/dass5/bareos/subfldr­bareos/stephand­test03/[ESX5­PS100] stephand­test03/\   stephand­test03.vmdk+I+1443189129.621285$ done

  

Page 35: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Restore Job (2)JobName:         RestoreFilesBootstrap:       /var/lib/[...]s6­64­devel­dir.restore.1.bsrWhere:           /tmp/bareos­restoresReplace:         AlwaysFileSet:         Linux AllBackup Client:   vmw5­bareos­centos6­64­devel­fdRestore Client:  vmw5­bareos­centos6­64­devel­fdFormat:          NativeStorage:         FileWhen:            2015­09­25 15:54:15Catalog:         MyCatalogPriority:        10Plugin Options:  *None*OK to run? (yes/mod/no): yesJob queued. JobId=486

  

Page 36: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Run Restore Job (3)dir JobId 486: Start Restore Job RestoreFiles.2015­09­25_15.54.19_07dir JobId 486: Using Device "FileStorage" to read.sd JobId 486: End of all volumes.dir JobId 486: Bareos vmw5­bareos­centos6­64­devel­dir 14.2.4 (23Mar15):  Build OS:               x86_64­unknown­linux­gnu redhat CentOS  JobId:                  486  Job:                    RestoreFiles.2015­09­25_15.54.19_07  Restore Client:         vmw5­bareos­centos6­64­devel­fd  Start time:             25­Sep­2015 15:54:21  End time:               25­Sep­2015 15:55:08  Elapsed time:           47 secs  Files Expected:         2  Files Restored:         2  Bytes Restored:         1,071,712,520  Rate:                   22802.4 KB/s  FD Errors:              0  FD termination status:  OK  SD termination status:  OK  Termination:            Restore OK

  

Page 37: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

After restore all files are backgw52:/data # ls ­laSep 25 15:44 testfile_2015­09­25_154432_176669929.txtSep 25 15:44 testfile_2015­09­25_154433_347270708.txtSep 25 15:44 testfile_2015­09­25_154434_186187299.txtSep 25 15:51 testfile_2015­09­25_155157_995441659.txtSep 25 15:51 testfile_2015­09­25_155158_761028556.txtSep 25 15:52 testfile_2015­09­25_155159_535871117.txtSep 25 15:52 testfile_2015­09­25_155200_281914789.txt

     

Page 38: Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with ...€¦ · Backup of VMware Snapshots with Bareos Backup of VMware Snapshots with Bareos. The key technology

Questions?

Philipp Storz, Bareos GmbH & Co. KG Open Source Backup Conference 2015