通过 nfs 的 rsnapshot:无法保留所有权|无法访问错误

通过 nfs 的 rsnapshot:无法保留所有权|无法访问错误

尝试将 rsnapshot 发送到 nfs 共享时,我收到一些所有权和访问错误,即使我可以在服务器/客户端上对具有 UID 1000 和 GID 1000 的共享执行任何操作。

服务器导出

/etc/exports

# Data (insecure for MACOS clients)
/mnt/data       172.16.10.0/24(rw,sync,no_subtree_check,insecure)

客户端挂载目录

/etc/systemd/system/mnt-data.mount

[Unit]
Description=ServerData
After=network.target

[Mount]
What=172.16.10.171:/mnt/data
Where=/mnt/data
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

cron 中出现错误

require Lchown
Lchown module loaded successfully
Setting locale to POSIX "C"
echo 24722 > /var/run/rsnapshot.pid
mv /mnt/backups/vmDebDevSrv1/alpha.1/ /mnt/backups/vmDebDevSrv1/alpha.2/
/bin/cp -al /mnt/backups/vmDebDevSrv1/alpha.0 \
    /mnt/backups/vmDebDevSrv1/alpha.1
/bin/cp: cannot access '/mnt/backups/vmDebDevSrv1/alpha.0/localhost/usr': Permission denied
/bin/cp: failed to preserve ownership for '/mnt/backups/vmDebDevSrv1/alpha.1/localhost/usr': Operation not permitted
/bin/cp: cannot access '/mnt/backups/vmDebDevSrv1/alpha.0/localhost/var': Permission denied
/bin/cp: failed to preserve ownership for '/mnt/backups/vmDebDevSrv1/alpha.1/localhost/var': Operation not permitted
/bin/cp: failed to preserve ownership for '/mnt/backups/vmDebDevSrv1/alpha.1/localhost': Operation not permitted
/bin/cp: failed to preserve ownership for '/mnt/backups/vmDebDevSrv1/alpha.1': Operation not permitted
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot alpha
----------------------------------------------------------------------------
ERROR: /bin/cp -al /mnt/backups/vmDebDevSrv1/alpha.0 /mnt/backups/vmDebDevSrv1/alpha.1 failed (result 256, exit status 1).
ERROR: Error! cp_al("/mnt/backups/vmDebDevSrv1/alpha.0/", "/mnt/backups/vmDebDevSrv1/alpha.1/")
/usr/bin/logger -p user.err -t rsnapshot[24722] /usr/bin/rsnapshot alpha: \
    ERROR: Error! cp_al("/mnt/backups/vmDebDevSrv1/alpha.0/", \
    "/mnt/backups/vmDebDevSrv1/alpha.1/")
rm -f /var/run/rsnapshot.pid 

答案1

仍然不确定,但添加vers=3挂载选项解决了我的问题,正如许多部分提到的,nfs 服务器的版本 4 确实通过 ACL 管理权限....

所以我的/etc/systemd/system/mnt-data.mount应该看起来像

[Unit]
Description=ServerData
After=network.target

[Mount]
What=172.16.10.171:/mnt/data
Where=/mnt/data
Type=nfs
Options=_netdev,auto,vers=3

[Install]
WantedBy=multi-user.target

相关内容