rsync --itemize-changes 列出了一些 xattr 差异,但 getfattr 显示没有差异

rsync --itemize-changes 列出了一些 xattr 差异,但 getfattr 显示没有差异

在我的 Arch Linux 机器上,我想使用 rsync 验证快照的 btrfs 备份。

以下 rsync 命令用于检查更改:

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

作为输出,我得到:

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

我对报告的扩展属性的变化感兴趣。因此,我使用 getfattr 读取源和目标的扩展属性,并发现源和目标都没有设置扩展属性: 编辑:感谢下面的评论,我现在正在阅读所有扩展属性。

# 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

有没有解释为什么 btrfs 发送 |收到的 btrfs 会向某些文件添加扩展属性吗?这是否可能与此错误报告有关,尽管此报告提到 xattrs 丢失了?https://bugzilla.kernel.org/show_bug.cgi?id=68891

我为此行为为 btrfs-progs 创建了一个新问题: https://github.com/kdave/btrfs-progs/issues/292

答案1

两件事情:

  1. 正如@Eduardo Trápani 所指出的,我对 getfattr 的使用是错误的。我没有指定要正确查看哪些扩展属性。

  2. btrfs send |btrfs receive 导致目标上的 xattrs 错误的问题是一个已确认的错误,请参阅https://github.com/kdave/btrfs-progs/issues/292

相关内容