Kopia maintenance with different owner

Hi,

I have a different setup than ususal. I have a pull setup where the kopia server pulls the backups. The remote folders are mounted with sshfs and then kopia does the backup from that mountpoint with a –-override-source.

Example:

$ mount -t sshfs root@leno:/ /tmp/tmp.zUKqYYQm3

$ kopia snapshot create --override-source=root@leno:/ --tags=id:leno@2025-11-17–10-04 /tmp/tmp.zUKqYYQm3L

Now I have an issue with running a full maintenance for this source:

$ kopia maintenance set --owner root@leno

$ kopia maintenance run --full
ERROR maintenance must be run by designated user: root@leno

What do I need to do to trigger the full maintenance for root@leno?

Looks like you’re not actually connected to the repo as user root@leno…

I am never connected as root@leno.

All kopia commands are executed on the sever as root@rakete. I am pulling the backups from the client. I am not logged into the client as root@leno. And, as you can see in my opening post, I overwrite the source with --override-source=root@leno:/.

This override-source is forcing kopia to ask for a "designated user: root@leno” when doing full maintenance. I need to find a way to covince kopia to do a full maintenance for snapshots which have been created with override-source.

Let me add a question to this issue that came to my mind.

Lets assume I change the hostname of my server from rakete to schnecke. What happens then to the maintenance command? I assume the maintenance command will fail in the same way because the old snapshots where create for owner root@rakete and this owner does not exist anymore because it is now root@schnecke.

Is that correct? What is best practise for kopia when hostnames change?

Then why did you set the maintenance owner to root@leno, anyway? Since you’re using sshfs, you’ll perform all snapshots as the user you used to connect to the repo, which is probably root@rakete and not root@leno. Since the maintenance owner should usually be the one you’re using to connect, there would be no change necessary.

Changing the owner of a snapshot would require the flag –override-user to indicate another user. You should also see all snapshots in Kopia UI right under your default user…

I found the solution.

First:

kopia repository connect filesystem --no-persist-credentials --path=/data/BACKUP/kopia-repo --override-hostname=leno --override-username=root

Second:

kopia maintenance set --owner root@leno

Third:

kopia maintenance run --full

That is doing the trick.

@budy, thanks for your time.

But now I am wondering if this maintenance thing I am doing is really neccessary.

I have one kopia repo and in this repo I have snapshots from several clients identified with override-source.

$ kopia snapshot list -a

root@acer:/
2023-11-17 10:40:00 CET k8c27489aeb6a612eb4365dbecf1cda9b 5.7 GB drwxr-xr-x files:44812 dirs:10347 (annual-3)
…

root@debserv:/
2024-11-27 16:41:26 CET k9342362f0090ffde52e28d4a963d6133 33.7 GB drwxr-xr-x files:270780 dirs:33045 (monthly-11)
…

root@leno:/
2023-04-23 22:54:00 CEST kc751e8c3394e0a2e190e8162dea52b75 42 GB drwxr-xr-x files:68069 dirs:10055 (annual-3)
…

root@macmini:/Users
2024-11-27 20:48:59 CET k0eb2ba9f4b21aad307c922e37e3d9c45 64 GB drwxr-xr-x files:165158 dirs:32933 (monthly-7)
…

root@macmini:extra-Platz
2024-11-27 20:55:33 CET kdfcaafee08a0fb32e199420e696a4a84 105.7 GB drwxrwxr-x files:132704 dirs:818 (monthly-7)
…

root@rakete:/
2024-12-30 19:33:08 CET kff9d63e91fba27974f21cc8509c025c6 109.5 GB drwxr-xr-x files:1206803 dirs:92069 (monthly-12,annual-2)
…

All this is on server rakete handled with user root@rakete. If I do a full maintenance as this user will that include all snapshots in that repo or will maintenance only happen to the snapshots with source root@rakete?

As I said, since you’re using sshfs to pull the data, the snapshots belong to the root user of rakete, unless you’re using –overwrite-username, which would only be useful, if you ever planned to connect to that repo from a remote client. If not, you can have all the snapshots belong to the current local user root@rakete and be done.

Just keep in mind, that the user rights on the files don’t necessarily represent the snapshot username.

ok. So let me double check.

I am always user root@rakete. When I do

kopia maintenance run --full

Will that do maintenance for the complete repo including everything, regardless of the override-source value?

Yes, the maintenance job will do all the maintenance tasks on the repo, regardless of what other owner is set. In the end the maintenance takes care of re-writing blobs, phasing out old blobs and the like. Nothing it does to the data in the repo itself, other than the juggling/removing of old fragments.

1 Like

The only time, I am halting that automated maintenance is when I am performing a

kopia repo sync-to operation, to ensure, that the target gets a clean sync from my repo. Other than that, I am always relying on the automated maintenance.

@budy, thank you so much.