Changing hostname

Hi,
I realised that changing the hostname has an impact on my restic backup. I tried to rename with the command below, and now the list of snapshots shows the rewrite. Is there a way to clean the list to show only the updated snapshots with the correct hostname?

Also…my current repository is in a folder “tumbleweed-home-fabio” and I’d like to rename to match the hostname. Is it safe to change the name of this folder?

Thanks,
Fabio

Restic version:

restic 0.18.1 compiled with go1.25.1 on linux/amd64

Command:

restic rewrite -H localhost.localdomain --new-host workstation -r sftp:fabio@192.168.20.2:/backup/tumbleweed-home-fabio
➜  ~ restic -r sftp:fabio@192.168.20.2:/backup/tumbleweed-home-fabio snapshots


repository 0f2e11be opened (version 2, compression level auto)
ID        Time                 Host                   Tags        Paths        Size
-------------------------------------------------------------------------------------------
681f10a3  2024-12-19 23:29:35  tumbleweed                         /home/fabio  1.023 TiB
fbe2bd0d  2024-12-19 23:29:35  workstation            rewrite     /home/fabio  1.023 TiB
17fbf12e  2024-12-20 13:03:11  tumbleweed                         /home/fabio  1019.116 GiB
f75b73ec  2024-12-20 13:03:11  workstation            rewrite     /home/fabio  1019.116 GiB
626e20df  2025-01-05 02:33:24  tumbleweed                         /home/fabio  1021.599 GiB
4be8bec8  2025-01-05 02:33:24  workstation            rewrite     /home/fabio  1021.599 GiB
c2d6db5d  2025-01-06 22:32:34  workstation            rewrite     /home/fabio  1021.600 GiB
41d80da6  2025-01-06 22:32:34  tumbleweed                         /home/fabio  1021.600 GiB
78ed783e  2025-01-24 07:48:28  workstation            rewrite     /home/fabio  1022.077 GiB
c6c4b664  2025-01-24 07:48:28  tumbleweed                         /home/fabio  1022.077 GiB
539ae924  2025-01-26 21:24:54  workstation            rewrite     /home/fabio  1.021 TiB
10934fba  2025-01-26 21:24:54  tumbleweed                         /home/fabio  1.021 TiB
73e01385  2025-08-22 01:42:00  workstation            rewrite     /home/fabio  1.286 TiB
76dfd407  2025-08-22 01:42:00  localhost.localdomain              /home/fabio  1.286 TiB
779150c7  2025-08-24 13:49:51  workstation            rewrite     /home/fabio  1.287 TiB
039f8989  2025-08-24 13:49:51  localhost.localdomain              /home/fabio  1.287 TiB
e5e416ef  2025-09-04 08:18:06  localhost.localdomain              /home/fabio  1.286 TiB
c7d93cbf  2025-09-04 08:18:06  workstation            rewrite     /home/fabio  1.286 TiB
03203fab  2025-09-11 12:19:11  workstation            rewrite     /home/fabio  1.286 TiB
b9e0d936  2025-09-11 12:19:11  localhost.localdomain              /home/fabio  1.286 TiB
51846ff8  2025-09-13 12:09:00  localhost.localdomain              /home/fabio  1.287 TiB
dc1c106c  2025-09-13 12:09:00  workstation            rewrite     /home/fabio  1.287 TiB
1f0505f4  2025-09-23 00:02:21  localhost.localdomain              /home/fabio  1.299 TiB
f7060be4  2025-09-23 00:02:21  workstation            rewrite     /home/fabio  1.299 TiB
817c0ee2  2025-10-13 00:49:24  workstation                        /home/fabio  1.558 TiB
3d56606c  2025-10-26 20:03:04  workstation                        /home/fabio  1.579 TiB
969d8813  2025-10-28 10:37:02  workstation                        /home/fabio  1.580 TiB
4c4da07c  2025-10-29 13:18:41  workstation                        /home/fabio  1.733 TiB
-------------------------------------------------------------------------------------------
28 snapshots

Read restic rewrite –-help

What was needed was–-forget flag when you ran restic rewrite, optionally with -–prune or followed with restic prune

As you did not do it, now you have to run extra restic forget

And again read restic forget --help… what you need is:


--host host   only consider snapshots for this host (can be specified multiple times) (default: $RESTIC_HOST)

Do not forget about prune to remove unused data.

PS. Always test your commands with –dry-run first

2 Likes

Thanks,
if you look at the command I posted, I used the -H because from the help it’s equivalent to --host. I rerun with --forget and prune and it worked. Thanks.

1 Like

@boredcollie,
Yes it is safe to change the name of the folder. Just point your future restic commands to the new location and it should work, no other changed required.

1 Like

Thanks, works like a charm :slight_smile:

1 Like