场景
我正在通过 rsnapshot 备份我的一台 Debian wheezy 机器。目标目录是已安装的 NFS 共享。Qnap NAS 提供此目标目录。
问题
但是当 rsnapshot 尝试通过 cp -al 创建新快照时,它会抱怨某些文件已经存在。无论我使用 gnu-cp 还是 rsnapshot 的 cp,都没有关系:
root@shuttle:~# rsnapshot -v daily
echo 25852 > /var/run/rsnapshot.pid
/bin/rm -rf /mnt/backup/rsnapshot/daily.6/
mv /mnt/backup/rsnapshot/daily.5/ /mnt/backup/rsnapshot/daily.6/
mv /mnt/backup/rsnapshot/daily.4/ /mnt/backup/rsnapshot/daily.5/
mv /mnt/backup/rsnapshot/daily.3/ /mnt/backup/rsnapshot/daily.4/
mv /mnt/backup/rsnapshot/daily.2/ /mnt/backup/rsnapshot/daily.3/
mv /mnt/backup/rsnapshot/daily.1/ /mnt/backup/rsnapshot/daily.2/
native_cp_al("/mnt/backup/rsnapshot/daily.0", \
"/mnt/backup/rsnapshot/daily.1")
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot -v daily
----------------------------------------------------------------------------
ERROR: Warning! "/mnt/backup/rsnapshot/daily.1/shuttle/etc/alternatives/Mail.1.gz" exists!
ERROR: Warning! copy_symlink("/mnt/backup/rsnapshot/daily.0/shuttle/etc/alternatives/Mail.1.gz", "/mnt/backup/rsnapshot/daily.1/shuttle/etc/alternatives/Mail.1.gz")
[-- snip! --]
转折
有趣的是:让 rsnapshot(或 cp -al)很为难的文件实际上存在两次!查看行首的 inode。这是ls -li
我的 Debian Box 上的输出:
lennart@shuttle:~$ ls -li /mnt/backup/rsnapshot/daily.0/shuttle/etc/alternatives/ |grep -i mail
71047301 lrwxrwxrwx 1 root root 23 Oct 28 09:32 mail -> /usr/bin/heirloom-mailx
71047299 lrwxrwxrwx 1 root root 23 Oct 28 09:32 Mail -> /usr/bin/heirloom-mailx
71047302 lrwxrwxrwx 1 root root 39 Oct 28 09:32 mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
71047300 lrwxrwxrwx 1 root root 39 Oct 28 09:32 Mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
71047300 lrwxrwxrwx 1 root root 39 Oct 28 09:32 Mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
71047303 lrwxrwxrwx 1 root root 23 Oct 28 09:32 mailx -> /usr/bin/heirloom-mailx
71047304 lrwxrwxrwx 1 root root 39 Oct 28 09:32 mailx.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
以下是ls -l1
在导出目录的服务器上执行的相同操作:
[~] # ls -li /share/backup/rsnapshot/daily.0/shuttle/etc/alternatives/ |grep ->
71047299 lrwxrwxrwx 1 admin administ 23 Oct 28 09:32 Mail -> /usr/bin/heirloom-mailx
71047300 lrwxrwxrwx 1 admin administ 39 Oct 28 09:32 Mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz@
71047301 lrwxrwxrwx 1 admin administ 23 Oct 28 09:32 mail -> /usr/bin/heirloom-mailx
71047302 lrwxrwxrwx 1 admin administ 39 Oct 28 09:32 mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz@
71047303 lrwxrwxrwx 1 admin administ 23 Oct 28 09:32 mailx -> /usr/bin/heirloom-mailx
71047304 lrwxrwxrwx 1 admin administ 39 Oct 28 09:32 mailx.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz@
问题
有人知道是什么原因造成的以及如何解决吗?
[编辑1]
在运行 OS X 10.9 的机器上执行同样的 ls:
thebook-wlan:~ lennart$ ls -li /Volumes/backup/rsnapshot/daily.0/shuttle/etc/alternatives/ |grep -i mail
71047299 lrwxrwxrwx 1 root wheel 23 28 Okt 09:32 Mail -> /usr/bin/heirloom-mailx
71047300 lrwxrwxrwx 1 root wheel 39 28 Okt 09:32 Mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
71047301 lrwxrwxrwx 1 root wheel 23 28 Okt 09:32 mail -> /usr/bin/heirloom-mailx
71047302 lrwxrwxrwx 1 root wheel 39 28 Okt 09:32 mail.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
71047303 lrwxrwxrwx 1 root wheel 23 28 Okt 09:32 mailx -> /usr/bin/heirloom-mailx
71047304 lrwxrwxrwx 1 root wheel 39 28 Okt 09:32 mailx.1.gz -> /usr/share/man/man1/heirloom-mailx.1.gz
仅我的 Debian 机器似乎在目录列表方面存在问题。
答案1
我只在一个文件中遇到过同样的问题!我的问题是这个特定文件既有部分小写也有部分大写。我通过复制同名的大写文件解决了我的问题,只需在文件名中添加 2 即可:
xt_CONNMARK.ko(使用相同的 inode 列出两次)复制到 xt_CONNMARK2.ko
现在 xt_CONNMARK.ko 与新复制的文件一起列出一次,xt_CONNMARK2.ko 也列出了一次!
非常非常奇怪的行为但是解决了吗?