Different Host Name When Moving Restic Copy

Hello, forgive my English, I am using a translator.

I had a backup made with Restic and I had to reinstall the OS. Linux.

I saved the entire directory where the Rectic copy was located, installed the new OS, and copied the directory back to the HDD.

After some time making new backups with Rectic, I have discovered that the snapshots have a different host, I suppose it is because the computer is called differently in the new and old OS installation.


repository 83d5ec29 opened (version 2, compression level auto)
ID        Time                 Host                   Tags        Paths
---------------------------------------------------------------------------------------
ff441d5f  2023-09-15 02:34:48  AMD5RYZENLINUX                     /media/bitlockermount
94f9589e  2023-09-29 21:11:35  AMD5RYZENLINUX                     /media/bitlockermount
b0505141  2023-10-30 17:58:20  AMD5RYZENLINUX                     /media/bitlockermount
b69171ff  2023-11-02 17:09:28  AMD5RYZENLINUX                     /media/bitlockermount
be3030e8  2023-12-27 18:42:41  AMD5RYZENLINUX                     /media/bitlockermount
ab9783dc  2024-01-31 16:33:50  AMD5RYZENLINUX                     /media/bitlockermount
2c524777  2024-02-28 17:05:14  AMD5RYZENLINUX                     /media/bitlockermount
d2c40980  2024-03-28 11:55:50  AMD5RYZENLINUX                     /media/bitlockermount
40937977  2024-04-29 20:54:49  AMD5RYZENLINUX                     /media/bitlockermount
d66a2983  2024-05-30 21:58:41  AMD5RYZENLINUX                     /media/bitlockermount
b1a09ce7  2024-06-26 21:25:17  AMD5RYZENLINUX                     /media/bitlockermount
fa479263  2024-07-25 11:26:22  AMD5RYZENLINUX                     /media/bitlockermount
1a863253  2024-08-23 20:01:59  AMD5RYZENLINUX                     /media/bitlockermount
be4f59ab  2024-09-27 15:43:36  david-amd5-linux-mint              /media/bitlockermount
f08413e1  2024-10-27 11:59:08  david-amd5-linux-mint              /media/bitlockermount
3926552f  2024-11-27 16:50:20  david-amd5-linux-mint              /media/bitlockermount
ae298bd8  2024-12-20 18:26:53  david-amd5-linux-mint              /media/bitlockermount
f712a48d  2025-01-10 17:20:24  david-amd5-linux-mint              /media/bitlockermount
fa5eb0d8  2025-01-18 19:58:00  david-amd5-linux-mint              /media/bitlockermount
39a0517b  2025-01-21 16:29:00  david-amd5-linux-mint              /media/bitlockermount
b60c59f2  2025-01-30 18:24:35  david-amd5-linux-mint              /media/bitlockermount
5f5e6101  2025-02-03 15:40:25  david-amd5-linux-mint              /media/bitlockermount
95a63d06  2025-02-05 17:17:18  david-amd5-linux-mint              /media/bitlockermount
---------------------------------------------------------------------------------------
23 snapshots

When applying deletion policies by date, work as if they were two different sets.

How can I know if they all form a single set or if they have been differentiated when making the backup? That is, if between the last one with host AMD5RYZENLINUX and the next one with host david-amd5-linux-mint, there are duplicate data.

If this is correct and I take them as a single set, how can I change the host of the first ones?

All repository data is deduplicated regardless of different hostnames. It is pretty much cosmetic issue but extra effort needed to manage operations like forget.

Changing hostname is easy. See docs:

Other solution would be to ignore it, preserve hostnames and start using tagging. Add the same tag to all snapshots and then group by tag when running forget. See docs for details about tags. Effectively something like:

# add bitlocker tag to all snapshots without any tag
restic  tag --tag '' --add bitlocker

# now we can treat all snapshots as one set defined by tags, so for forget:
restic forget --group-by tags [keep rules]

# do not forget for future new snapshots to always set tag
restic backup --tag bitlocker

Forget operation by default groups snapshots by their host name and paths (--group-by host,paths) - this is why now you see two sets.

Up to you how to approach it. I prefer tags as it allows me to nicely arrange all snapshots in logical groups regardless of hostname and path.

2 Likes

Thank you very much for the answer. In the end I changed the host name but first I had to uninstall the version 0.16.4 that was in the Linux Mint repositories, that version did not allow the change name host. Then I installed the binary of the latest version 0.17.3, a version that already allows you to change the host name.

Good that you solved it. Most Linux repos are very poorly maintained in terms of 3rd party software updates. Unless you switch to rolling ones like Arch or Suse Tumbleweed.