Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update guide.en-ie: Linux CIFS Backup mount parameters #7291

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ This error should be resolvable by modifying the Windows Registry: Open the Wind

##### Linux

Establish an SSH connection to your server, and type the following command:
Establish an SSH connection to your server, install cifs-utils if applicable, and type the following command:

```sh
mount -t cifs -o sec=ntlm,uid=root,gid=100,dir_mode=0700,username=root,password= //HostName/ServiceName /mnt/FolderMount
mount -t cifs -o vers=2.0,uid=root,gid=100,dir_mode=0700,username=root,password= //HostName/ServiceName /mnt/FolderMount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend leaving out security options:

Suggested change
mount -t cifs -o vers=2.0,uid=root,gid=100,dir_mode=0700,username=root,password= //HostName/ServiceName /mnt/FolderMount
mount -t cifs -o uid=root,gid=100,dir_mode=0700,username=root,password= //HostName/ServiceName /mnt/FolderMount

The manpage for mount.cifs says that the default for vers is Tries to negotiate the highest SMB2+ version supported by both the client and server. so I wouldn't mess with it.
As mount.cifs is part of cifs-utils, maybe we should recommend installing it unconditionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi sbraz, and thanks for comments.

About that security options, you can surely understand that update to this document came from the realization that the mount didn't work without setting vers=2.0, as 2.1 is newer, as is 3.0. I'm not sure which kind of people set vers=2.0 if it's not required.

Screenshot 2024-12-14 at 17 08 21

About cifs-utils, is not my decision. Some people seem to try install as few packages as possible. But I see no harm unconditionally suggesting installing cifs-utils

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

came from the realization that the mount didn't work without setting vers=2.0

I actually wasn't sure why you added the version as you hadn't mentioned it anywhere in the commit message or the PR. So, even with cifs-utils installed, you had to specify a vers= parameter? What OS are you running?
I will perform tests on Monday.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct. vers=2.0 ( or lower ) is required for successful CIFS mount of FTP backup space.

This test was done on updated Ubuntu Noble 24.04

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll reply as soon as possible after performing the tests. I want to debug this a little to see if there is any way to avoid forcing a version while mounting.

Copy link
Member

@sbraz sbraz Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that on newer kernels, vers=2.0, because (as per the manpage):

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.

So, if vers is not forced, we get, in dmesg:

[Fri Jan 31 20:36:02 2025] CIFS: VFS: \\xxx.ovh.net Dialect not supported by server. Consider  specifying vers=1.0 or vers=2.0 on mount for accessing older servers
[Fri Jan 31 20:36:02 2025] CIFS: VFS: cifs_mount failed w/return code = -95

```

The code example above contains variables, which you will need to substitute with your own values.
Expand All @@ -353,6 +353,8 @@ The code example above contains variables, which you will need to substitute wit
* **ServiceName**: The name of your server (e.g. ns0000000.ip-123-123-123.net)
* **FolderMount**: The folder where you want to mount the share (it must already exist)

cifs-utils is needed for hostname resolution ([src](https://serverfault.com/questions/609365/cifs-mount-in-fstab-succeeds-on-ip-fails-on-hostname-written-in-etc-hosts)). Otherwise use IP address. SMB versions 2.1 and 3.0 are not supported as of December '24.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not link to a Stack Overflow question.

Also, the second sentence doesn't seem necessary since the highest possible version will be negotiated by mount.cifs. When the SMB servers get updated, a newer version will automatically be used, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I like SO questions more than kernel discussion pages or personal tests. Each this his/her own.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, if we link to something, it should be a documentation page or a source code manual, not a mailing list or forum of any kind.

Copy link
Member

@sbraz sbraz Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary to install the package that provides the mount.cifs utility. This is usually the cifs-utils package. mount.cifs is a wrapper which adds the ip= parameter to the mount parameters.

For example, with mount.cifs installed:

root@localhost ~ $ mount -v -t cifs //xxx.ovh.net/nsxxx /mnt/FolderMount -o vers=2.0,username=root,password=xxx
mount.cifs kernel mount options: ip=a.b.c.d,unc=\\xxx.ovh.net\nsxxx,vers=2.0,user=root,pass=********

Without mount.cifs installed:

mount: /mnt/FolderMount: mount(2) system call failed: No route to host.
       dmesg(1) may have more information after failed mount system call.

and dmesg contains:

CIFS: Unable to determine destination address


## Go further

Join our [community of users](/links/community).