0

On my Arch Linux machine, I want to verify btrfs backups of snapshots using rsync.

The following rsync command is used to check for changes:

sudo rsync -n --itemize-changes --checksum -a --delete --numeric-ids --hard-links --acls --xattrs --devices --specials -v /.snapshots/@.20200829T194759+0200/ /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200

As an output, I get:

sending incremental file list
.d..t...... ./
cd+++++++++ srv/
.f........x usr/bin/newusers
.f........x usr/bin/rarpd
.f........x usr/bin/rlogind
.f........x usr/bin/rshd
cd+++++++++ var/abs/
cd+++++++++ var/cache/pacman/pkg/
cd+++++++++ var/lib/machines/
cd+++++++++ var/lib/portables/
.f........x var/lib/samba/private/secrets.tdb
cd+++++++++ var/tmp/

sent 2,899,263 bytes  received 5,441 bytes  25,592.11 bytes/sec
total size is 3,037,447,803  speedup is 1,045.70 (DRY RUN)
sudo rsync -n --itemize-changes --checksum -a --delete --numeric-ids  --acls   3.13s user 16.02s system 16% cpu 1:58.31 total

I am interested in the changes in the extended attributes that are reported (the). So I read the extended attributes for source and destination using getfattr, and see there are no extended attributes set for neither source nor destination: Edit: Thanks to the comment below, I am now reading all extended attributes.

# Read all extended attributes on source snapshot
~ % sudo getfattr --absolute-names -m "-" -d /.snapshots/@.20200829T194759+0200/usr/bin/rarpd
~ % sudo getfattr --absolute-names -m "-" -d /.snapshots/@.20200829T194759+0200/usr/bin/rlogind
~ % sudo getfattr --absolute-names -m "-" -d /.snapshots/@.20200829T194759+0200/usr/bin/rshd
~ % sudo getfattr --absolute-names -m "-" -d /.snapshots/@.20200829T194759+0200/var/lib/samba/private/secrets.tdb


# Read all extended attributes on target
~ % sudo getfattr --absolute-names -m "-" -d /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/newusers
    # file: /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/newusers
    security.capability=0sAQAAAoAAAAAAAAAAAAAAAAAAAAA=

~ % sudo getfattr --absolute-names -m "-" -d /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rarpd
    # file: /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rarpd
    security.capability=0sAQAAAgAgAAAAAAAAAAAAAAAAAAA=

~ % sudo getfattr --absolute-names -m "-" -d /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rlogind
    # file: /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rlogind
    security.capability=0sAQAAAgAEAAAAAAAAAAAAAAAAAAA=

~ % sudo getfattr --absolute-names -m "-" -d /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rshd
    # file: /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rshd
    security.capability=0sAQAAAgAEAAAAAAAAAAAAAAAAAAA=

~ % sudo getfattr --absolute-names -m "-" -d /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/var/lib/samba/private/secrets.tdb
    # file: /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/var/lib/samba/private/secrets.tdb
    security.capability=0sAQAAAgAgAAAAAAAAAAAAAAAAAAA=

# Use getcap to see which security.capability was changed:
~ % sudo getcap /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/newusers
    /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/newusers cap_setuid=ep
~ % sudo getcap /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rarpd
    /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rarpd cap_net_raw=ep
~ % sudo getcap /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rlogind
    /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rlogind cap_net_bind_service=ep
~ % sudo getcap /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rshd
    /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/usr/bin/rshd cap_net_bind_service=ep
~ % sudo getcap /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/var/lib/samba/private/secrets.tdb
    /mnt/pool_Tank/backups/gandalf_local/pool_System/@.20200829T194759+0200/var/lib/samba/private/secrets.tdb cap_net_raw=ep

Is there an explanation why a btrfs send | btrfs received adds extended attributes to some files? Is this maybe related to this bug report, although this one mentions that the xattrs are lost? https://bugzilla.kernel.org/show_bug.cgi?id=68891

I have created a new issue for btrfs-progs for this behaviour: https://github.com/kdave/btrfs-progs/issues/292

2
  • Try getfattr -m - .... You command is listing just the attributes in the user namespace. The man page tells you more about it. Commented Aug 30, 2020 at 15:28
  • Thank you @EduardoTrápani! I missed that part of the man page... I updated my question above.
    – Nox997
    Commented Sep 1, 2020 at 5:10

1 Answer 1

0

Two things:

  1. as pointed out by @Eduardo Trápani, my usage of getfattr was wrong. I did not specify which extended attributes to view properly.

  2. The problem with btrfs send |btrfs receive resulting in erroneous xattrs on the destination is a confirmed bug, see https://github.com/kdave/btrfs-progs/issues/292

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .