hi
i search a way to backup snapshot to another hd.
btrbk don’t seem to be work great with btrfs structure of opensuse
i search to backup my home (btrs) to a synology nas
there is btrfs-backup, don’t seem active
thanks
hi
i search a way to backup snapshot to another hd.
btrbk don’t seem to be work great with btrfs structure of opensuse
i search to backup my home (btrs) to a synology nas
there is btrfs-backup, don’t seem active
thanks
cp, tar, cpio, rsync, …
You need to be more specific about your requirements if you expect something less obvious.
btrbk don’t seem to be work great with btrfs structure of opensuse
If you explain what does not work someone may have an idea how to fix/work around it.
**6700K:~ #** btrfs subvolume show /home/.snapshots/2022-08-28T15:36
@/home/.snapshots/2022-08-28T15:36
Name: 2022-08-28T15:36
** UUID: d78f796f-13ee-5e4f-9649-ef9eca197d6f **
Parent UUID: 886ff6be-d0f6-c743-bf97-5ced16ab11b9
Received UUID: -
Creation time: 2022-08-28 15:36:20 +0200
Subvolume ID: 2050
Generation: 179292
Gen at creation: 179291
Parent ID: 263
Top level ID: 263
Flags: readonly
Send transid: 0
Send time: 2022-08-28 15:36:20 +0200
Receive transid: 0
Receive time: -
Snapshot(s):
**6700K:~ #**
**6700K:~ #** btrfs subvolume show /backup-home/.snapshots/2022-08-28T15:36
.snapshots/2022-08-28T15:36
Name: 2022-08-28T15:36
UUID: 1b2281f2-95f4-5140-a852-458624a99c54
Parent UUID: a13c80d4-f1bf-9048-b065-8c2841ff31a4
** Received UUID: d78f796f-13ee-5e4f-9649-ef9eca197d6f **
Creation time: 2022-08-28 15:36:58 +0200
Subvolume ID: 275
Generation: 330
Gen at creation: 327
Parent ID: 5
Top level ID: 5
Flags: readonly
Send transid: 179291
Send time: 2022-08-28 15:36:58 +0200
Receive transid: 328
Receive time: 2022-08-28 15:36:58 +0200
Snapshot(s):
Quota group: 0/275
Limit referenced: -
Limit exclusive: -
Usage referenced: 11.17GiB
Usage exclusive: 69.02MiB
**6700K:~ ’ **
Commands used:
btrfs subvolume snapshot -r /home /home/.snapshots/2022-08-28T15:36
btrfs send -p /home/.snapshots/2022-08-28T14\:20/ /home/.snapshots/2022-08-28T15\:36/ | btrfs receive /backup-home/.snapshots/
with this last command, you send two snapshot to the destination
i will maybe enable nfs on the nas could be easier if i want to send incremental… instead of using ssh
ssh is trivial.
**erlangen:~ #** cat /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication no
**erlangen:~ #**
Enable sshd and set “PermitRootLogin yes” on the receiver. Run “ssh-copy-id” on the sender. ssh to the receiver and turn off PasswordAuthentication.
The following service worked without any further tinkering:
**# /etc/systemd/system/test-rsync.service**
[Unit]
Description=test remote rsync
[Service]
ExecStart=/usr/bin/rsync -a /home/tester/ 6700k:/home/test/
**erlangen:~ #**
**erlangen:~ #** journalctl -b -u test-rsync.service
Sep 15 14:16:39 erlangen systemd[1]: Started test remote rsync.
Sep 15 14:16:40 erlangen systemd[1]: test-rsync.service: Deactivated successfully.
Sep 15 21:55:32 erlangen systemd[1]: Started test remote rsync.
Sep 15 21:55:32 erlangen systemd[1]: test-rsync.service: Deactivated successfully.
**erlangen:~ #**
instead of saving snapshot directly on the same place like suse done for the snapshop i could maybe specify to put the snapshot directly on the nfs and avoid to use btrfs send and receive
instead of saving snapshot directly on the same place like suse done for the snapshop i could maybe specify to put the snapshot directly on the nfs but that don’t seem possible with snapper
btrfs subvolume list /
return that
ID 256 gen 31 top level 5 path @
ID 257 gen 17131 top level 256 path @/var
ID 258 gen 15958 top level 256 path @/usr/local
ID 259 gen 11788 top level 256 path @/srv
ID 260 gen 17130 top level 256 path @/root
ID 261 gen 14320 top level 256 path @/opt
ID 262 gen 17131 top level 256 path @/home
ID 263 gen 11793 top level 256 path @/boot/grub2/x86_64-efi
ID 264 gen 11788 top level 256 path @/boot/grub2/i386-pc
ID 265 gen 17131 top level 256 path @/.snapshots
ID 266 gen 17130 top level 265 path @/.snapshots/1/snapshot
ID 292 gen 1579 top level 265 path @/.snapshots/27/snapshot
ID 293 gen 1622 top level 265 path @/.snapshots/28/snapshot
ID 300 gen 3366 top level 265 path @/.snapshots/31/snapshot
ID 301 gen 3466 top level 265 path @/.snapshots/32/snapshot
ID 370 gen 8642 top level 265 path @/.snapshots/101/snapshot
ID 371 gen 8908 top level 265 path @/.snapshots/102/snapshot
**ID 434 gen 12397 top level 265 path @/.snapshots/ROOT.20220913T2116
ID 437 gen 12413 top level 265 path @/.snapshots/ROOT.20220913T2124 **
ID 454 gen 12782 top level 265 path @/.snapshots/181/snapshot
ID 455 gen 12784 top level 265 path @/.snapshots/182/snapshot
ID 462 gen 12950 top level 265 path @/.snapshots/189/snapshot
ID 463 gen 12953 top level 265 path @/.snapshots/190/snapshot
ID 466 gen 15393 top level 265 path @/.snapshots/193/snapshot
ID 467 gen 15570 top level 265 path @/.snapshots/194/snapshot
ID 468 gen 15942 top level 265 path @/.snapshots/195/snapshot
ID 469 gen 15944 top level 265 path @/.snapshots/196/snapshot
ID 470 gen 16557 top level 265 path @/.snapshots/197/snapshot
ID 471 gen 16560 top level 265 path @/.snapshots/198/snapshot
ID 472 gen 16563 top level 265 path @/.snapshots/199/snapshot
ID 473 gen 16565 top level 265 path @/.snapshots/200/snapshot
ID 474 gen 16569 top level 265 path @/.snapshots/201/snapshot
ID 475 gen 16570 top level 265 path @/.snapshots/202/snapshot
ID 476 gen 16606 top level 265 path @/.snapshots/203/snapshot
ID 477 gen 17065 top level 265 path @/.snapshots/204/snapshot
i created 434 and 437 with btrbk, any problem if i delete them
btrfs subvole delete [FONT=monospace]**@/.snapshots/ROOT.20220913T2116
**could work?[/FONT]
Yep. delete them.
Currently I am testing:
**6700K:~ #** df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb2 141285376 45678708 94756348 33% /
**6700K:~ #** df /backup-home/
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 51200000 15654876 34874036 31% /backup-home
**6700K:~ #**
**6700K:~ #** btrfs subvolume list /
ID 256 gen 167867 top level 5 path @
..
ID 2048 gen 179158 top level 263 path @/home/.snapshots/2022-08-28T13:59
ID 2049 gen 179186 top level 263 path @/home/.snapshots/2022-08-28T14:20
ID 2050 gen 179292 top level 263 path @/home/.snapshots/2022-08-28T15:36
**...
6700K:~ #**
**6700K:~ #** btrfs subvolume list /backup-home
ID 273 gen 323 top level 5 path .snapshots/2022-08-28T13:59
ID 274 gen 327 top level 5 path .snapshots/2022-08-28T14:20
ID 275 gen 330 top level 5 path .snapshots/2022-08-28T15:36
**6700K:~ #**
The above works smoothly. As a next step I will try backup to a remote partition.
i acces my nas via nfs
192.68.31.115:/volume1/NetBackup /mnt/nfs/nas nfs noauto,defaults 0 0
On my nas volume 1 is formated in btrfs
NetBackup is a shared folder, in this folder, i created another folder mini5i_snapshot where i would like to put the backup snapshot
maybe we can access btrfs via nfs?
Not sure why you would save snapshots separate from the file system since they are not real data just diffs of the current installed OS . They have no meaning on a different drive with a different instance of the BTRFS file system. They are drive blocks that have changed. Thus are mapped to physical blocks on the drive. Doing a file backup would not preserver the blocks positions only a full binary backup of the whole FS
Snapshots are NOT backups!!!
you can do atomic snapshop and incremental snapshot
Don’t think that is default and it still is not a Backup it is a restore scheme
maybe you will more understand with a basic example…
https://linuxhint.com/back_up_btrfs_snapshots_external_drives/
you can mount also a snapshot
Interesting but still the snapshot is just changed blocks and must also reference unchanged block . Using BTRFS commands apparently copies all required block to the target. Simply copying snap files will not do that. Of course doing a full binary backup should do the same more or less.
Great! You may try something like the following:
**6700K:~ #** btrfs send /home/.snapshots/2022-08-28T13\:59 | ssh erlangen btrfs receive /home/backup/.snapshots
At subvol /home/.snapshots/2022-08-28T13:59
At subvol 2022-08-28T13:59
**6700K:~ #**
**6700K:~ #** btrfs send -p /home/.snapshots/2022-08-28T13\:59 /home/.snapshots/2022-08-28T14\:20/ | ssh erlangen btrfs receive /home/backup/.snapshots
At subvol /home/.snapshots/2022-08-28T14:20/
At snapshot 2022-08-28T14:20
**6700K:~ #**
**6700K:~ #** btrfs send -p /home/.snapshots/2022-08-28T14\:20/ /home/.snapshots/2022-08-28T15\:36/ | ssh erlangen btrfs receive /home/backup/.snapshots
At subvol /home/.snapshots/2022-08-28T15:36/
At snapshot 2022-08-28T15:36
**6700K:~ #**
Source:
**6700K:~ #** btrfs subvolume list /
...
ID 2048 gen 179158 top level 263 path @/home/.snapshots/2022-08-28T13:59
ID 2049 gen 179186 top level 263 path @/home/.snapshots/2022-08-28T14:20
ID 2050 gen 179292 top level 263 path @/home/.snapshots/2022-08-28T15:36
...**
6700K:~ #**
Destination:
**erlangen:~ #** btrfs subvolume list /
...
ID 1905 gen 369678 top level 262 path @/home/backup/.snapshots/2022-08-28T13:59
ID 1906 gen 369684 top level 262 path @/home/backup/.snapshots/2022-08-28T14:20
ID 1907 gen 369687 top level 262 path @/home/backup/.snapshots/2022-08-28T15:36
...
**erlangen:~ #**
i’m a bit lost…
/home/backup is locally, nfs or on the ssh destination?
you don’t specify your ssh user, password?
source
MiWiFi-RA72-srv:~> btrfs subvolume list /
ID 256 gen 31 top level 5 path @
ID 257 gen 22147 top level 256 path @/var
ID 258 gen 21622 top level 256 path @/usr/local
ID 259 gen 18410 top level 256 path @/srv
ID 260 gen 22137 top level 256 path @/root
ID 261 gen 20447 top level 256 path @/opt
ID 262 gen 22147 top level 256 path @/home
ID 263 gen 11793 top level 256 path @/boot/grub2/x86_64-efi
ID 264 gen 11788 top level 256 path @/boot/grub2/i386-pc
ID 265 gen 22018 top level 256 path @/.snapshots
ID 266 gen 22136 top level 265 path @/.snapshots/1/snapshot
ID 283 gen 18964 top level 265 path @/.snapshots/root-2022-09-16
destination
synology_ds220:/volume1/NetBackup/test$btrfs subvolume list /volume1/
ID 256 gen 215 top level 5 path @syno
ID 257 gen 163 top level 256 path @syno/NetBackup
ID 258 gen 214 top level 256 path @syno/homes
i tried that
btrfs send /.snapshots/root-2022-09-16 | ssh collinmadm@192.168.31.115 btrfs receive [FONT=monospace]/volume1/NetBackup
[FONT=monospace]At subvol /.snapshots/root-2022-09-16
collinmadm@192.168.31.115's password:
ERROR: cannot open destination directory /volume1: Operation not permitted
[/FONT][/FONT]
don’t understand why the password is asked… .because only with
ssh collinmadm@192.168.31.115
no password is needed, i have already provided my ssh key
I don’t specify user and password. I configured root login:
**erlangen:~ #** cat /etc/ssh/sshd_config
PermitRootLogin yes
**erlangen:~ #**
**erlangen:~ #** ssh 6700k
Last login: Sun Sep 18 21:30:08 2022 from 2001:.......
**6700K:~ #**
Source /home/.snapshots/20220918T222145 is local to 6700k, destination /home/backup/.snapshots is remote on host erlangen:
The following is not a fake. It’s is a real command and its output:
**6700K:~ #** btrfs send -p /home/.snapshots/20220918T220110 /home/.snapshots/20220918T222145 | ssh erlangen btrfs receive /home/backup/.snapshots
At subvol /home/.snapshots/20220918T222145
At snapshot 20220918T222145
**6700K:~ #**
That’s all.
seem like a synology issue
i can connect without password with
ssh collinmadm@192.168.31.115
[FONT=monospace]
ssh root@192.168.31.115[/FONT]
finally get it working
created a ssh key, copy it to my collinadm .ssh folder user on the nas
create a authorized key, copy it to the .ssh root folder on the nas
and run this command
collinm@MiWiFi-RA72-srv:~> sudo btrfs send /.snapshots/root-2022-09-16 | ssh root@192.168.31.115 btrfs receive /volume1/NetBackup/test
[sudo] Mot de passe de root :
At subvol /.snapshots/root-2022-09-16
ERROR: attribute 12 requested but not present.
At subvol root-2022-09-16
get an error… but snapshot folder is there
will check if there are any project who integrate well with snapper to backup automatically…
If it doesn’t work don’t do it. In a root shell of the target host run:
**6700K:~/.ssh #** ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:fdZaXhHKdBXS/ZZQz5qLz6A6iObCIzOn+i4nbGONKdo root@6700K
The key's randomart image is:
+---[RSA 3072]----+
| oo==|
| o.+o+|
| o..=|
| . . ++|
| S . o =..|
| o = o |
|..+ . . + o |
|BO*.o . . . + |
|X%E=. .o. o |
+----[SHA256]-----+
**6700K:~/.ssh #**
In a root shell of the source host run:
**erlangen:~/.ssh #** ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:E0G8lWZ1L/trjoNgaHZvQk3wpSDVYLkwnvJeQfQ7HiI root@erlangen
The key's randomart image is:
+---[RSA 3072]----+
| o==+o. . |
| +o**. o . |
| . B==.o . .|
| . o.+ +. o |
| oES.++ . |
| =.Bo.o . |
| + = o.. .|
| . . + ....|
| o .+o |
+----[SHA256]-----+
**erlangen:~/.ssh #**
On the source host copy id:
**erlangen:~/.ssh #** ssh-copy-id 6700k
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '6700k (2001:a62:38d:6101:8616:f9ff:fe3f:c01)' can't be established.
ED25519 key fingerprint is SHA256:RqIwUQdSC7VbPTHR4ADBlk4H2MMUSkVjP5ujrJB+smg.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@6700k's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '6700k'"
and check to make sure that only the key(s) you wanted were added.
**erlangen:~/.ssh #**
On the source host test passwordless login to target host:
**erlangen:~/.ssh #** ssh 6700k hostnamectl
Static hostname: 6700K
Icon name: computer
Machine ID: b650d066970b487eaffea649babf596a
Boot ID: 5ba6bef08a9e4921bf97c9b3aa453ef9
Operating System: openSUSE Tumbleweed
CPE OS Name: cpe:/o:opensuse:tumbleweed:20220919
Kernel: Linux 5.19.8-1-default
Architecture: x86-64
Hardware Vendor: To Be Filled By O.E.M.
Hardware Model: To Be Filled By O.E.M.
Firmware Version: P7.50
**erlangen:~/.ssh #**
BTW: Run the backup script as a service:
**erlangen:~ #** systemctl edit --full --force test-pwless-login.service
**
erlangen:~ #** systemctl cat test-pwless-login.service
**# /etc/systemd/system/test-pwless-login.service**
[Unit]
Description=test passwordless login
[Service]
ExecStart=/usr/bin/ssh 6700k hostnamectl
**
erlangen:~ #** systemctl start test-pwless-login.service
**erlangen:~ #**
View journal:
**erlangen:~ #** journalctl -b -u test-pwless-login.service
Sep 21 06:10:33 erlangen systemd[1]: Started test passwordless login.
Sep 21 06:10:33 erlangen ssh[6693]: Static hostname: 6700K
Sep 21 06:10:33 erlangen ssh[6693]: Icon name: computer
Sep 21 06:10:33 erlangen ssh[6693]: Machine ID: b650d066970b487eaffea649babf596a
Sep 21 06:10:33 erlangen ssh[6693]: Boot ID: 5ba6bef08a9e4921bf97c9b3aa453ef9
Sep 21 06:10:33 erlangen ssh[6693]: Operating System: openSUSE Tumbleweed
Sep 21 06:10:33 erlangen ssh[6693]: CPE OS Name: cpe:/o:opensuse:tumbleweed:20220919
Sep 21 06:10:33 erlangen ssh[6693]: Kernel: Linux 5.19.8-1-default
Sep 21 06:10:33 erlangen ssh[6693]: Architecture: x86-64
Sep 21 06:10:33 erlangen ssh[6693]: Hardware Vendor: To Be Filled By O.E.M.
Sep 21 06:10:33 erlangen ssh[6693]: Hardware Model: To Be Filled By O.E.M.
Sep 21 06:10:33 erlangen ssh[6693]: Firmware Version: P7.50
Sep 21 06:10:33 erlangen systemd[1]: test-pwless-login.service: Deactivated successfully.
**erlangen:~ #**
before, you said
**6700K **was your source
and **
erlangen **was your destination