升级后,CIFS 斜杠更改为反斜杠

升级后,CIFS 斜杠更改为反斜杠

我正在使用 Linux 服务器,该服务器通过 rsync 将其备份到外部 NAS(D-Link DNS-320)上挂载 cifs 的共享。在 openSUSE 11.4 上一切正常。升级到 openSUSE 12.2 后,备份脚本仍然有效,但共享上的文件显示异常。共享挂载在 /backup 上,备份位于目录 /backup/daily 的子文件夹中。因此,我希望 ls /backup只显示daily文件夹。但是,它需要很长时间,最后会列出如下文件:

www:~ # ls /backup
daily
\daily
\daily\2012_week44
[...]
\daily\2012_week45\home\user\Maildir\cur\1351686611.2233_0.www:2,
\daily\2012_week45\home\user\Maildir\cur\1351696819.5035_0.www:2,
\daily\2012_week45\home\user\Maildir\cur\1351698486.5356_0.www:2,S

第44周是升级的时间。

如果我这样做ls /backup/daily,乍一看一切都很正常:

www:~ # ls /backup/daily
2011_week28  2012_week30  2012_week34  2012_week38  2012_week42  2012_week49
2012_week27  2012_week31  2012_week35  2012_week39  2012_week43  2012_week50
2012_week28  2012_week32  2012_week36  2012_week40  2012_week44  
2012_week29  2012_week33  2012_week37  2012_week41  2012_week48

实际上,我刚刚才注意到第 45 周至第 47 周目录丢失了。

/etc/fstab共享的条目如下所示:

//192.168.10.55/linux_backup  /backup     cifs       noauto,user=linux_backup,uid=backup,gid=users 0 0 

但在备份脚本中,它的挂载方式如下:

mount -t cifs  //192.168.10.55/linux_backup /backup -o username=linux_backup,password=password,uid=backup,gid=users

mount显示其属性如下:

//192.168.10.55/linux_backup on /backup 类型 cifs (rw,relatime,sec=ntlm,unc=\192.168.10.55\linux_backup,username=linux_backup,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.10.55,unix,posixpaths,serverino,acl,rsize=1048576,wsize=65536,actimeo=1)

为了完整起见,这里还有备份脚本:

#!/bin/bash

backup_dir="/backup/daily/"
date=`date +%Y_week%V`
backup_path=${backup_dir}/$date/
rsync="/usr/bin/rsync -auv --no-o --no-g --delete"

#mount and create dir
echo "Backup started `date`"
mount -t cifs  //192.168.10.55/linux_backup /backup -o username=linux_backup,password=password,uid=backup,gid=users
mkdir -p $backup_path
chmod 700 $backup_path

#home dirs
home_src=/home/
home_dst=${backup_path}/home/
${rsync} $home_src $home_dst

#cleanup
umount /backup
echo "Backup ended `date`"
exit 0

写完这一切之后,我觉得第 44 周和第 48 周之间一定发生了一些奇怪的事情,而现在却神秘地自行解决了?

相关内容