CIFS 自动挂载和手动挂载之间的 /etc/fstab 语法不兼容

CIFS 自动挂载和手动挂载之间的 /etc/fstab 语法不兼容

当我使用这个fstab语法时:

# grep raven /etc/fstab
\\raven.example.com\raven      /raven          cifs    vers=2.0,credentials=/root/creds_smb_raven,\
    uid=5000,gid=6000,file_mode=0664,dir_mode=0775       0       0

重新启动后,即使手动重试成功,自动挂载也会失败。我懂了:

# mount -t cifs
# grep -w mount.cifs /var/log/messages
Jan 27 11:59:16 myhost mount: mount.cifs: bad UNC (\raven.example.com\raven)
# mount /raven
# mount -t cifs
\\raven.example.com\raven on /raven type cifs (rw,relatime,vers=2.0,cache=strict,username=surfgeo,domain=raven,uid=5000,forceuid,gid=6000,forcegid,addr=10.27.4.22,file_mode=0664,dir_mode=0775,soft,nounix,serverino,mapposix,rsize=65536,wsize=65536,echo_interval=60,actimeo=1)

但是当我将反斜杠加倍时:

\\\\raven.example.com\\raven   /raven          cifs    vers=2.0,credentials=/root/creds_smb_raven,uid=5000,gid=6000,file_mode=0664,dir_mode=0775       0       0

并重新启动,自动安装成功,但手动安装现在已损坏。我得到:

# mount -t cifs
\\raven.example.com\raven on /raven type cifs (rw,relatime,vers=2.0,cache=strict,username=surfgeo,domain=raven,uid=5000,forceuid,gid=6000,forcegid,addr=10.27.4.22,file_mode=0664,dir_mode=0775,soft,nounix,serverino,mapposix,rsize=65536,wsize=65536,echo_interval=60,actimeo=1)
# umount /raven
# mount /raven
mount.cifs: bad UNC (\\\\raven.example.com\\raven)

是否有一种特定的fstab语法既适用于启动时自动挂载,又适用于启动后手动卸载/重新挂载?

答案1

正如评论中所述,使用正斜杠而不是反斜杠:

//raven.example.com/raven      /raven          cifs    vers=2.0,credentials=/root/creds_smb_raven,\
    uid=5000,gid=6000,file_mode=0664,dir_mode=0775       0       0

相关内容