DEV Community

Cover image for VolBack: Backup tool
JA Proger
JA Proger

Posted on Edited on

VolBack: Backup tool

Intro

VolBack?
What's it?
I started to think about potential sum of volumes of everyday backups.
Backup is a full copy of the system for a unit of time (UT).
We know that backups is one of the most important part in backend of any computer system.
Nevertheless, we know backups have weaknesses... There's only one — duplication. Funny thing is that duplication in the case of backups is essential.

Math section

Basic case

Imagine we have a CRM, which has a lifetime of 3 days.
We need to backup it each day.

  • Day 1. We added 100 mb
  • Day 2. We added 50 mb
  • Day 3. We added 30 mb

What does it mean?

  • Backup for day 1: 100 mb
  • Backup for day 2: 100 mb + 50 mb =150 MB
  • Backup for day 3: 150 mb + 30 mb =180 MB

Nice!

So the total backup volume will be: 100 mb + 150 mb + 180 mb =430 MB.

To handle this calculations I find a mathematical formula for this process.

Sn=n⋅x1+∑i=1n−1(n−i)∗ai S_n = n \cdot x_1 + \sum_{i=1}^{n-1} (n - i) * a_i

If:

  1. n>1n > 1
  2. ∣a∣=n−1|a| = n - 1
  3. x1>0x_1 > 0
  4. Sn>0S_n > 0

Where:

  • n: quantity of UT (second, hour, day, etc)
  • x1x_1 : initial value of volume at first UT
  • a: array of a values (additions in volume at each IT)

Special cases

There are special cases of backup volume calculations.

  • If n = 1, we don't need a at all. Therefore S1=x1S_1 = x_1
  • If a is absent, so Sn=n⋅x1S_n = n \cdot x_1
  • If a is static, so Sn=n⋅x1+∑i=1n−1(n−i)⋅aS_n = n \cdot x_1 + \sum_{i=1}^{n-1} (n-i) \cdot a

Development

I will expand this method in case when we don't know additions' values.

Watch the repository https://github.com/ja-proger/VolBack. Now available on Swift
Write down any ideas in the comments below!

Top comments (2)

Collapse
 
scsoi profile image
疏影 •

VolBack is a clean volume-level backup tool. Two design patterns that complement it:

  • Target the backup output at an S3-compatible bucket (or SMB NAS), then on Windows admin workstations mount that target as a drive letter. ScsDriver handles SMB / S3 / SFTP / WebDAV so the same mount table also carries any other shares — useful when 'where is the latest backup' is the daily admin question.
  • For restores, 'mount and double-click' is much faster than 'extract from object storage by date'. Auto-reconnect across sleep / VPN / 网卡切换 means the admin sees the latest snapshot in Explorer without re-running commands.

Couple of small notes for anyone running this at small-team scale:

  • If the same Windows workstation also has a daily-mount S3 target, one mount client with both backends keeps the user mental model to one filesystem.
  • Long-term cold (Glacier / Archive / B2 cold) is great for the off-site copy; pick the tier before you pick the cost. We've moved hot backups to S3 IA + cold to Glacier, both mounted side-by-side via ScsDriver.
  • For SMB targets, mind the 'multiple connections to server' default on Windows; using distinct service accounts side-steps it. Thanks for sharing.
Collapse
 
scsoi profile image
疏影 •

Backup tools like this only shine if the destination is reachable. Three Windows patterns we use:

  1. Veeam / Veeam-style agents need a target they can write to as a UNC path. SMB share on a NAS works, but on flaky links or across site-to-site VPN, the job hangs and you discover it at 3am. We pre-stage a network drive letter so the agent sees a stable mount point.

  2. Restic / Borg / Duplicity are great for block-level dedup but their backup target is typically a local path or rclone-mounted cloud. Mounting rclone as a drive letter on Windows is doable but the FUSE layer eats IOPS — for high-volume nightly backups, run them on Linux.

  3. Don't rely on backup alerts alone — practice a quarterly restore drill to a blank VM. We've seen too many backups that read OK in the UI but restore corrupted because the dedup index is silently broken.

For ops on Windows who need to browse backup shares alongside local disks: ScsDriver