abbbi / abbbi/virtnbdbackup

Only use full backups as base for differential backups

Open
#273 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
518
Forks
57
PR merge metrics
No merged PRs in 30d

Description

### Each diff backup should save all changes that have occurred since the last full backup.
`Full → Inc₁ → Inc₂ → Diff (all changes after Full) → Inc₃ → Diff (again all changes after Full)`

libvirtnbdbackup/virt/checkpoints.py
```
if args.level == "diff":
parentCheckpoint = checkpoints[0] #for take ONLY full backup
# ...
```

virtnbdrestore
```
dataFiles: List[str] = []
if args.sequence is not None:
logging.info("Using manual specified sequence of files.")
logging.info("Disabling redefine and config adjust options.")
args.define = False
args.adjust_config = False
dataFiles = args.sequence.split(",")

if "full" not in dataFiles[0] and "copy" not in dataFiles[0]:
logging.error("Sequence must start with full or copy backup.")
sys.exit(1)
else:
dataFiles = lib.getLatest(args.input, "*.data")
dataFiles = [f for f in dataFiles if '.diff.' not in os.path.basename(f)] #SKIP take diff for restoring by util
if not dataFiles:
logging.error("No data files (excluding diff backups) found in directory: [%s]", args.input)
sys.exit(1)
```

**Example workflow**
* Monday: `Full` (original copy).
* Tuesday: `Inc₁` (changes after `Full`).
* Wednesday:` Inc₂` (changes after `Inc₁`).
* Thursday: `Diff₁` (all changes from `Full`, including `Inc₁` + `Inc₂`).
* Friday: `Inc₃` (changes after `Diff₁`).
* Saturday: `Diff₂` (all changes from Full, including `Inc₁` + `Inc₂` + `Inc₃`).

**Restore to Saturday:**
* `Full` (Monday) + `Diff₂` (Saturday).

* `Inc₁`, `Inc₂`, `Inc₃` are not required - their changes are already in `Diff₂`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.