Hello,

I have a system that btrfs sends daily its rootfs to another system
far away. Incrementally (this is important to saving bandwidth since
we're talking about half a TB).

For a while my first system's hardware was out of commission, so I
spun it up (systemd-nspawn) on the second system since I had all the
files there. Now it's time to get back my services on the first
system, so i want to merge my changes I made on the second system.
Turns out to do this incrementally is a bit of a problem.

>From what I understand this might be impossible since the received
UUID will never match. I just wanted to send this out just in case I'm
missing anything, and perhaps express my frustration that maybe this
should work (what would it take to fix it?).

Here's a boiled down example of what i'm trying to do (assume ssdfs
and bigfs are my first and second systems respectively):

# create a subvolume (in ssdfs) and a few test files
    alex@alex-desktop:/mnt% sudo btrfs subvolume create ssdfs/myvolume-0
    Create subvolume 'ssdfs/myvolume-0'
    alex@alex-desktop:/mnt% sudo touch ssdfs/myvolume-0/file-0

# create a RO snapshot so we can send it somewhere else (bigfs)
    alex@alex-desktop:/mnt% sudo btrfs subvolume snapshot
ssdfs/myvolume-0 -r ssdfs/myvolume-1
    Create a readonly snapshot of 'ssdfs/myvolume-0' in 'ssdfs/myvolume-1'
    alex@alex-desktop:/mnt% sudo btrfs send ssdfs/myvolume-1|sudo
btrfs receive bigfs/
    At subvol ssdfs/myvolume-1

# make an rw snashot at the destination and start modifying it
    alex@alex-desktop:/mnt% sudo btrfs subvolume snapshot
bigfs/myvolume-1 bigfs/myvolume-2
    Create a snapshot of 'bigfs/myvolume-1' in 'bigfs/myvolume-2'
    alex@alex-desktop:/mnt% ls bigfs/myvolume-2/
    file-0
    alex@alex-desktop:/mnt% sudo touch bigfs/myvolume-2/file-1

# create an RO snapshot in preparation to send it back to ssdfs
    alex@alex-desktop:/mnt% sudo btrfs subvolume snapshot
bigfs/myvolume-2 -r bigfs/myvolume-3
    Create a readonly snapshot of 'bigfs/myvolume-2' in 'bigfs/myvolume-3'

# sending back incrementally (eg: without sending back file-0) fails
    alex@alex-desktop:/mnt% sudo btrfs send bigfs/myvolume-1 -p
bigfs/myvolume-3|sudo btrfs receive ssdfs/
    At subvol bigfs/myvolume-1
    At snapshot myvolume-1
    ERROR: cannot find parent subvolume
#### Cry

# some debug info
    alex@alex-desktop:/mnt% ls *fs/myvolume*
    ssdfs/myvolume-0:
    file-0

    ssdfs/myvolume-1: # ro
    file-0

    bigfs/myvolume-1: # ro
    file-0

    bigfs/myvolume-2:
    file-0  file-1

    bigfs/myvolume-3: # ro
    file-0  file-1

    alex@alex-desktop:/mnt% sudo btrfs subvolume show ssdfs/myvolume-1
    myvolume-1
        Name:                   myvolume-1
        UUID:                   1fcff3a8-c53f-1543-9b61-8108e486eecc
        Parent UUID:            1b0a6fac-4139-1840-b654-f21833b6cd12
        Received UUID:          -
        Creation time:          2021-04-16 19:32:46 -0700
        Subvolume ID:           1650
        Generation:             2198818
        Gen at creation:        2198818
        Parent ID:              5
        Top level ID:           5
        Flags:                  readonly
        Snapshot(s):

    alex@alex-desktop:/mnt% sudo btrfs subvolume show bigfs/myvolume-1
    myvolume-1
        Name:                   myvolume-1
        UUID:                   25301f81-10d5-e34e-8283-51656137ffc8
        Parent UUID:            -
        Received UUID:          1fcff3a8-c53f-1543-9b61-8108e486eecc
        Creation time:          2021-04-16 19:33:22 -0700
        Subvolume ID:           6344
        Generation:             63939
        Gen at creation:        63935
        Parent ID:              5
        Top level ID:           5
        Flags:                  readonly
        Snapshot(s):
                                myvolume-2

    alex@alex-desktop:/mnt% sudo btrfs subvolume show bigfs/myvolume-2
    myvolume-2
        Name:                   myvolume-2
        UUID:                   a437c7cf-5f14-9d4d-adb6-3c35ed9d0546
        Parent UUID:            25301f81-10d5-e34e-8283-51656137ffc8
        Received UUID:          -
        Creation time:          2021-04-16 19:34:13 -0700
        Subvolume ID:           6345
        Generation:             63945
        Gen at creation:        63939
        Parent ID:              5
        Top level ID:           5
        Flags:                  -
        Snapshot(s):
                                myvolume-3

Alexandru Stan

Reply via email to