Skip to content

Backup

We keep daily and weekly snapshots of the filesystem data belonging to your Asteroid, including your home directory and DocumentRoots, with the exclusions below. Databases are backed up separately, as described below.

The snapshots are mounted read-only at /backup:

[isabell@moondust ~]$ ls /backup

current  daily.0  daily.1  daily.2  daily.3  daily.4  daily.5  daily.6  daily.7  weekly.1  weekly.2  weekly.3  weekly.4  weekly.5  weekly.6  weekly.7

daily.0 is a symlink to current, which contains the latest completed daily snapshot. It is not a live view: changes made after that snapshot do not appear there. daily.1 through daily.7 provide up to seven older daily snapshots, while weekly.1 through weekly.7 provide up to seven weekly snapshots.

Your files keep their normal absolute paths below each snapshot. For example, ~/config.php from daily.3 is available at /backup/daily.3/home/isabell/config.php.

Excluded files and directories

We exclude directories with any of these names, including all their contents, wherever they occur:

  • no_backup
  • tmp
  • .cache
  • cache

This also applies to directories nested inside your applications or DocumentRoots. For example, ~/my_project/cache/ is excluded, not just ~/cache/.

We also exclude the contents of ~/logs/ and system log and temporary directories. The snapshots mounted at /backup/ are not backed up again.

Files in excluded directories cannot be restored from our snapshots. Keep files you need to restore outside these directories, or maintain a separate backup. To deliberately exclude files from our backups, put them in a directory named no_backup, such as ~/no_backup/.

Restoring files

Since the backup is mounted read-only, copy the files you need to a writable location. For a single file, cp is enough:

[isabell@moondust ~]$ cp --archive /backup/daily.3/home/isabell/config.php ~/config.php.restored

Inspect the restored copy before replacing the live file.

For a whole directory, use rsync instead. Without --delete, it copies missing and changed files but leaves files that exist only in the live destination. Always do a --dry-run before the real thing:

[isabell@moondust ~]$ rsync --archive --verbose --dry-run /backup/daily.3/home/isabell/my_project/ ~/my_project/

sending incremental file list
./
config.php
public/
public/index.html

sent [...] bytes  received [...] bytes  [...] bytes/sec
total size is [...]  speedup is [...] (DRY RUN)

Once the dry run looks right, drop --dry-run to actually restore:

[isabell@moondust ~]$ rsync --archive --verbose /backup/daily.3/home/isabell/my_project/ ~/my_project/

sending incremental file list
./
config.php
public/
public/index.html

sent [...] bytes  received [...] bytes  [...] bytes/sec
total size is [...]  speedup is [...]

Restoring the exact snapshot state

To make the destination match the snapshot exactly, add --delete to both the dry-run and the real command. This permanently deletes destination files that are not present in the snapshot. Review the dry-run carefully before running the command without --dry-run.

Trailing slashes matter

A source path ending in / copies the contents of that directory into the destination. Without the trailing slash, rsync copies the directory itself, nesting it one level deeper than you probably want.

Database backups are separate

MariaDB and PostgreSQL are backed up separately via daily dumps. See MariaDB and PostgreSQL for details.