SMB/CIFS Mount

Just got a MiSTer and need some help? Join the forum and post your questions here!
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: SMB/CIFS Mount

Unread post by jca »

@akeley
Did you manage to connect your MISTer to your PC via your router?
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: SMB/CIFS Mount

Unread post by akeley »

Not yet, a bit snowed in with work and other stuff atm. Will try it out later this week.

About the shared folder, does it need to have everything from MiSTer's media/fat/ in it? Or is just having the /games/ folder's structure and content enough?
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: SMB/CIFS Mount

Unread post by jca »

I guess the games directory is enough, like when using a USB drive but I leave it to the experts as I am not using a share folder.
Do you have any special reason for using a shared folder? Using a USB drive is way easier. The drawback is that you will not learn anything about networking :lol:
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: SMB/CIFS Mount

Unread post by akeley »

With shared folder it'd be much easier to experiment with big vhds for the likes of Amiga/ao486/etc...that's the main reason. At the moment I have to either shift them over WiFi, which is quite slow, or swap the SD card back and forth - a major #firstworldproblem ;) I guess the ability to try out random PSX/Saturn games on a whim would be cool too, without having to keep their massive fullsets around.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

akeley wrote: Wed Mar 09, 2022 9:16 am Really? How I wish you were here 2 years ago, you could've saved me a lotta cash and time with this helpful advice.
*eyeroll*
These kind of preachy, elitist attitudes are the reason why so many people stay away from the FPGA scene.

Not that it really needs explaining, but there are limited hours in the day, especially for an adult with a job/family life. So, wasting time on "learning" something that I have inherent dislike for, that has actually very little connection to this "emulation project", and what I will most likely never need again, seems quite pointless.
This is a complex problem, and it's one outside the scope of Mister entirely. If you're not willing to learn things, you're not going to make it work.

To run a network share, you need to learn some networking, both physical and logical. And to do it safely, you'll probably need to learn a little more. Your description of your setup makes it sound like you might not even have a firewall; opening a network share on a non-firewalled Windows machine is not usually a very good idea.

Announcing that you want to do something complex, but that you are absolutely unwilling to do any work or learning to make it happen, more or less demanding that everyone else do it for you, is not a recipe for success.
Stupid Dufus
Posts: 152
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 87 times
Been thanked: 46 times

Re: SMB/CIFS Mount

Unread post by Stupid Dufus »

Just games should be ok. Personally, I have the following mounted:
_Computer
_Console
cheats
font
games
saves
Shadow_Masks
wallpapers

I would do _arcade, but the symlinks I have in there don't play nicely with the network share I have setup.
akeley
Top Contributor
Posts: 1303
Joined: Mon May 25, 2020 7:54 pm
Has thanked: 416 times
Been thanked: 399 times

Re: SMB/CIFS Mount

Unread post by akeley »

Malor wrote: Thu Mar 10, 2022 1:00 am Announcing that you want to do something complex, but that you are absolutely unwilling to do any work or learning to make it happen, more or less demanding that everyone else do it for you, is not a recipe for success.
This is an extreme projection, which you have based on one out-of-context quote. It was as uncalled for and unjustified as your eyebrow rising conjecture about my setup's safety...smh.

Yes, I'm unwilling to spend extra money on extra hardware and/or vast amounts of time learning everything about networking from scratch That's because the problem I'm trying to solve is not worth it for me (I've been using MiSTer nearly 2 years without this functionality) and, more importantly, these measures are not necessary at all in the first place to solve it. What I am willing to do though, is follow some focused advice and directions, which is something that has been happening already, no thanks to your input though.

The "demanding that everyone else do it for you" jibe is a nonsensical low blow. You might as well go and apply it to any other basic query that's being asked on this or any other board, but as it happens there still exist a zillion step-by-step guides out there which serve the purpose of accomplishing some task without learning the entire background behind it, or people who don't have problem answering even silliest of questions. It's, for example, something I've done when connecting my Playstation 2 to a shared folder (took less than an hour), and what I'm pretty sure you and all the other people who use this jibe hypocritically also have done at some point in their lives.

This is my last post on this subject. If you or anybody else want to continue with this pointless, and rather ugly derail, by all means, go ahead, but please be aware it really makes you look like an insufferable, high horse riding nerd caricature.
jca
Top Contributor
Posts: 1911
Joined: Wed May 27, 2020 1:59 pm
Has thanked: 145 times
Been thanked: 454 times

Re: SMB/CIFS Mount

Unread post by jca »

Earlier on you said you want to do this because uploading via WiFi is painfully slow and unplugging/plugging the SD card is not a good idea.
If you use a wired connection via your router things will be improved. This is the way I upload stuff to my MISTer. It is not a speed demon but I don't mind.
SmokyBarnable
Posts: 10
Joined: Mon Apr 11, 2022 4:24 pm
Has thanked: 4 times
Been thanked: 2 times

Re: SMB/CIFS Mount

Unread post by SmokyBarnable »

I've got a couple obvious questions, just to cover the bases. I'm planning to use a share on my Synology NAS as described above.

Where on the MiSTer do the mount/unmiunt scripts and ini file go?

Do they run every time it boots? And if so do they need to be added to a startup script somewhere?

When would I want to unmount?
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

The scripts should be built-in. They're in /media/fat/Scripts.

Networking only comes up after the GUI is displayed. It gets DHCP, runs the cifs_mount.sh script, and runs the time sync script. cifs_mount.sh doesn't seem to read an ini, you have to put the values for server, username, and password directly into the file. It will normally mount stuff on /media/fat/cifs, where you want to immediately make a "games" subdir.

edit: I went and looked closely, and the patch notes on the script claim to read values from the same name as the original script, with an ini extension. So you should be able to create a "cifs_mount.sh.ini" file with the necessary variables set; you'll have to read the main script to know what the variables are, however. That will hopefully let you keep your settings even if the script gets overwritten by an update, so it's probably a good idea.

second edit: after testing, the ini file needs to be named cifs_mount.ini.

Most cores in update_all will automatically update themselves to /media/fat/cifs/games/corename preferentially to the normal /media/fat/games/corename, but not all of them do, so you sometimes have to copy files into cifs.

I think the only time you'd maybe want an explicit umount would be if you're going to reboot the server. And even then, it would be of pretty limited utility.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

This is my last post on this subject. If you or anybody else want to continue with this pointless, and rather ugly derail, by all means, go ahead, but please be aware it really makes you look like an insufferable, high horse riding nerd caricature.
"I want to go to the moon, but I refuse to ride in a rocketship or travel through vacuum. Anyone insisting that I need a rocketship and must travel through vacuum is an insufferable nerd."
kenpachi
Posts: 2
Joined: Tue Apr 19, 2022 9:07 am

Re: SMB/CIFS Mount

Unread post by kenpachi »

Hi All, first post!

Loving the MiSTer, mostly been enjoying the c64 core so far (so awesome to be running my JD 1571 drive via IEC) though just getting into the AO486 now.

I was actually writing this post to ask for help, seeing as though my CIFS share was mounting/browsing perfectly, but cores where acting funny, and AO486 wasn't booting from any VHD or IMG from the share, even though I could browse and select them, and they were the same VHDs and IMG files I'd created and booted from on the SD.

Seeing as though I'm here, I may as well post my own solution if it might save someone some time (as I was just about to scrap the idea altogether and load up a USB HDD)...
- ssh'd in using putty
- double checked that the share was mounted rw with the mount command
- navigated to /media/fat/games and tried to mkdir a test directory - permission denied (i thought it had something to do with write access)
- double checked share permissions via windoze. I'd initially shared the folder using 'advanced sharing' on properties>sharing tab, adding the user account and assigning r/w/full control
- however when i went through 'share' on the properties>sharing tab, it had assigned the account 'read-only'. Go figure.
I changed it to read/write and it's all fixed, can mkdir/rmdir a test directory, and now all the VHDs and IMGs load no problem.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

As you found, Windows proper has two levels of permission control, on the share itself, and on the filesystem. I generally don't use permissions on the share at all, and try to use NTFS permissions instead, as they're more granular.

I think of Windows as being a big jerk about permissions: it's looking for any reason it can find to prevent access. Denies always override everything else, so if there's any way a deny rule applies to a login, access is refused. If no explicit permission is granted, access is refused. Thus, in general, I stick to Allow rules only, since if something isn't allowed, it's denied. You rarely need anything explicit to prevent access. That happens all by itself.
User avatar
Morfious
Posts: 37
Joined: Mon May 25, 2020 10:49 am
Has thanked: 10 times
Been thanked: 11 times

Re: SMB/CIFS Mount

Unread post by Morfious »

Not sure if I should create a new post or not, but I have a question for the group as well regarding cifs mount and best practices. I have 3 MiSTer set ups and was thinking about consolidating all of the roms into one place on my Synology server. I already have cifs set up on the Synology for the PSX and SegaCD drives, but was considering adding on the arcade, 8 and 16 bit roms as well. Would this do strange things when running update all from each of the different MiSTers? Also, is it better to have the mount point be the _Cifs folder or to media/fat/games? I would think media/fat/games would be the better folder so you don't have to navigate to a new folder location for each different system. Let me know if this should be a new topic. Otherwise, thanks for the input/help.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

I only have one Mister, and I use the standard /media/fat/cifs mountpoint, and that's been working better and better over time. Cores get downloaded directly to the SD, but *most* ROMs are now downloaded correctly to /media/fat/cifs/games. I think there are still a couple outliers that insist on loading to /media/fat/games instead, like AO486 and PS1. I think you'd probably be fine running three at once that way, as long as they were all different cores. If you tried to run the same core at the same time from multiple locations, you could have major corruption problems if the cores are trying to save data of any kind.

The whole CIFS setup is very weird. I wish you could just load a share point with /etc/fstab instead. In fact, the whole Mister setup around filesystems is deeply strange. It makes no sense to me to have the root filesystem on a loopback.
Stupid Dufus
Posts: 152
Joined: Sun Aug 30, 2020 12:04 am
Has thanked: 87 times
Been thanked: 46 times

Re: SMB/CIFS Mount

Unread post by Stupid Dufus »

No idea how everyone is getting things to mount at /media/fat/cifs

Here's my cifs_mount:

Code: Select all

SERVER="SYNOLOGYNAS"
SHARE="mister"
USERNAME="mister"
PASSWORD="passwordgoeshere"
LOCAL_DIR="*"
WAIT_FOR_SERVER="true"
MOUNT_AT_BOOT="true"
ADDITIONAL_MOUNT_OPTIONS="vers=2.0"
The * for the LOCAL_DIR setting will get all the folders in the synology share to mount in /media/fat on the MiSTer.

In the "mister" shared folder on the synologynas, I have the following folders:
_Computer
_Console
_Games
_Other
_Utility
BIOS
bootrom
cheats
config
docs
Filters
Filters_Audio
font
games
Gamma
Presets
saves
savestates
Shadow_Masks


ALL of them mount to /media/fat. Have to wait about 10 - 15 seconds after MiSTer power-on for DHCP and the cifs script to kick in.

NONE of them mount to /media/fat/cifs. Don't even have a cifs folder on the sdcard
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

You have to make the cifs folder yourself; mounts require a target directory that already exists.

In other words:

Code: Select all

cd /media/fat
mkdir cifs
Then make yourself a /media/fat/Scripts/cifs_mount.ini file, and put your settings changes there, rather than in cifs_mount.sh directly. If and when the system scripts do a Linux update, that file may be overwritten. (at least it was for me at the last update.) AFAIK, settings in cifs_mount.ini should stay untouched.

This is what my cifs_mount.ini looks like:

Code: Select all

SERVER="W.X.Y.Z"
SHARE="mister"
USERNAME="mister"
PASSWORD="[redacted]"
DOMAIN=""
LOCAL_DIR="cifs"
ADDITIONAL_MOUNT_OPTIONS="vers=3.11"
WAIT_FOR_SERVER="true"
MOUNT_AT_BOOT="true"
#========= ADVANCED OPTIONS =========
BASE_PATH="/media/fat"
#MISTER_CIFS_URL="https://github.com/MiSTer-devel/CIFS_MiSTer"
KERNEL_MODULES="md4.ko|md5.ko|des_generic.ko|fscache.ko|cifs.ko"
IFS="|"
SINGLE_CIFS_CONNECTION="true"
#Pipe "|" separated list of directories which will never be mounted when LOCAL_DIR="*"
SPECIAL_DIRECTORIES="config|linux|System Volume Information"
I'm not sure what's up with the advanced options, mostly, except for BASE_PATH. I just took those verbatim from the cifs_mount.sh script. You could probably omit them, as they're also in cifs_mount.sh. You need BASE_PATH, but you could trim the rest AFAIK.

With those settings, you end up with a base path of /media/fat in Advanced options, and then a local dir of cifs, so it concatenates them and mounts at /media/fat/cifs.

Most of the update scripts will preferentially put stuff in /media/fat/cifs/games. There are at least a couple of cores that don't do that, AO486 being one. With that core, you have to copy everything from /media/fat/games/AO486 to /media/fat/cifs/games/AO486 manually.

Because of that, I would recommend not making a cifs folder until you're ready to get the share pointed at it; the next update is gonna put a hurricane of stuff in there, even if it's not correctly mounted. Don't run any updates until you know the share is live and that you can successfully create, read, and delete files and directories there.
SmokyBarnable
Posts: 10
Joined: Mon Apr 11, 2022 4:24 pm
Has thanked: 4 times
Been thanked: 2 times

Re: SMB/CIFS Mount

Unread post by SmokyBarnable »

Malor wrote: Tue Apr 12, 2022 11:11 am The scripts should be built-in. They're in /media/fat/Scripts.

Networking only comes up after the GUI is displayed. It gets DHCP, runs the cifs_mount.sh script, and runs the time sync script. cifs_mount.sh doesn't seem to read an ini, you have to put the values for server, username, and password directly into the file. It will normally mount stuff on /media/fat/cifs, where you want to immediately make a "games" subdir.
Today I finally built my MiSTer. Started up on the first try! Then I did an update.

Then I setup the cifs_mount, and verified it is mounting my shared folders on the NAS.

Running another update (download) does nothing because all the current files are in the /media/fat folders from the original update.

Do I manually move them to the shared folder? Or delete them and re-update?
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

What I did was to move these directories:

Code: Select all

BIOS
Cheats
config
docs
games
saves
savestates
into /media/fat/cifs. A sample command:

Code: Select all

(before typing this, be sure the cifs mount is active at /media/fat/cifs!)
cd /media/fat
mv BIOS cifs
I repeated that for each directory. Then I did symbolic links back onto the SD card:

Code: Select all

cd /media/fat
ln -s /media/fat/cifs/BIOS BIOS
ln -s /media/fat/cifs/Cheats Cheats
....
... and so on, for all seven directories. That way absolutely everything works, because all scripts and cores will find things in /media/fat.

Another option is to edit the update ini settings so that it's hard-pointed at /media/fat/cifs instead. But I like my way better, because there's definitely only one copy of everything, and it's definitely in the cifs directory. Anything incorrectly looking in regular /media/fat will be transparently redirected into cifs.

The only real downside is that you have to do this from a Linux console, there's no reasonable way to do it from a Windows host. I'd suggest getting ssh running before you start tinkering, and then do it all that way. It's a lot easier when you can cut and paste.
SmokyBarnable
Posts: 10
Joined: Mon Apr 11, 2022 4:24 pm
Has thanked: 4 times
Been thanked: 2 times

Re: SMB/CIFS Mount

Unread post by SmokyBarnable »

Makes perfect sense, thanks.
User avatar
thisisamigaspeaking
Posts: 231
Joined: Mon May 23, 2022 12:28 am
Has thanked: 74 times
Been thanked: 21 times

Re: SMB/CIFS Mount

Unread post by thisisamigaspeaking »

SmokyBarnable wrote: Sun Jun 26, 2022 10:32 pm
Malor wrote: Tue Apr 12, 2022 11:11 am The scripts should be built-in. They're in /media/fat/Scripts.

Networking only comes up after the GUI is displayed. It gets DHCP, runs the cifs_mount.sh script, and runs the time sync script. cifs_mount.sh doesn't seem to read an ini, you have to put the values for server, username, and password directly into the file. It will normally mount stuff on /media/fat/cifs, where you want to immediately make a "games" subdir.
Today I finally built my MiSTer. Started up on the first try! Then I did an update.

Then I setup the cifs_mount, and verified it is mounting my shared folders on the NAS.

Running another update (download) does nothing because all the current files are in the /media/fat folders from the original update.

Do I manually move them to the shared folder? Or delete them and re-update?
There are several ways you can approach it. Since I was starting from a fresh installation, what I did is set:

LOCAL_DIR="*"

in cifs_mount.sh and create the directories I wanted to be hosted on my NAS in the share, then the script will mount each of those directories to that location on "/media/fat/*". I.e. the "games" directory on the share will be placed in /media/fat/games if and only if it exists on the share, and any directories that don't exist there will be left on the local drive.

SPECIAL_DIRECTORIES="config|linux|System Volume Information"

These will not be automatically mounted if LOCAL_DIR="*".

Then I ran update_all and it filled those directories for me. If you wanted to preserve your existing directories from the flash drive, I'm not sure what the best way to do it would be, I'd just read the directories from the flash drive on a computer and put it in the SMB share, using the LOCAL_DIR="*" setting to automatically mount them from the MiSTer, but there might be a better way.
Malor
Top Contributor
Posts: 860
Joined: Wed Feb 09, 2022 11:50 pm
Has thanked: 64 times
Been thanked: 194 times

Re: SMB/CIFS Mount

Unread post by Malor »

BTW, I discovered later that putting the 'config' directory on the network share can be a bad idea. It takes a few seconds for the share to come up, and the main Mister binary launches much faster than that. This means it can't find its own config file and starts with all default settings. If you do a warm reboot, the share is up, and the Mister will correctly read its settings. This means that cold boots and warm boots don't act the same.

The conclusion I drew: keep the Mister binary and the config directory on the same filesystem.
Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: SMB/CIFS Mount

Unread post by Nikoh »

Hello folks, even though my nas supports "unix extensions" and "follow symlinks" parameters I can't exclude my SD because using cifs_mount.sh mister share is mounted with "nounix" parameter.
With this client side parameter mister can't see and/or create symlinks that are at the base of the arcade organiger (and other triks) on the mister environment.
I know that i can store on my nas just games folder but my question is that someone know how to solve this problem...
Thanks.

Image

Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: SMB/CIFS Mount

Unread post by Nikoh »

Solved, thanks to @raiden7 ;-)
viewtopic.php?t=4972

Image

Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: SMB/CIFS Mount

Unread post by Nikoh »

Nikoh wrote: Sat Aug 27, 2022 3:22 pm Solved, thanks to @raiden7 ;-)
viewtopic.php?t=4972
This way is not very clean solution.... someone know how to remove "nounix" from mount option? I know how add genera parameters but not how to remove a parameter...

Image

User avatar
thisisamigaspeaking
Posts: 231
Joined: Mon May 23, 2022 12:28 am
Has thanked: 74 times
Been thanked: 21 times

Re: SMB/CIFS Mount

Unread post by thisisamigaspeaking »

Why is adding a single line to an .ini file not a clean solution?

BTW, glad I looked at that, I didn't know why that organize the arcade games thing was failing.
Nikoh
Posts: 29
Joined: Mon Dec 13, 2021 3:37 pm
Has thanked: 3 times

Re: SMB/CIFS Mount

Unread post by Nikoh »

Because my NAS (cifs/samba server) support unix extensions so is better to use it, i think.....
mfsymlinks is like a tricks to use symlinks under windows.

Image

Witchboard
Posts: 1
Joined: Fri May 26, 2023 3:44 am
Has thanked: 1 time

Re: SMB/CIFS Mount

Unread post by Witchboard »

Hello. New to the forum and had a quick question. Looks like this is a necrobump, but figured it's the right topic.

I got my CIFS up and going, but it's not working the way I expected it to. I got frustrated and just copied all my games directory contents to my QNAP NAS and set the local_dir for "games" in cifs_mount.sh. It's all working, but now everything is on the NAS. I was wanting to keep some cores on the SD card to play in case I took my MiSTer to a friends house.

The reason I ended up that route is because if I used either "" as the local_dir or "cifs" anytime I would run update_all, it would copy everything back to the local SD card rather than to the NAS. I'm not sure how the update_all.sh is picking up everybody else's directories that either use "" or "cifs" as their local directory in cifs_mount.sh. Like I said, it's working, but now I'm just tethered to my NAS.

I was thinking it would see both the local SD and NAS directories at the same time, but that doesn't seem to be the case. With cifs mounted it sees what's on the NAS, with it not, it sees what's on the SD card. I'm sure my explanation is confusing, but I'm just trying to understand how it works.

preacha
Posts: 1
Joined: Tue Oct 24, 2023 7:32 am

Re: SMB/CIFS Mount

Unread post by preacha »

Hi guys,
Recently started up the mister after a long hiatus (and wanted to give the N64 core a go). Anyway, I am getting an error when running cifs_mount.sh

mount: /tmp/cifs_mount: mount(2) system call failed: Host is down.

It worked previously but doesn't seem to be working now , I confirmed that NAS is reachable by pinging it from MiSTer.

Thank you in advance.

User avatar
offset
Posts: 43
Joined: Fri Jan 27, 2023 10:55 am
Has thanked: 22 times
Been thanked: 10 times

Re: SMB/CIFS Mount

Unread post by offset »

When I see that, I usually have network issue somewhere.

I don't recall if I installed extra linux packages on my mister system, but maybe these commands will help for troubleshooting.

Code: Select all

# my NAS ip is 10.0.0.33, so obviously you would change it to your IP config in the examples below.

# check to see if smb server is running
# from the mister
/root# nc -v 10.0.0.33 445
10.0.0.33 445 open

# check to see what smb share are available to you
# from the mister
/root# smbclient -L //10.0.0.33/ -U nas
Enter MISTER\nas's password:

    Sharename       Type      Comment
    ---------       ----      -------
    print$          Disk      Printer Drivers
    nas             Disk      NAS share
    mister          Disk      MiSTer share
    mister2         Disk      MiSTer backup share
    IPC$            IPC       IPC Service (ubuntu server (Samba, Ubuntu))
SMB1 disabled -- no workgroup available
Post Reply