Configuring fstab based Samba share mounts

This tutorial is to help those who are using Samba (also known as CIFS, SMB or Windows Networking). It assumes that you already are sharing media files on a Windows Server or Desktop.

Why use /etc/fstab instead of Kodi’s built in SMB client? The Kodi client in current versions (17.x and older) is slow. Using /etc/fstab is faster, and not really that hard to setup.

EDIT: 11/1/2019
While improvements were made in Kodi 18.x, using fstab will still be faster.

You will need to know the following information

  1. The IP address of the system where your media files are shared from.
    • For this tutorial, we will be using the IP of
  2. Username and password used to access those shares.
    • We will be using my_username and my_password
    • NEW 04/29/2020: Create a credentials file
  3. The name of the share you will mount
    • We will be using Movies
  4. What you would like the share to be named on OSMC?
    • We will be using Server_Movies
    • This can be the same name as the share, so Movies is OK also. Use any name here you’d like.
  5. Does the share name contains spaces?
    • Replace spaces with \040. So My Movies would be My\040Movies.

Once you know that information, log into your OSMC system:

New 04/2020
Previously we had you putting your username/pw in the fstab. For better security, we recommend instead that you use a credentials file. Creating the file is simple:

$ sudo nano ~/.credentials

and add these two lines:


If you have more than one server and want to use credentials files, you can name them anyway you like. Personally if I had 2 servers I’d use the names: .credentials-server1 and .credentials-server2

Edit your /etc/fstab file:

$ sudo nano /etc/fstab

Go to the end of the file (use the down arrow key) and add this line:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,credentials=/home/osmc/.credentials,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770 0 0

Sometimes (depending on your server) you need to include a SMB version to the fstab entry:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,credentials=/home/osmc/.credentials,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=3.0 0 0

or if you prefer to not use a credentials file:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,username=my_username,password=my_password,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770 0 0

An example with spaces:

//\040Shows /mnt/TV\040Shows cifs x-systemd.automount,noauto,rw,iocharset=utf8,username=user\040with\040space,password=password\040with\040space,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770 0 0

If you have more than one share (like Music) to add, I’d recommend adding them after you get your first share working. Add them one at a time.

If your shares are setup as guest shares that do not require user/password you can use the guest option like this:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,guest,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770 0 0

New Information added 03/05/2018

With the latest version of OSMC, you may get an error if using guest access. Some changes were made to make SMB more secure. If you see an error like:

No such device

when trying to mount, add vers=1.0 to your fstab:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,rw,iocharset=utf8,guest,uid=osmc,gid=osmc,file_mode=0770,dir_mode=0770,vers=1.0 0 0

New information added 7/23/2018

If your server is Windows 10, you probably will have to supply a SMB version, supported versions are 2.0, 2.1, 3.0 or 3.02, so in the above fstab line, replace the vers=1.0 with vers=3.0 (pick the version you want) If the version you chose does not work, try a different version.

Once done editing /etc/fstab, save the file and exit nano with CTRL-x YES

Now verify that there are no errors in your fstab file:

$ sudo mount -a

You should just get a new prompt back. If you get any errors looks again at your /etc/fstab for the errors.

Once you get a prompt with no errors, you will need to reload systemd:

$ sudo systemctl daemon-reload
$ sudo systemctl restart

At this point, your shares should just work. To test, simply try to go to the share:

$ cd /mnt/Server_Movies
$ ls

Or if you used the TV Shows example (TV\040Shows):

$ cd /mnt/TV\ Shows

Notice the difference! In the fstab file, you use \040 for a space. On the command line, you just use a \ followed by a space.

and if all is well, you will see your files!

Now that you can see your files on the command line, it’s time to access them in Kodi. Add the source like normal, but when you select Browse do not select Add network location. Instead select Root filesystem and scroll down to /mnt. You should see the new shares and add it as a source.

If you do not see your files, try this:

$ sudo mount /mnt/Server_Movies

If you see errors, post your logs to the forum:

grab-logs -f -J


Easy way to make sure that you can actually talk to the Windows server is to install smbclient:

$ sudo apt-get install smbclient
$ smbclient -L -U my_username

You should see the shares available on your server. It’s been reported that using the IP address in the smbclient command may not always work. If you get odd results, try the name of the server instead of the IP.

OSMC does not find Network via SMB
[How to] Use systemd to mount remote shares
Vero4k doesn't see SMB shares on wired gigabit network
Help with Windows network access Shared drives
Can anybody recommend a decent gigabit usb adaptor?
4k files stutter when played from NAS
Problems with streaming and sound dropouts
How to SFTP Access
Configuring fstab based NFS share mounts
Caching, freezes and sound stuttering on movies over Smb & NFS
Path not found or invalid on vero4k
Live TV save location and mounting networked hard drive
Help with mounting NAS
Windows 10 smb share on new vero 4K
Buffering video playing throw LAN
Movies that used to play fine now buffering constantly
4k buffering/stuttering
NFS FSTAB mount not working on boot anymore
4k buffering/stuttering
Raspberry pi not able to add network shared drive
New Vero 4k newbie
Network issues since Dec update
Frequent Buffering with 4K content
"File Exists" error
Can't set Media View to Wide
SMB on mnt folder not accessible
"Playback failed" error
Best practice for OSMC on a RPi3 with a NAS storing all the media?
Smb fstabs under OpenVPN
Adding SMB source at Kodi
Uhd large video files shuttering
New vero 4k cant see win10 network shares
Newbie setup issues
Newbie setup issues
My reflections about the differences between Vero 4K and NUC Braswell running LibreELEC
Segmentation fault playing audio files over SMB
Mounting SMB shares from Macintosh on OSMC
OSMC backup - cant change path
OSMC freezes if server is rebooted
Why will my NAS not mount at boot
MacOS Ventura NFS -> SMB
Frustrations with vero 4k
OSMC + fstab not working
Mounting SMB via fstab - Help
Mounting SMB via fstab - Help
Buffering during playing movies from SMB
Setting up media sharing between Vero 4K and RPi3?
Help request: Correctly setting up SMB server for Windows 10
Help request: Correctly setting up SMB server for Windows 10
OSMC Freezing when accessing SMB share on Win 10
Vero4k+ announcement
Vero 4K unable to mount via fstab - it was working before
Video stops after several minutes
Vero 4K+ not turning on
Windows 10 shares smb or fstab
Vero 4K+ freezes randomly
Vero 4K+ not turning on
NFS FSTAB mount not working on boot anymore
File sharing with a NAS, media server, windows share or other device
Making SMB share permament on Vero
Unable to mount shared folder
Crash when analysing WMA file
Vero 4k - keeps buffering, videos unwatchable :(
4k hevc stutter through smb
Please help me to adjust settings for SMB connection OSMC to Windows
Fstab troubles after reset of Vero 4K. "No such device"
No automount after editing the fstab
Slow ethernet iperf3 speeds until reboot
Kodi crashes when selecting Music view
Vero4k+ stop playing movies after a few seconds
Freezing on high bandwidth 4k content
Leia Won't Play Videos From SMBv1 NAS
Completely new to linux
Completely new to linux
Issues with mount and SMBv3 (connect to remote NAS)
Network drives
How Do I upgrade my media drive
(SOLVED) How to find root cause for buffering with 4K content?
Can't delete some files over SMB
4k uhd stutter or freezing up, audio dropouts
FSTAB Issue connecting to network drive
Vero 4K+ with Synology NAS - How to connect?
OSMC crashes if stop button pressed at end of playback
Recent Problems with Samba and Movies
Samba Share Access from Mac Mini Server
Vero 4k+ & SMB on win7: Errdos ERRnomem error
Mediacenter auto restart loop after 2021-08 upgrade and library scan
Path Subsititution for Playlists works with the exception of 1 addon
Mounting CIFS/SMB share from NAS
"Random" playback stops with new Wifi adapter
"Random" playback stops with new Wifi adapter
Lock Preferences for SMB
Music Player / Wifi / BlueTooth Questions
SMB share issues between OSMC and W10
OSMC Problems playing Movies from NAS
New Vero 4K / slow network performance
SMB file share help
SMB issues with new router
New Vero 4K wont see my Windows 10 network shares

Thank you for updating these instructions. Adding the version worked for me.

Hi, I have followed the instructions in the tutorial, but get an error when trying to mount the share saying “mount: wrong fs type, bad option, bad superblock…”. See attached image for details.

When i run smbclient, i can see the 3 windows 10 share folders i am wanting to see in Kodi.

Any help would be appreciated, ive spent so much time trying to share these files its driving me mad!

This forum does not provide support for ZBOX. You should seek support from the developer of your operating system.

I just got my Vero 4K and I’m trying to do this but I can’t get past even the first step because it says “rootfs is not mounted in fstab as we do it via initramfs. Uncomment for remount (slower boot)”. Am I supposed to remount it, do all those other steps, then unmount it again? Sorry I’m a n00b to Linux. :expressionless:

Or is it supposed to say that? I thought it was an error but it does say I’m in the fstab file.

Just leave that line. It doesn’t need to be touched.

It’s not an error.

Even after adding the “ver1.0” i still get the “no such device” back after trying to cd into it. If standing in /mnt/ an ls does show the folder, but I cant get into it. I can also add the folder in Kodi from browsing “Root filesystem” but it shows up empty with no files.

Im missing something here but what. The folder is already mounted and added with smb, do I need to first delete that? I did rename the new mount-name as to not confuse them, but can they co-exist?

A post was split to a new topic: FSTAB mounting problems

Hello, thank you for this excellent guide! It helped me a lot and is working 100%.

As a slight refinement I would be keene to figure out a “read only” version of this; generally I only want the Vero connecting in a read only mode to my shares. This is already taken care of via the Samba credentials but I’d be curious too what the changes would be to your template fstab entry. I guess this would suffice:

// /mnt/Server_Movies cifs x-systemd.automount,noauto,ro,iocharset=utf8,username=my_ro_username,password=my_ro_password,uid=osmc,gid=osmc 0 0

(my_ro_username is my read only account on the server)


The user credentials don’t really matter if you change the rw to ro. So with ro, even a user with write permission would not be able to write, as the mount would be read only.


I’m also getting “no such device” error with the following from dmesg, any advice?

Can you show us your fstab?

Please start a new topic in Help and Support, and post your fstab as text instead of an image.

A post was split to a new topic: Fstab credentials with Windows Live ID

I was troubleshooting another issue and this thread was linked. I like the idea of speeding up my samba shares but I’m wondering how it will affect my existing library?

I’ve been using a version of the same MySQL database on my Win7 PC with multiple RasPi3 clients connecting to it since XBMC11 on an atv1. If I remove my SMB shares from sources.xml and use this fstab method instead, is their any chance all my media will be reimported and duplicated and mess up my watch history etc?

Please forgive my ignorance.

You can use path substitution to handle the differences in paths.

1 Like

You really need to look into and it’s Kodi integration if watch history is important to you. Depending on the Kodi db alone is simply asking for disappointment.

@ActionA well it’s Kodi’s MySQL database stored on my media server which is backed up periodically. It’s been working well since early Crystalbuntu days. But I take your point, I’ll have a look at trakt.

@bmillham thanks, I will look into that.