Restoring snapshot/backups on a fresh install

Hi, I’ve been experimenting with Kopia before committing to using it for full time cloud backup, but can’t figure out how it would actually work in the hypothetical case where my filesystem was lost and I wanted to restore from the cloud. Here are the steps I did to test out simulating this situation:

  1. Connect to a new repository for Backblaze and make a snapshot for a test directory on my system.
  2. I tested that everything was connected up fine by deleting my local copy, and then restoring the snapshot using the GUI.
  3. Then I tried to see what would happen if I deleted the snapshot in the GUI and tried reconnecting to the repository after disconnecting it, to simulate having a fresh install with just the cloud backup. But now I’m stuck because I can’t seem to get kopia to recognize there’s a snapshot in the cloud (I refreshed and saw the files still exist in my bucket), and don’t see any way to manually nudge it to see that.

So how can I use kopia to restore a cloud backup in the case I’ve lost my local filesystem/snapshot data completely? It seems to work fine when I have the kopia config all set up already to restore from cloud, but if that’s lost it seems there’s no way to recover from the cloud? What am I missing?


If you deleted snapshot how do you expect it to exist? Or am I missing something?

Deleting snapshot does not delete all data immediately - it is only done when running maintenance. But it deletes all reference to it - what is left behind is effectively garbage waiting for cleaning.

Hi, thanks for the reply. I might’ve misunderstood a bit how snapshots are managed by Kopia. I did remove the snapshot, but even after running kopia maintenance run --full, it says the files in the cloud were not deleted because they were too small (I was testing with just a few MB). I thought that if the files still existed in the cloud, then Kopia should be able to find the metadata stored there and list the snapshots from the remote when I list “All snapshots” rather than just local.

What’s the right way to try to do my experiment to convince myself I’d be able to backup from Kopia on a fresh install? The bucket still has all the same Kopia files it had before deleting the snapshot, so shouldn’t it be able to re-hook up the bucket and reads those as a remote snapshot?

I think more than a bit:)

Read docs re maintenance:

This means that effects of full maintenance are not immediate - it may take several hours and/or multiple maintenance cycles to remove blobs that are not in use.

Long story short - you deleted snapshot, what is left behind in garbage hence maintenance GC (garbage collection) has to clean it, data in the cloud will be only deleted after multiple full maintenance runs and after some time. It takes more than 24h normally.

Connect to the same repo from another computer? Or from VM? Or uninstall kopia, delete all kopia remaining files and then install again?

If you want to experiment you can speed up all GC process by running:

$ kopia maintenance run --full --safety=none

It assumes that no other kopia instance is using the same repo and is not advisable for production use. As per docs:

WARNING: As the name implies, the --safety=none flag disables all safety features, so the user must ensure that no concurrent operations are happening and repository storage is properly in sync before attempting it. Failure to do so can introduce repository corruption.

Thanks for the response. That helped clarify a few things for me. I ended up doing the experiment in the following way, in case anyone else reading wants to be “convinced” like I needed before committing to using this tool:

  1. (Starting over from a clean b2 bucket I made through their web interface) Make a snapshot in kopia using some test folder with some small sample files.
  2. Run kopia maintenance run --full --safety=none to sync those files ASAP (warning: my understanding is you should never run this safety-off flag if running kopia on multiple servers; just using here for the demonstration). Then delete the local dummy folder.
  3. Uninstall kopia and delete the local config files. For me, on Linux, this meant rm -r ~/.config/kopia ~/.config/kopia-ui/ and also deleting some kopia ~/.cache files just to be safe. This ensures reinstalling kopia won’t automatically connect to the same repo and isn’t “remembering” your files somehow locally.
  4. Reinstall kopia and hook up the b2 repository again using the exact same steps as in #1, and make sure you use the same kopia password you used in generation (to ensure the encryption syncs up correctly). Don’t worry about using the same b2 key used to authenticate kopia in step 1 since you can regenerate a new one each time using the b2 web interface.
  5. After a few (tense!) minutes and a restart or two of kopia-ui, the b2 snapshot was “discovered” in my local kopia UI interface, and I was able to follow the buttons to restore the dummy folder back to my local machine (and tested mounting it too).

It all worked! Thanks for the help and hope this helps someone else in the future. I always like doing these “proof of concept” experiments when testing out new important software, so thanks for your patience.

1 Like