All systems operational 12 elite locations · Europe & Asia Pay with crypto · 0 KYC
Home / Guides / VPS Backup and Restore: 3-2-1 on Root Servers
Guide

VPS Backup and Restore — 3-2-1 on Root Servers

VPSbit offsite backup still: two racks syncing across arrows

Separate state from rebuildable, keep three copies on two media, and test the restore. Borg and Restic recipes for root servers from $4.80/mo annual.

Short answer

Separate state from rebuildable, keep three copies on two media, and test the restore. Borg and Restic recipes for root servers from $4.80/mo annual.

Draw the state line before anything else

The fastest restore is the one that never touches most of your disk, which is why backup planning starts with deletion rather than copying. On a typical root server the irreplaceable set is small: the databases, the uploaded files, the TLS private keys, and the configs that took a week to get right. The operating system itself is reproducible. For every path on the box, ask one question before anything else: if this vanished at 3 a.m., would you retype it or rebuild it? If the honest answer is rebuild, it does not belong in your repository.

That line divides the work into two artifacts: what is state gets copies, and what is rebuildable gets a script. A short Ansible playbook or cloud-init file that you actually update beats a golden image you forgot existed, because a script is reviewable, versionable, and testable on a spare box before it matters. The dividend is restore speed: pulling 3 GB of real state from a repository takes minutes, while reinstalling and re-tuning a hand-built server reliably eats a working day. Automating the rebuild is where restore speed actually comes from, and it is the cheapest hour you will spend on this whole project.

Run the inventory with real paths instead of vibes. /etc holds the configs and the WireGuard keys, /var/lib/postgresql or /var/lib/mysql holds database state, /home holds user keys and repositories, and /srv or /var/www holds uploads and site roots. Measure each with du -sh and write the numbers down; on a server with an 80 GB NVMe disk the state total usually lands in single-digit gigabytes. That number decides the size of everything downstream: the repository, the target box, the bandwidth of the first sync, and the number of minutes a restore will take when it counts.

Two mistakes eat this stage. The first is archiving everything nightly to be safe: the repository bloats, every run gets slower, and the state you actually needed hides inside noise you will never restore. The second is the golden image, a snapshot of a tuned server that quietly rots while packages and kernels drift, so the one time you reimage from it, the image itself fails. A build script you run monthly stays true to the box; an image you have not rebuilt in a year is a guess with a file extension, and guesses fail at the worst hour.

Once the line is drawn and the numbers are written down, the 3-2-1 pattern tells you where the copies live and what each one is for. The pattern is old because it works, and because most of its failures are self-inflicted: the next section maps each copy to the disaster it answers, and shows why one of them must be able to outlive the box itself.

VPS from $4.80* — Core on the annual term (list $6/mo), one invoice for 12 months, no auto-charges. Dedicated with IPMI from $39.20/mo. Crypto invoice, no KYC.

Launch now

Three copies, two media, one restore you have actually run

The 3-2-1 rule sounds like folklore, but it is really a map of failure domains: three copies exist because three different things can break. The live data is copy one, and it is already failing by definition the moment you need this rule. Copy two is an on-box snapshot for second-level rollback, the bad deploy you want gone in two minutes. Copy three is the off-box backup that survives the box itself, which is the only one that answers a dead provider, a dead rack, or an encryption event. Each copy has a job; trouble starts when one copy is asked to do all three.

Two media matters just as much: local NVMe for recovery measured in seconds, plus a copy on storage that is genuinely separate, whether a different account, a different provider, or cold storage you mount on demand. Restoring from local NVMe is a cp away; pulling a repository across a 1 Gbps unmetered port is an overnight event for a large dataset and a coffee break for a small one. Media separation is what keeps a single controller failure, or a single ransomware process running with the box's own credentials, from reaching both copies in the same minute.

The third one, a tested restore, is the only line of the rule anyone remembers under pressure. Schedule it: a run that restores into a scratch directory and diffs against the source, on a calendar, every quarter. Untested backups fail silently, in ways that only show up when the diff says the 40 GB you thought you had is actually 4, or when the one file you need was pruned three weeks ago by a retention policy nobody reviewed. A restore test is the audit; everything else in the rule is bookkeeping that feeds it.

The classic mistake here is arithmetic flattery: counting a RAID 1 mirror as a second copy, or counting an on-box snapshot as off-box. Both live inside the same failure domain you are insuring against, which is the same driver, the same controller, the same hypervisor, and sometimes the same rack. Two copies at one provider is 2-1-1, and one ransomware event with access to mounted storage collapses it to 1-1-1 before you notice anything. Keep the third copy where this box cannot reach it using the credentials the box holds, and the rule starts doing its job.

With the three roles named, the tools fall into place: Borg and Restic produce the off-box leg with encryption and deduplication built in, and the platform snapshot add-on covers the fast-rollback role. The two are constantly confused, and the next section draws the line between them before the confusion costs you a restore.

A snapshot is a rollback, not a backup

Platform snapshots feel like backups because both bring files back, but they answer different disasters. A snapshot lives on the same platform as the live box, often in the same storage pool, the same cluster, the same company. It is exactly the right tool for the failure you cause yourself: a broken deploy, a bad modpack update, a config edit that will not boot. It is the wrong tool for the failure the platform causes, and the wrong tool for the failure that arrives encrypted, because both of those can take the snapshot layer down with the live one.

On VPSbit, snapshots ride VPS plans as a checkout add-on, and that is the honest scope: right for pre-change rollback, too shallow to call a strategy alone. The off-box leg is where a second box earns its rent: a Borg or Restic repository on a target you control keeps the copies inside the same crypto-only, no-KYC rails as the source, and the target never holds plaintext, which the next section makes permanent. The two layers cost minutes a month together and answer failures neither could answer alone.

Size the target from the state numbers you wrote down in the first section: order Core at $6/mo list — $4.80/mo on the annual term — while the repository fits 80 GB of NVMe, and step up to Titan at $24 list, $19.20 annual-eff, when deduplicated history wants the 320 GB and the unmetered 10 Gbps port for faster initial syncs. One invoice covers it, and the twelve cities let you put the copy in a different jurisdiction from the source if the copy should sit outside the source's legal reach.

Two snapshot-specific traps close this section. First, most snapshot implementations restore whole disks, not files: rolling back to rescue one config reverts every database on the box to the same minute, which is why the database pipeline later in this guide matters even with snapshots enabled. Second, retention: snapshots are kept in generations, so a month of backups can be three generations deep and silent about it. Snapshot for speed; back up for survival; and let the restore test in the seventh section keep both of them honest, because neither will volunteer its own limits.

The target you just rented will never read what you send it, if you configure encryption at the source properly. That single setting turns a stolen repository into a non-event, and it is the subject of the next section.

Encrypt at the source, so the target is never a liability

The scariest machine in your backup design is the one holding all the copies, unless it cannot read any of them. Client-side encryption changes the threat model completely: Borg and Restic encrypt before a byte leaves the source, so the target stores ciphertext, a compromised target is not a breach, and a curious bystander with root on the target sees noise. This is also why the off-box leg should never be a plain unencrypted rsync into a directory, however convenient it looks on day one.

Both tools make the default path the right one. borg init --encryption=repokey creates a repository whose key is derived from your passphrase and stored inside the repo itself; restic init does the equivalent at first backup, and both are documented plainly in Borg's documentation and Restic's manual. Passphrases travel through environment variables, BORG_PASSPHRASE and RESTIC_PASSWORD, which is what makes unattended nightly runs possible without a human at the prompt. Keyfile mode instead splits the key into a file under ~/.config/borg/keys/, which is stricter but adds a second artifact to lose. Pick one mode, write the choice into the runbook, and keep it for the life of the repository.

Then close the paradox: the encryption key is now the only unrecoverable piece of state in the whole design. A repository without its passphrase is random noise, Borg and Restic will not brute-force it for you, and there is no support ticket that repairs a forgotten passphrase. So the key itself gets the 3-2-1 treatment: the passphrase in a password manager, a printed copy in a drawer if the threat model allows one, and a line in the runbook stating which mode the repo uses. Losing the key loses every copy at once, which is the only single point of failure you can still create at this stage.

The recurring failures are operational, not mathematical. A passphrase pasted into .bashrc so cron works means anything that reads your dotfiles reads your backup identity. A repokey created on Friday with the passphrase written on a sticky note that dies with a laptop turns four years of history into noise. And the subtle one: the key works today because it sits cached in your shell, but the restore test in a fresh session prompts for a passphrase nobody remembers. Every one of these is caught by the quarterly restore test, which is one more reason it is scheduled rather than heroic.

Files, configs and keys now travel encrypted and deduplicated. Databases need one more layer on top, because their state changes mid-copy and a file-level snapshot of a running engine is a lottery, which the next section fixes with a pipeline of its own.

Databases want their own pipeline

Copying a running database directory is not a backup; it is a corruption lottery with extra steps. An engine like PostgreSQL or MySQL spreads data across many files and buffers writes in memory, so a byte-for-byte copy taken mid-flight misses transactions that exist in one file but not another. The copy may restore cleanly, may restore partially, or may refuse to start, and you will not know which until the restore test you have not run yet. Databases earn a dedicated pipeline because their consistency lives at transaction boundaries, not at file boundaries.

The floor is a consistent logical dump: pg_dump -Fc takes a consistent snapshot at a transaction boundary, compressed and restorable with pg_restore. MySQL answers with mysqldump --single-transaction, which does the equivalent for InnoDB tables without locking readers out. Run the dump before the file-level pass, ship the dump file with everything else, and the daily floor holds: databases get continuous archiving where the platform and engine support it, and daily dumps as the fallback that still beats nothing.

Continuous archiving is the upgrade, and PostgreSQL documents it plainly: set wal_level=replica, point archive_command at a copy target, and every write-ahead segment ships off-box as it fills, as described in the continuous archiving chapter. Replay the base backup plus the archived segments and you reach any point in time, not just last night, which converts a 3 p.m. mistake into a 2:59 p.m. restore instead of losing the whole day. That is the difference between a backup policy and a recovery capability, and it costs one config line plus the disk to hold segments between shipments.

The typical mistakes are version and drift. A dump restored into a newer major version may work; into an older one it will not, so record the engine version next to the dump or make pg_dump --version part of the archive naming. Second, rsync-ing /var/lib/postgresql while the server runs, because the nightly file job makes it look free until the restore fails to start. Third, dumps that have never been restored: a file that passes pg_restore --list has proven it parses, not that it restores. The quarterly test in the next section is what proves the second thing, which is the one that matters.

With state captured consistently and shipped encrypted, what is left is arithmetic: how often to run, how long to keep, and how much history the repository needs. Schedules and retention are next, and both are set by numbers rather than mood.

Schedules and retention, set by math not mood

How often should you back up is the wrong question, because the honest answer depends on two numbers you have not written down yet: how many minutes of work you can afford to lose, and how long you can afford to be down. The first sets the schedule, the second shapes the design. For most boxes the answers are quieter than expected, daily files and continuous databases and a rehearsed restore path, which is why the floor throughout this guide is daily rather than hourly, and why hourly rarely survives its own bandwidth bill.

Files get a daily run as the floor; databases get continuous archiving where supported, per the pipeline above. Retention then becomes a ladder: borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6 keeps seven dailies, four weeklies, and six monthlies, a 7-4-6 default that fits most workloads. Restic speaks the same grammar through restic forget --keep-daily 7, and both prune commands belong in the same crontab entry family as the backup itself, as the cron format makes recurring runs trivial. The repository does not grow by a full copy each night, because deduplication stores only changed blocks, and text-heavy state often compresses to a fraction of its raw size.

Bandwidth arithmetic keeps the schedule honest. An initial push of 80 GB over a 1 Gbps unmetered port is roughly eleven minutes at wire speed, realistically an evening once protocol overhead and disk limits have their say; nightly deltas afterwards are seconds to minutes. Unmetered matters here: a backup job is exactly the workload that makes metered billing unpredictable, and an off-box copy you skip to save bandwidth is a copy you do not have. Budget the first sync like a project and the daily runs like a reflex.

The failure modes are all timing. Prune before check, and a corruption event introduced last night can prune away the last good generation, so run borg check or restic check before pruning, not after. Two overlapping cron runs corrupt the lockfile and interleave writes; wrap the job in flock or move it to a timer that refuses overlap. And retention set too tight, seven dailies with nothing behind them, means the slow corruption you discover today has already rotated out of the repository. The ladder exists precisely for failures that take weeks to notice.

The schedule now runs unattended, which is exactly why the last piece must be scheduled with the same discipline: the restore test that decides whether any of this was a backup or a hobby. It is the seventh section, and it is the one that matters.

The quarterly restore test is the only audit that counts

An untested backup is a hope, not a backup, and hope is precisely what fails at 4 a.m. The restore test is not an emergency activity; it is a scheduled run, quarterly, that restores into a scratch directory and diffs. Its output is not a feeling of safety but two numbers: how long the restore took, and how many bytes differed. Everything else in this guide is preparation for the morning those two numbers appear on a calendar invite instead of an incident channel, and the difference between those two mornings is the entire return on this discipline.

The mechanics are boring on purpose. mkdir /srv/restore-test, then borg extract or restic restore the latest archive into it, then diff -r against the source paths and sha256sum spot checks on the files that pay the bills. Databases get their own proving ground: pg_restore into a throwaway cluster, run the application's schema check against it, and count rows on the two or three tables the business actually reads. Record the elapsed time, because that number is your real recovery time objective, and it belongs in the runbook rather than in your memory.

Once a year, escalate the test: a full rebuild into a scratch VM using the Ansible playbook, the repository, and nothing else. That run proves the runbook, not just the repository, and it is the only rehearsal of the real disaster, the box is gone, the replacement is blank, and the only inputs are the script and the copies. An hour of rehearsal a year is cheap against a day of improvisation at the worst possible moment, and the rehearsal usually finds the one step nobody wrote down.

Two ways tests lie. Testing on the same box with cached credentials proves the repository but not the runbook, because the passphrase in the environment variable is not the passphrase in your head. And testing only extraction proves bytes, not service: a web app restored to /srv/restore-test that has never been booted may carry state assumptions the diff cannot see. Schedule the test like the backup, quarterly, with the same cron discipline, because untested restores fail silently and silence is exactly what the calendar entry is for.

State line, copies, encryption, database pipeline, retention, test: six moving parts that either hold together or do not. The final section assembles them into a single order of operations you can run start to finish, on one new box, in one sitting.

The 3-2-1 backup routine, in the order to run it

Start with the line. Walk the box, list the state paths, /etc, the database directories, /home, /srv — and measure them with du -sh, writing the numbers down because they size the target and predict the restore. In the same sitting, refresh the rebuild script: the Ansible playbook or cloud-init file that turns a blank image into this server. If the script is stale, updating it now is part of the backup work rather than a separate chore, because the day you need it is not the day to discover it references packages that no longer exist.

Second, rent the target and init the repository. A second box as the Borg or Restic target keeps the off-box leg on rails you already trust; init it with encryption on the first day, borg init --encryption=repokey or its Restic equivalent, and put the passphrase somewhere that survives a dead laptop. Third, wire the database pipeline before anything else, because it has the tightest consistency requirements: pg_dump -Fc at minimum, WAL archiving if the engine and schedule support it, and the single-transaction dump for InnoDB. The database step leads because everything else can tolerate a file-level copy, and it cannot.

Fourth, schedule the daily file job with the retention ladder attached, borg prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6, wrapped in flock so runs cannot overlap, with checks ordered before pruning. Fifth, put the platform snapshot on the calendar as the pre-change ritual: snapshot before modpack updates and risky deploys, so the fast-rollback leg is always fresh — the game-server guide shows the ritual in action. The two legs answer different failures, and the order matters: the off-box copy protects you from the platform, the snapshot protects the platform from you.

Sixth, run the first restore test the same week the schedule goes live, not in a quarter when it is theoretically due: extract into /srv/restore-test, diff -r against the source, restore the database into a scratch cluster and boot the app against it. Then put the quarterly recurrence on the calendar with the elapsed time written next to it. Finish the sitting by writing the runbook: passphrase location, keyfile copies, repo mode, and the two recovery numbers, so the next person who is not you can execute it at 4 a.m.

From then on the routine maintains itself: daily jobs prune, quarterly tests prove, and the only recurring human task is keeping the rebuild script true to the box as it evolves. When state grows past the target's disk, resize the target first and the repository second, never the other way around, because a repository that cannot fit is a repository that silently prunes its own history.

Are snapshots backups?

No — snapshots are fast rollbacks on the same platform as the live box, so they cover a bad deploy but not a provider failure or ransomware. Keep them for pre-change rollback and let an off-box encrypted copy, Borg or Restic to a second box, be the layer that answers platform-level disasters.

How often should I back up?

Databases: continuous archiving where supported, daily as the floor. Files: daily. And schedule the restore test quarterly, because untested restores fail silently — the schedule that produces copies is half the job, and the tested restore is the half that decides whether any of it works.

Can I back up to a VPSbit box from another provider?

Yes. Any server with SSH can push to your box over SFTP or native Borg and Restic protocols, and the target never learns where the source is hosted. Encrypt at the source so the target holds ciphertext only, and the copy keeps your crypto-only, no-KYC posture end to end.

What about backing up dedicated servers?

Same pattern, bigger sets: there are no snapshots on metal, so the off-box leg carries the whole design — a VPS tier sized to the data, pulled with Borg or Restic over SSH. Treat RAID as redundancy, not backup: a mirror answers a dead disk, not a dead server or a deleted directory.

How big should the backup target be?

Start from the state size you measured with du, then multiply by retention depth and divide by the dedup ratio you observe after the first month — text-heavy repositories routinely land well under their raw size. An 80 GB target carries small state sets, 320 GB absorbs growing history, and a faster port shortens the initial sync.

Primary sources

More ways to pay

Pay with Bitcoin · Pay with Monero · Pay with USDT (TRC-20/ERC-20/SPL) · Pay with Litecoin · Pay with Ethereum · Pay with Solana · Pay with x402 · Pay with Dogecoin · Pay with XRP · Pay with TRX · Monero on bare metal · Dedicated servers with crypto · Pick the jurisdiction first.

Ready to launch?

Build the box — VPS or bare metal — create the password, pay the invoice that follows.