Data loss followed by backups is all too common in the VPS community. I've seen websites run for two years without a single backup, only to accidentally delete the database one day, frantically searching for recovery help—ultimately only managing to retrieve data from three months ago, resulting in significant losses. Hong Kong VPS has an additional unique characteristic: cross-border network fluctuations, inconsistent stability of some smaller data centers, and frequent overselling of low-priced VPS, making data security risks actually higher than with large cloud providers. Today, I'll directly discuss three practical and reliable backup solutions. You don't need to implement them all, but you should at least choose one.
I. Snapshot Rollback: Fastest, but also the Most "Vulnerable"
What is a snapshot? Simply put, it's a "freeze-frame" of your disk at a specific moment. Creating a snapshot is extremely fast, taking only a few seconds, and initially takes up almost no extra storage space—mainstream technologies use copy-on-write, recording only the location of data blocks during creation, and only saving the old data blocks before modification when the data is actually changed.
The biggest advantage of snapshots is their extremely fast recovery speed. A 500GB cloud disk image recovery might take 8 to 15 minutes, but a snapshot recovery only takes an average of about 120 seconds. For issues like accidental file deletion, failed upgrades, or misconfigurations, a simple rollback in the console can restore services within minutes.
However, snapshots have a fatal flaw: they are tied to your original disk. If the entire data center fails, the account is canceled, or the server is destroyed due to forgotten renewal fees, the snapshot will also be lost. Therefore, snapshots should be positioned as a "first-level response" – handling high-frequency, low-risk failures, not as the sole means of survival.
Two points to note when creating snapshots on a Hong Kong VPS:
First, if you are using LVM to create snapshots internally, you must plan the snapshot volume's storage space in advance. If data changes frequently and the reserved space is insufficient, the snapshot volume will automatically expire once it's full, potentially causing service interruption. It's recommended to use monitoring scripts to monitor usage and issue an alert when it reaches 80%.
Second, when running databases like MySQL, you must lock the table before creating a snapshot to force the cache to be flushed to disk. This ensures that the transactions in the snapshot are in a consistent and complete state, not half-written dirty data. Unlock the table only after the snapshot is created. Forgetting this step will result in restored files where transactions were never committed, leading to inconsistencies between indexes and actual data.
Tiered Snapshot Strategy (Recommended for Production Environments): Hourly incremental snapshots are retained for 24 hours, daily full snapshots are retained for 7 days, and weekly baseline snapshots are retained for 4 weeks. An automatic cleanup mechanism should also be configured; otherwise, snapshot storage costs will be shocking when you check your bill at the end of the month.
II. Incremental Backups to Off-Site Locations: A Lifeline
Snapshots solve the problem of "accidental data loss," while off-site backups solve the problem of "data center outages."
The 3-2-1 backup principle is an industry-recognized basic rule: at least three copies of data, using two different storage media, with at least one copy stored off-site. Hong Kong VPS is unique in that cross-border bandwidth is expensive and network fluctuations are significant. If the backup solution is not optimized, the network may be down before the full backup is completed. Using rsync for incremental backups is a mature solution. rsync's incremental transfer algorithm only sends the changed parts. Combined with the `--link-dest` parameter, which references the previous backup as a baseline, each incremental backup appears to have a complete directory structure, but duplicate files only occupy one copy of the space.
For cross-border backups of Hong Kong VPS, here are some optimization suggestions:
Choose the right time window: 2 AM to 6 AM is the off-peak period for traffic in the Hong Kong region, with relatively abundant network bandwidth. Performing backups during this time can reduce the impact on business and allow for faster backup transfers.
Split large files for parallel transfer: For large files exceeding 10GB, a single packet loss can halt the entire transfer over a cross-border link. Use `7z -v1g` to split large files into 1GB chunks and then use multi-threaded tools for parallel transfer.
Choose the nearest backup node: When backing up to mainland China, prioritize Shenzhen or Guangzhou nodes, where latency can be controlled to 20-30 milliseconds; for backups to Southeast Asia, choose Taipei nodes for fewer hops and lower latency.
BorgBackup is also a tool worth considering. Its deduplication and compression capabilities are very strong. 200GB of data, after compression, typically only requires about 40GB of storage space. For scenarios like Hong Kong where bandwidth and storage are expensive, the savings translate directly to cost.
III. Database-Level Backup: Precise to the Second
File system snapshots and rsync backups only back up "files on disk," they don't understand the internal logical structure of the database. If you try to restore from a running MySQL disk snapshot, the restored file might be inconsistent with transactions—some tables might have new data written, but the index files don't have corresponding entries.
The correct approach is: database-level backups + operating system-level snapshots, using a combination of both.
Mature database hot backup tools exist:
MySQL/PostgreSQL: Use mysqldump or pg_dump daily to export a full backup to object storage. Simultaneously, archive the binary logs or WAL logs off-site in real time. This not only allows restoration to the latest state but also provides precision down to a specific point in time.
Using Percona XtraBackup: This tool supports InnoDB hot backups, allowing incremental backups without locking tables. It only transfers changed data pages, minimizing impact on the running production environment.
Backup Frequency Recommendations: Prioritize backups based on business importance. Core database systems can be backed up hourly with a full backup daily; application servers can be backed up daily; static content websites only need a full backup weekly.
The most crucial point: Verify recoverability after backups. Having backup files without periodically testing the recovery process is equivalent to having no backups at all. It's recommended to conduct a recovery drill monthly, printing out the core steps and posting them near your workstation—because if the system truly crashes, you might not even be able to log into the console. Following the written steps is far more reliable than hastily consulting help documentation.
Summary: These three solutions are not mutually exclusive but rather a combination of three:
Snapshot management enables rapid rollback, resolving "accidental operation" issues, and has the shortest RTO (Recovery Time Objective).
Off-site incremental backups manage disaster recovery, solving the "data center crash" problem—a true safety net.
Database-level backups ensure data consistency, allowing for recovery accurate to the second, solving the "data corruption" problem.
Hong Kong VPS may be cheap, but data is priceless. Spending an afternoon configuring these solutions is far more worthwhile than spending a week regretting it after a failure.