# How snapshot restore works

**URL:** <https://kopia.discourse.group/t/how-snapshot-restore-works/2601>\
**Category:** General Topics\
**Created:** [January 24, 2024, 2:44pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601 "2024-01-24T14:44:24Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 2:44pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/1 "2024-01-24T14:44:24Z")

</div>

Hello! I m new here and im finding this tool really great, truly the missing piece of software!

Now i was trying to learn a bit how this works, after reading the docs i started to play a bit with a dummy path

premise: Im running this on latest image as a container in an unraid installation

now i simulated a scenario in which i only got partial data loss (so some files still exist that also do exist remotely on the repository), now i understand you can restore to a different path /app/snap\_id or to a tarball etc, but lets assume i want to restore straight in the source path

through the gui i would get this error, also by ticking “Continue on Errors” the missing file still does not get restored

from cli, instead the restore goes straight, putting back in place the missing files without any fancy flags added, now i see there is a huge behaviour mismatch here… first thing first is not clear if the cli restore with no flags added would also delete local files to match the remote or would only add the missing ones ( I can try this but tomorrow i will change the source to my actual nas and i need 100% confirmation about this ) secondly from gui as i understand there is no way to do this kind of restore, one should or mount and manually add the missing ones or restoring in a different path (with the risk of downloading TBs of data), yes you can download one by one but gets really tedious when there are a ton of small files

now i would only like some confirmation about what i said, i discovered kopia yesterday and if this is the situation i will always go with cli restore

 ![immagine](https://global.discourse-cdn.com/free1/uploads/kopia/original/1X/3f67e989a43c1704215e2e0cc6a1beb0bf670112.png)

ot: i would like to ask a tiny info here even if slightly ot, i did not understand so much about where the configs are stored since to my understanding they are both stored locally and remotely, now i dont want too technical info about this i would only like to know: lets assume i would have a fresh kopia installation and/or lose my local appdata by remembering my repository password and obviosuly by still having my repository access credentials will i manage to restore everything? I also need to know this to understand if kopia local appdata would be a single point of failure and need a better backup strategy.

Thank you all in advance 🙂

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 2:45pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/2 "2024-01-24T14:45:08Z")

</div>

this is the gui error (i could upload only one media)

 ![immagine](https://global.discourse-cdn.com/free1/uploads/kopia/original/1X/b59d6bcf6e2152c997c982afbb737b5707205cbd.png)

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 3:17pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/3 "2024-01-24T15:17:39Z")

</div>

Re restore. GUI is limited indeed. To have full control use CLI and then you can pick up whatever flags you want (overwrite dirs or not, overwrite files or not) - check [docs for details](https://kopia.io/docs/reference/command-line/common/snapshot-restore/). You can also see there what are defaults.

If experimenting you can always run with `--dry-run` to check.

> [@mich2k](#):
>
> : lets assume i would have a fresh kopia installation and/or lose my local appdata by remembering my repository password and obviosuly by still having my repository access credentials will i manage to restore everything?

Only what you need to connect to your repo is its password. And obviously repo location - local path, S3 credentials or whatever you are using. Do not worry about local appdata.

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 3:33pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/4 "2024-01-24T15:33:49Z")

</div>

ok thats some good news  
just because better safe than sorry, what about this?

 ![immagine](https://global.discourse-cdn.com/free1/uploads/kopia/original/1X/db2c2e54c76dfa1e60b382ab3375cfb58a2621a1.png)

I am using a s3-compatible storage (idrive), would i have to remember this string? I dont really know what is

edit: i guess is the username and maybe a random hostname to which kopia connects to the repo but can i change it? Is this linked to my data on repository somehow (?)

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 3:37pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/5 "2024-01-24T15:37:30Z")

</div>

This is your local computer user and host name.

You do not have to remember it.

When you list snapshots it will show you from which host and user they were created.

Potentially if using your repo from another (new) computer you might have to adjust maintenance user - see [details here](https://kopia.io/docs/advanced/maintenance/). As only one user/host is allowed to run it.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 3:40pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/6 "2024-01-24T15:40:13Z")

</div>

> [@mich2k](#):
>
> edit: i guess is the username and maybe a random hostname to which kopia connects to the repo but can i change it? Is this linked to my data on repository somehow (?)

Your snapshots have info who created them as you can use one repo to backup from multiple sources.

I think GUI only shows you snapshots of user/host you are connecting with - you can change them when connecting though.

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 3:43pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/7 "2024-01-24T15:43:16Z")

</div>

oh ok now is more clear, i already did read docs about this (and the shared credentials among users etc) but still were somewhere confused, I am starting the server as --server-username=mich and not root is this ok anyways?

This is a container and the repository will only be used from that user in that container of that computer so i dont think i ll ever go across that

maintenance info shows that root@… correctly as a owner

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 3:44pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/8 "2024-01-24T15:44:22Z")

</div>

> [@mich2k](#):
>
> I am starting the server as --server-username=mich and not root is this ok anyways?

IMO it is always better not to use root.

Though not sure what do you need server for… if you do not use it to backup multiple computers.

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 3:46pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/10 "2024-01-24T15:46:26Z")

</div>

There are many ways to skin a cat.

There is not one proper way:) Do it the way which suits you the best:)

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 3:47pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/11 "2024-01-24T15:47:05Z")

</div>

gotcha, thanks for your precious help

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 3:55pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/12 "2024-01-24T15:55:59Z")

</div>

> [@kapitainsky](#):
>
> You do not have to remember it.

but i have a doubt, if is possible to backup data from more users, how can i retrieve the data if i dont have that root@477… string?  
Kopia read that automatically from remote if locally is missing then

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 5:39pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/13 "2024-01-24T17:39:57Z")

</div>

When you connect to your repo you can specify who you connect as (user/host). Default is your local machine user/host

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 6:09pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/14 "2024-01-24T18:09:56Z")

</div>

but since this is a container the hostname is totally random, if i would re-create the container i would have a different string there

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 7:54pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/15 "2024-01-24T19:54:16Z")

</div>

I am not using containers myself so won’t give you exact solution.

But user/host is the same sort of parameter like your S3 key/secret. Latter you have to provide and former either you let defaults (random in case of containers) to be used or specify explicitly.

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 24, 2024, 8:38pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/16 "2024-01-24T20:38:02Z")

</div>

Sorry since English is not my mother tongue (as obvious) I didn’t fully understood your message

That root@host is an actual key to repository? I mean without that I can’t access?

If yes then I could just change that to user@host for example (a random one that I can remember)

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 24, 2024, 8:42pm UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/17 "2024-01-24T20:42:59Z")

</div>

Ok better to use example:

```auto
kopia repository connect s3 \
        --bucket=... \
        --access-key=... \
        --secret-access-key=...

```

will connect using your container random user/host

but

```auto
kopia repository connect s3 \
        --bucket=... \
        --access-key=... \
        --secret-access-key=... \
        --override-hostname=my_server \
        --override-username=backup_user

```

will use `backup_user/my_server`

If you can pass `--access-key` to your container then you can also pass `--override-hostname`

> [@mich2k](#):
>
> That root@host is an actual key to repository? I mean without that I can’t access?

Nope. Only what is needed to access your repo is its password. But the way kopia works is that you connect to repo using specific user/host pair - then e.g. in GUI your will only see snapshots with matching values.

Using CLI you can see all snapshots from your repo - but not by default - you need flag:

`--[no-]all -a false Show all snapshots (not just current username/host)`

Also you need specific user/host to run maintenance etc. When you run all on one computer it is not something you have to worry about but with your containers looks like you have to take it into account.

---

<div class="post-metadata">

**Author:** ![mich2k](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mich2k](https://kopia.discourse.group/u/mich2k)\
**Post date:** [January 25, 2024, 10:41am UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/18 "2024-01-25T10:41:25Z")

</div>

ok I did manage to figure this out, i deleted everything from my repository and started over again, i was using a quite badly made docker template

what matters is to use these flags when spinning up the container:

`--hostname=kopia --cap-add=SYS_ADMIN -e PUID=1000 -e PGID=1000`

if on unraid:

`--hostname=kopia --cap-add=SYS_ADMIN -e PUID=99 -e PGID=100`

and in both case should be mapped the device /dev/fuse:/dev/fuse for snapshot mounting (and sys\_add permission, in alternative the container should be ran as privileged)

in this way I just assigned the hostname “kopia” to the container without any override from kopia itself, even if im still under root (root@kopia) but is ok for me

Now I know this use case may seem quite specific since you are quite losing or not considering the multi-user capability of kopia but I guess really many users have my same set up (only on unraid appstore both kopia images overtake the 1.5 million downloads)

For further (few) docs there is this repository: [GitHub - imagegenius/docker-kopia](https://github.com/imagegenius/docker-kopia) where they made a really good job

Thank you again for your demystification !

---

<div class="post-metadata">

**Author:** ![kapitainsky](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kapitainsky/32/535_2.png) [@kapitainsky](https://kopia.discourse.group/u/kapitainsky)\
**Post date:** [January 25, 2024, 10:59am UTC](https://kopia.discourse.group/t/how-snapshot-restore-works/2601/19 "2024-01-25T10:59:50Z")

</div>

Thx for sharing your findings! It for sure will be useful for people attempting similar setup.
