TransWikia.com

Cifs mounting subdirectories from linux

Unix & Linux Asked by S.Olesen on December 24, 2021

I am trying to mount two subdirectories from the same share name but cannot get it to work.

# Mount the two different subfolders:
# $server and $share are the same - the subfolder differs:
$ subfolderA=a/b/c
$ subfolderB=x/y/z
$ mount -t cifs //$server/$share/$subfolderA /mnt/dirA
$ mount -t cifs //$server/$share/$subfolderB /mnt/dirB

# Traverse the directories - I see the same file in both directories (should only be be in dirA)
$ find /mnt/dir[AB] -name fda.txt -ls
707409139 1024 -rwxr-xr-x   1 root     root           15 May 28 08:50 /mnt/dirA/fda.txt
707409139 1024 -rwxr-xr-x   1 root     root           15 May 28 08:50 /mnt/dirB/fda.txt

# Mount in opposite order:
$ umount /mnt/dirA
$ umount /mnt/dirB
$ mount -t cifs //$server/$share/$subfolderB /mnt/dirB
$ mount -t cifs //$server/$share/$subfolderA /mnt/dirA

# Traverse the directories - I do not see the file fda.txt at all
$ find /mnt/dir[AB] -name fda.txt -ls
<nothing>

I have verified my access to the different subfolders using smbclient and it gives me the expected results.

The reason for having two separate mounts instead of just one, is because I do not have access to the share itself, but only to the subfolders.

One Answer

To understand the problem deeply, try to mount with --verbose option, i.e.

mount -t cifs //$server/$share/$subfolderB /mnt/dirB --verbose

The possible reasons of the problem can be wrong inode numbers or caching. As workaround for the inode numbers problem try this options (one of them):

--serverino
--noserverino

Also try different caching methods (one of them):

--cache=none
--cache=strict
--cache=loose

Read mount.cifs(8) additionally.

Answered by Bob on December 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP