• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CIFS Share Filesystem Is Not Mounted after Reboot on CentOS/RHEL 7

by admin

The Problem

CIFS shared file system is not mounted even after system reboot in CentOS/RHEL 7. If manually execute the “mount -a” command after the system is rebooted, the CIFS file system is normally mounted

fstab entry:

# cat /etc/fstab
//192.168.0.10/Oracle /backup/oracle cifs _netdev,noexec,nosuid,vers=3.0,uid=1001,gid=1002,credentials=/root/backup_creds 0 0

demsg:

[ 27.052981] Key type cifs.idmap registered
[ 33.053711] CIFS VFS: Error connecting to socket. Aborting operation.
[ 33.054048] CIFS VFS: cifs_mount failed w/return code = -113

/var/log/messages:

Nov 21 15:09:29 ***** kernel: CIFS VFS: Error connecting to socket. Aborting operation.
Nov 21 15:09:29 ***** kernel: CIFS VFS: cifs_mount failed w/return code = -113
Nov 21 15:09:29 ***** mount: Unable to find suitable address.
Nov 21 15:09:29 ***** systemd: backup-oracle.mount mount process exited, code=exited status=32
Nov 21 15:09:29 ***** systemd: Failed to mount /backup/oracle.
Nov 21 15:09:29 ***** systemd: Dependency failed for Remote File Systems.
Nov 21 15:09:29 ***** systemd: Job remote-fs.target/start failed with result 'dependency'.
Nov 21 15:09:29 ***** systemd: Unit backup-oracle.mount entered failed state.

The Solution

Mount units referring to local and network file systems are distinguished by their file system type specification. In some cases, this is not sufficient (for example network block device based mounts, such as iSCSI), in which case _netdev may be added to the mount option string of the unit, which forces systemd to consider the mount unit a network mount.

Additionally, systemd supports explicit order dependencies between mount entries and other units. There are 2 ways this issue can be resolved:

1. adding in x-systemd.after=network-online.target in /etc/fstab to the mount options:

//192.168.0.10/Oracle /backup/oracle cifs _netdev,x-systemd.after=network-online.target,noexec,nosuid,vers=3.0,uid=1001,gid=1002,credentials=/root/backup_creds 0 0

2. create custom systemd unit file in /etc/systemd/system with file format samba.service[Unit]:

# vi /etc/systemd/system
Description=CIFS Mount
Requires=network-online.target
After=network-online.service
Before=samba.service
[Mount]
What=//xxx.xxx.xxx.xxx/path/[mountpoint]
Where=/mnt/path
Options=username=yourusername,pass=yourpassword
Type=cifs

[Install]
WantedBy=multi-user.target

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. asciidoctor: A processor that converts AsciiDoc files to a publishable format
  2. basename Command Examples (Remove leading directory portions from a path)
  3. Archiving Failures with ORA-16038, ORA-19504, ORA-00312
  4. CentOS / RHEL : Beginners guide to vsftpd (installation and configuration)
  5. tlp-stat: command not found
  6. “aws secretsmanager” Command Examples
  7. bosh Command Examples (Command-line tool to deploy and manage the bosh director)
  8. Volume “test_vg/lvol0” is not active locally – Error while running lvcreate
  9. How to Permanently set the ethtool settings in CentOS/RHEL 6
  10. pacman4console: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Chezmoi: A multi-machine dotfile manager, written in Go
  • cheat: Create and view interactive cheat sheets on the command-line
  • chars: Display names and codes for various ASCII and Unicode characters and code points
  • chafa: Image printing in the terminal

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright