[Borgbackup] VM backup issues

Ken Bass kbass at kenbass.com
Thu Nov 16 09:59:38 EST 2017


I am trying to backup VM images (that are LVM block device based) and 
have run into issues.

1) After looking at the some of the code, I realized that the 
--read-special is not doing what I thought it would do. I had expected 
that if a VM had not been powered on or touched in any way since the 
last backup it would not 'chunk' (if that is the proper term) the file 
during a backup. All my attempts at ignoring ctime,mtime, etc made no 
difference.

The documentation is confusing - particularly the FAQ and the 'I am 
seeing ‘A’ (added) status for an unchanged file!?' section. It says 'If 
you want to avoid unnecessary chunking, just create or touch a small or 
empty file in your backup source file set (so that one has the latest 
mtime, not your 50GB VM disk image) and, if you do snapshots, do the 
snapshot after that.'

I found the above to not be true when using the read-special flag.

2) When I create a backup my VM, I create a temp directory, symlink the 
VM block device as well as some regular files. I also symlink any file 
based images related to the VM (ie; .img or .iso). I am finding that the 
other non block files are only backing up the symlinks. How do I get it 
to backup the file, not the symlink?

I am having to resort to bind mounting non-block device files because of 
this. Is this the only solution?

3) Because of the chunking issue, I took a different approach. I wrote a 
wrapper that first does a borg list --json --last 1 to parse the archive 
'start' time. I am assuming this tells me the time of the most recent 
backup. I then check, via os.stat, if any of the VM related images have 
been modified since them (I am using mtime). If not, I skip the backup 
as unnecessary. I believe this will work as long as when I prune I am 
careful to use --last 1 so I don't delete VM images that haven't been 
powered on for a while.

*I think I found a bug doing this*. I created my tmp directory and 
os.chdir() into it. I was using 'borg create ... *' via a 
subprocess.check_output(). I think due to safety checks, the '*' was 
passed literately rather than globbing. I saw the following:

*: [Errno 2] No such file or directory: '*'
------------------------------------------------------------------------------
Archive name: test123-11-15-2017-23:02:13
Archive fingerprint: 
ccc92e6658af7384e8d38ac46bdd2999ab0ebc7538f8f2d0234e9302f966aaa6
Time (start): Wed, 2017-11-15 23:02:14
Time (end):   Wed, 2017-11-15 23:02:14
Duration: 0.01 seconds
Number of files: 0
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
                        Original size      Compressed size Deduplicated size
This archive:                  534 B                503 B                
503 B
All archives:                6.44 GB            579.06 MB             
92.35 MB

                        Unique chunks         Total chunks
Chunk index:                      68                  981
------------------------------------------------------------------------------
terminating with warning status, rc 1

It returned an rc of 1, did not backup any files, but it created an 
entry as if the backup was complete. Why was this a problem? Because 
above when I use the 'borg list --json --last 1' to see when the last 
backup was done, it appears a backup was done when it really wasn't. 
Make sense?



More information about the Borgbackup mailing list