我的 Linux 机器上安装了一系列 Windows 共享磁盘。我在以下内容中有如下几行/etc/fstab
:
//10.5.0.136/i /media/i cifs credentials=/home/trosendal/.smbcredentials,vers=2.0,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0
挂载每个磁盘。多年来它一直运行良好,但现在我遇到了一个奇怪的问题,我得到的文件列表不完整,类似于此处描述的:访问共享时目录列表不完整。以下是该问题的一个示例:
trosendal@trosendal-ThinkPad-T480:/media/i$ ls
BKT DOA GDK KMF KOM KVT MIK POV VES VIP VOL
trosendal@trosendal-ThinkPad-T480:/media/i$ cd ESS
trosendal@trosendal-ThinkPad-T480:/media/i/ESS$ ls
'Arkiv X' hso
brevlåda 'Model Comparison.ppt'
...
请注意,目录ESS
丢失了,但我可以导航到它。在 emacs (dired) 或 gnome 文件资源管理器中也发生同样的情况。某些目录丢失,而其他目录则没有丢失。有什么想法吗?
答案1
cifs
问题显然与我在 中选择的协议版本有关fstab
。根据手册摘录
$ man mount.cifs
vers=arg
SMB protocol version. Allowed values are:
· 1.0 - The classic CIFS/SMBv1 protocol.
· 2.0 - The SMBv2.002 protocol. This was initially introduced in Windows Vista Service Pack 1, and Windows Server 2008. Note that the initial release version of Windows Vista spoke a slightly different dialect (2.000) that is not supported.
· 2.1 - The SMBv2.1 protocol that was introduced in Microsoft Windows 7 and Windows Server 2008R2.
· 3.0 - The SMBv3.0 protocol that was introduced in Microsoft Windows 8 and Windows Server 2012.
· 3.1.1 or 3.11 - The SMBv3.1.1 protocol that was introduced in Microsoft Windows Server 2016.
Note too that while this option governs the protocol version used, not all features of each version are available.
The default since v4.13.5 is for the client and server to negotiate the highest possible version greater than or equal to 2.1. In kernels prior to v4.13, the default was 1.0. For kernels between v4.13 and v4.13.5 the default is 3.0.
我不确定此磁盘的管理员使用的是哪个服务器版本,所以我一定是在某个时候猜错了,而没有注意到后果。以下是我选择上述问题中写到的行时vers=2.0
的不同之处的说明:fstab
trosendal@trosendal-ThinkPad-T480:~$ cd /media/i/
trosendal@trosendal-ThinkPad-T480:/media/i$ ls
BKT DOA GDK KMF KOM KVT MIK POV VES VIP VOL
然后如果我改变vers=1.0
我就会得到期望的:
trosendal@trosendal-ThinkPad-T480:/$ ls /media/i/
trosendal@trosendal-ThinkPad-T480:/$ ls /media/i/
BKT DOA ESS GDK KMF KOM KVT MIK POV VES VIP VOL
我必须承认,这个解决方案感觉有点不靠谱,因为除了反复试验,我不知道如何确定哪个是正确的。任何关于如何解决这种情况的见解都是受欢迎的。