> ## Content Index
> Fetch the complete content index at: https://www.autodidacts.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to Backup Ghost on Fly.io with Rsync
- URL: https://www.autodidacts.io/backup-ghost-on-fly-with-rsync/
- Published: 2023-08-31T20:32:03.000Z
- Updated: 2024-12-05T21:45:19.000Z
- Author: Curiositry
- Tags: Tech, Tutorial, Fly.io, Ghost, Rsync, Linux

*This is [yet](https://autodidacts.io/things-ive-learned-self-hosting-ghost-on-fly-io-free-tier/?ref=autodidacts.io) [another](https://autodidacts.io/update-ghost-site-on-fly/?ref=autodidacts.io) small companion piece to my Ghost on Fly tutorials.*

![](https://www.autodidacts.io/content/images/2023/08/ghost-rsync-fly-backup-cover-image.png) 

In my last tutorial in the series, I showed how to [back up your Ghost blog hosted on Fly.io over SFTP](https://autodidacts.io/backup-ghost-on-fly-sftp/?ref=autodidacts.io).

SFTP does the job, but transferring *all* those images and files every time is a waste of bandwidth — and pig-slow.

[Rsync](https://en.wikipedia.org/wiki/Rsync?ref=autodidacts.io) is an amazing command line file synchronization utility, and a *much* better tool for the job.

It took me a while to figure out how to `scp` file to and from Fly VM persistent volumes. Once I’d figured that out[\[1\]](https://community.fly.io/t/how-to-copy-files-off-a-vm/1651/24?u=curiositry&ref=autodidacts.io), swapping `scp` for `rsync` was simple.

**Here’s how to back up your blog in seconds, rather than minutes, without sending eight years worth of uploads over the wire each time.**

In one terminal, run:

```bash
flyctl proxy 10022:22

```

In another, SSH in:

```bash
fly ssh console

```

Install `rsync` on the remote (which is running Alpine Linux, if you followed my tutorial):

```bash
apk add rsync

```

Back on your local machine, run:

```bash
ssh-agent bash
ssh-keygen -f "/home/$USER/.ssh/known_hosts" -R "[localhost]:10022"
flyctl ssh issue --agent

```

After that, run the backup! To rsync Ghost’s content files from the persistent volume:

```bash
rsync -aviz -e 'ssh -p 10022' root@localhost:/var/lib/ghost/content/ .

```

[I’m using the \-a (--archive) flag with \-z (--compress), with \-v (--verbose) \-i (--itemize-changes)](https://explainshell.com/explain?cmd=rsync+-aviz+-e+%27ssh+-p+10022%27+root%40localhost%3A%2Fvar%2Flib%2Fghost%2Fcontent%2F+.&ref=autodidacts.io).

It probably doesn’t hurt to run it with the `--dry-run` flag first, to make sure everything’s working as expected. 😇

---

In the unlikely event that you found this tutorial so helpful and thrilling that you’d like to support me, you can sign up for Ghost(Pro) with my [referral link](https://ghost.org/?via=curiositry&ref=autodidacts.io), or buy one of my [premium](https://creativemarket.com/Curiositry/3192652-weblog-%E2%80%94-old-school-ghost-blog-theme?ref=autodidacts.io) [themes](https://creativemarket.com/Curiositry/1037280-Laminim-%E2%80%94-Ghost-Theme-for-Bloggers?ref=autodidacts.io) Or, if you’re like me, host your blog [for](https://www.autodidacts.io/host-a-ghost-blog-free-on-fly-io/) [free](https://www.autodidacts.io/host-ghost-mysql8-on-fly-io-free-tier/) using one of my [free](https://github.com/curiositry/undefined-ghost-theme?ref=autodidacts.io) [themes](https://mnml.curiositry.com/?ref=autodidacts.io) instead, while thinking grateful thoughts.