baodrate / snap-sync

Use snapper snapshots to backup to external drive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating backup in target directory fails with systemd timer

cmonty14 opened this issue · comments

Hi,

when I create the initial backup with snap-sync the tool asks for a directory. Here I typically use the hostname in order to identify different backups of multiple hosts.

No backups have been performed for 'root' on this disk.
Enter name of subvolume to store backups, relative to /backup (to be created if not existing): 

This directory is then created as a subvolume and the the backup of relevant subvolumes, e.g. root, home, etc. is started.
This all works fine and the result is this:

$ sudo btrfs su li /backup/
ID 257 gen 508 top level 5 path @backup
ID 437 gen 367 top level 257 path pc1-desktop
ID 438 gen 461 top level 437 path pc1-desktop/root/449/snapshot
ID 444 gen 480 top level 437 path pc1-desktop/home/1/snapshot

However, when I schedule a backup with systemd-timer using this systemd-config

[Unit]
Description=Run snap-sync backup

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/snap-sync --UUID de094dc0-58b7-4931-b948-4b920495bf94 --subvolid 257 --noconfirm

the backup is written to subvolume with ID=257 and a relevant directory root, home is created.

Problem:
How can I ensure that the automatic backup is written to the initially created directory pc1-desktop?

THX

snap-sync-root.txt
I have created a dump file for manual execution of snap-sync --UUID de094dc0-58b7-4931-b948-4b920495bf94 --subvolid 257

Can you post the output of the following?

sudo snapper -c root list | grep "latest incremental backup"

Having this problem too, seems that the $backupdir variable is not used when creating subsequent backups.

Having this problem too, seems that the $backupdir variable is not used when creating subsequent backups.

@FrankNoWar can you give the output to the following?

sudo snapper -c root list | grep "latest incremental backup"

@wesbarnett I do not have a root config as my root volume is not btrfs, however here is the output for my home config.
sudo snapper -c home list | grep "latest incremental backup"

22  | single |       | dim 31 jan 2021 09:26:51 | root        |          | latest incremental backup | backupdir=francois, subvolid=5, uuid=17d18cf8-2fa4-40a6-ad7d-1cdf0a61d8ef

Is this only with a timer or even when the command line is run? I can't seem to reproduce this.

I think the problem raises if the "used spaced" column is added to the table. This happened to me for one config of snapper but not for the other. awk is then selecting the wrong column. This does not happen if you add --disable-used-space