dns cifs share entry in fstab not re-mounted on IP change, while used by smbd

ph flag

I set up a CIFS share on my ubuntu

Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04

using an fstab entry:

// /mnt/mystr       cifs    iocharset=utf8,rw,_netdev,credentials=/etc/smb/mystr-credentials,uid=someuser,gid=0,file_mode=0660,dir_mode=0770 0       0

which works as expected.

now i do have smbd running to provide this share to users on my LAN with this section in /etc/samba/smb.conf

path = /mnt/mystr
public = yes
writeable = yes
browsable = yes
guest ok = yes
force user = someuser

which also works fine.

However there seems to be an issue if the IP address of the entry changes. The share says "Host is down." and mount shows me the outdated IP address.

As this does not happen very often it is not easy to reproduce. This morning I wanted to fix it manually and tried to unmount it first which gave me Resource is busy as I think the smbd process is blocking the share.

Stopping the smbd process, unmounting the share, using mount -a and restarting smbd solved the issue.

So my questions are: Can this be done automatically? Can I tell fstab to force re-mounting the share if it is down? Is this even related to smbd having a handle on the directory? I checked lsof, but could not find anything related. Can I tell samba to "let go" of unreachable directories?

Thanks in advance for any ideas/Suggestions.

in flag
configure your server with a fixed IP.
Flo avatar
ph flag
@GeraldSchneider although ´´ might indicate it is my server - i can not control the ip address of this domain.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.