I'm using bareos 18.2, to backup bunch of ova files exported from RHEV, the ova file size is the actual used size of the image after export(thin image). However bareos still allocate the real size of image during backup or restore. The sparse=yes options seems cannot handle ova files.
Anyone has experience to workaround that?
Thank you!
[root@server export-domain]# du -hs VM1.ova
20G VM1.ova <--- actual size on disk
[root@server export-domain]# ls -l VM1.ova
-rw-------. 1 root root 179142214656 Jul 13 02:56 VM1.ova <--- real file size
After backup on bareos, it shown 167GB is backed up
After restore
[root@server export-domain]# ls -l ../restored/VM1.ova
-rw-------. 1 root root 177794008064 Jul 12 15:07 ../restored/VM1.ova
[root@mgnt21 export-domain]# du ../restored/VM1.ova
166G ../restored/VM1.ova <--- reverted to full allocated file.
[root@server export-domain]# ls -l ../restored/VM1.ova -rw-------. 1 root root 177794008064 Jul 12 15:07 ../restored/VM1.ova [root@mgnt21 export-domain]# du ../restored/VM1.ova 166G ../restored/VM1.ova <--- reverted to full allocated file.That's also correct. Bareos does not punch holes in files during restore. The problem is the logic for sparse files: Bareos does detect contiguous streams of zeroes, but it doesn't check whether the region was sparse or not (I'm not aware of a portable way to do so right now). So we don't know what regions of a backed up file are sparse and therefore cannot punch the correct holes into the file during restore.
The docs are misleading then.
"By turning on the
sparse option, Bareos will specifically look for
empty space in
the file, and any empty space will not be written to the Volume,
nor
will it be restored."
(https://docs.bareos.org/Configuration/Director.html#fileset-resource
)