Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: backup btrfs

  1. #1
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    478

    Default backup btrfs

    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
    www.laboiteaprog.com

  2. #2
    Join Date
    Sep 2012
    Posts
    8,237

    Default Re: backup btrfs

    Quote Originally Posted by collinm View Post
    i search a way to backup snapshot to another hd.
    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.

  3. #3
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    4,361
    Blog Entries
    5

    Default Re: backup btrfs

    Quote Originally Posted by collinm View Post
    i search a way to backup snapshot to another hd.
    Code:
    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:~ #
    Code:
    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:
    Code:
    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/
    
    openSUSE Tumbleweed, KDE Plasma, Blogs/KeepItSimple, i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), 5600X, 5700U (2022)

  4. #4
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    478

    Default Re: backup btrfs

    Quote Originally Posted by karlmistelberger View Post
    Code:
    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:~ #
    Code:
    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:
    Code:
    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
    www.laboiteaprog.com

  5. #5
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    4,361
    Blog Entries
    5

    Default Re: backup btrfs

    Quote Originally Posted by collinm View Post
    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.
    Code:
    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:
    Code:
    # /etc/systemd/system/test-rsync.service
    [Unit] 
    Description=test remote rsync 
    
    [Service] 
    ExecStart=/usr/bin/rsync -a /home/tester/ 6700k:/home/test/ 
    erlangen:~ #
    Code:
    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:~ #
    openSUSE Tumbleweed, KDE Plasma, Blogs/KeepItSimple, i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), 5600X, 5700U (2022)

  6. #6
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    478

    Default Re: backup btrfs

    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 @/.snapshots/ROOT.20220913T2116
    could work?
    www.laboiteaprog.com

  7. #7
    Join Date
    Jan 2014
    Location
    Erlangen
    Posts
    4,361
    Blog Entries
    5

    Default Re: backup btrfs

    Quote Originally Posted by collinm View Post
    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. i created 434 and 437 with btrbk, any problem if i delete them btrfs subvole delete @/.snapshots/ROOT.20220913T2116 could work?
    Yep. delete them.

    Currently I am testing:
    Code:
    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:~ #
    Code:
    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:~ #
    Code:
    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.
    openSUSE Tumbleweed, KDE Plasma, Blogs/KeepItSimple, i7-6700K (2016), i5-8250U (2018), AMD Ryzen 5 3400G (2020), 5600X, 5700U (2022)

  8. #8
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    478

    Default Re: backup btrfs

    i acces my nas via nfs

    Code:
    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?
    www.laboiteaprog.com

  9. #9
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    16,393

    Default Re: backup btrfs

    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!!!!

  10. #10
    Join Date
    Jun 2008
    Location
    Canada
    Posts
    478

    Default Re: backup btrfs

    Quote Originally Posted by gogalthorp View Post
    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
    www.laboiteaprog.com

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •