Page 1 of 1

How to Mount VHD Over Network From MiSTer to PC?

Posted: Sun Nov 27, 2022 11:30 am
by eobet

I have a 20gb VHD for AO486 on the Mister's internal SD card, which isn't that easy to physically access in my build.

The only remote way I have to access it is via WinSCP, but I don't want to transfer 20gb back and forth every time I want to make a change.

Does Mister support Samba or something which could enable me to remotely access the SD card and mount the VHD?

I haven't managed to find any guides for this so far, so any help is appreciated!


Re: How to Mount VHD Over Network From MiSTer to PC?

Posted: Sun Nov 27, 2022 12:50 pm
by Stupid Dufus

There is a samba script you can set up. Have you tried that one yet?

https://github.com/MiSTer-devel/Wiki_MiSTer/wiki/Samba


Re: How to Mount VHD Over Network From MiSTer to PC?

Posted: Sun Nov 27, 2022 6:46 pm
by Malor
Yes, this will absolutely work, and in fact is usually faster than using the SD.

(outdated link removed: see post below for instructions.)

As an aside, I've got what you're talking about working, using AO486 to connect to a VHD on a NAS share, but for some reason, it is excruciatingly slow for writes. Like, impossibly slow; I haven't actually timed it, but I'd be surprised if it gets more than maybe 10K/second. I'm hosting it on a ZFS share, and I think maybe the combo of AO486, Samba, and ZFS is not a good one for trying to write new blocks. I plan to eventually buy a bigger SD card, and move AO486 VHDs back to the local system for further testing, but I haven't gotten around to it yet. (so much other stuff to see!)

So while you can definitely use a NAS for AO486, it's possible that you may have performance issues with that specific core. I strongly suspect, however, that a filesystem that allows in-place block overwrites (like, well, pretty much anything but ZFS and btrfs) will work well.

If you use Linux's default ext4 filesystem, or if you host from WIndows using NTFS or FAT, it will probably be fine.

Re: How to Mount VHD Over Network From MiSTer to PC?

Posted: Sun Nov 27, 2022 7:10 pm
by Malor
Okay, I dug some more and found the script. It's been moved to this repository:

https://github.com/MiSTer-devel/Scripts_MiSTer

What you want is "cifs_mount.sh" and "cifs_umount.sh".

edit: you can download the files directly on the Mister by entering, on the command line:

Code: Select all

cd /media/fat/Scripts
wget https://raw.githubusercontent.com/MiSTer-devel/Scripts_MiSTer/master/cifs_mount.sh
wget https://raw.githubusercontent.com/MiSTer-devel/Scripts_MiSTer/master/cifs_umount.sh
That's a lot easier if you have SSH running, because you can just copy and paste those commands. You can, of course, pull the SD card and load them from Windows as well. Just remember to save them directly from your browser, don't copy and paste into a text editor to save them.

The cifs_mount.sh can accept all your settings for servers, usernames, passwords, and where you want the directory attached in the tree. (the default is /media/fat/cifs). However, I've had that file blown away at least once by a system update, forcing me to redo everything.

That might not happen anymore, but one way to prevent a script update from erasing your settings is to copy cifs_mount.sh to cifs_mount.ini. In the ini file, go through the script, put in all your variables, and delete all the code blocks. What you want to end up with is just variables being set.

When cifs_mount.sh detects cifs_mount.ini, it will source that script so that those variables are set correctly.

I wouldn't copy mine verbatim, but this is a redacted version of my cifs_mount.ini:

Code: Select all

#Your CIFS Server, i.e. your NAS name or its IP address.
SERVER="A.B.C.D"

#The share name on the Server.
SHARE="sharename"

#The user name, leave blank for guest access.
USERNAME="username"

#The user password, irrelevant (leave blank) for guest access.
PASSWORD="plaintext_password"

#Optional user domain, when in doubt leave blank.
DOMAIN=""

#Local directory/directories where the share will be mounted.
#- It can ba a single directory, i.e. "cifs", so the remote share, i.e. \\NAS\MiSTer
#  will be directly mounted on /media/fat/cifs (/media/fat is the root of the SD card).
#  NOTE: /media/fat/cifs is a special location that the mister binary will try before looking in
# the standard games location of /media/fat/games, so "cifs" is the suggested setting.
#- It can be a pipe "|" separated list of directories, i.e. "Amiga|C64|NES|SNES",
#  so the share subdirectiories with those names,
#  i.e. \\NAS\MiSTer\Amiga, \\NAS\MiSTer\C64, \\NAS\MiSTer\NES and \\NAS\MiSTer\SNES
#  will be mounted on local /media/fat/Amiga, /media/fat/C64, /media/fat/NES and /media/fat/SNES.
#- It can be an asterisk "*": when SINGLE_CIFS_CONNECTION="true",
#  all the directories in the remote share will be listed and mounted locally,
#  except the special ones (i.e. linux and config);
#  when SINGLE_CIFS_CONNECTION="false" all the directories in the SD root,
#  except the special ones (i.e. linux and config), will be mounted when one
#  with a matching name is found on the remote share.
LOCAL_DIR="cifs"

#Optional additional mount options, when in doubt leave blank.
#If you have problems not related to username/password, you can try "vers=2.0" or "vers=3.0".
ADDITIONAL_MOUNT_OPTIONS="vers=3.11"

#"true" in order to wait for the CIFS server to be reachable;
#useful when using this script at boot time.
WAIT_FOR_SERVER="true"

#"true" for automounting CIFS shares at boot time;
#it will create start/kill scripts in /etc/network/if-up.d and /etc/network/if-down.d.
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"
The "vers=311" argument might give you trouble if you're hosting on an older version of Linux. The comment above that line has some other options you can try. IIRC, all the stuff under ADVANCED OPTIONS is just what the original script had. I don't think I've changed any of these.

These settings will end up mounting the share at /media/fat/cifs, which is the default target directory for NAS shares. Most of the Mister utilities know to look there first, before checking the regular /media/fat. If you have trouble, you can set up symlinks in /media/fat aimed at /media/fat/cifs, but multiple people claim they're not needed anymore.

It's safest to generate your own cifs_mount.ini by editing the original script, in case there are new settings since I created mine. Think of my version as a template for your version. It should look roughly similar. You can save and edit mine if you want, but there may be missing options if you do.

If you're editing from Windows, make sure to save the files from the browser *first*. This will save them with the Unix text encoding. If you then edit the files with a Windows editor, it should normally recognize that it's Unix text, and save in the correct format. Unix uses only linefeed at the end of lines, where Windows uses carriage return/linefeed. Many Unix programs are badly confused by the Windows convention.

Re: How to Mount VHD Over Network From MiSTer to PC?

Posted: Tue Nov 29, 2022 7:25 pm
by TrevorKevorson
I'm doing something similar at the moment with pretty much everything I run on my Mister, although I picked up a 256GB MicroSD card in the Black Friday sales from Amazon. I've not been able to compare the speeds yet, VHDs seemed to work okay but felt a bit slow, but that might be down to me not actually using a 486 PC in quite a few years (although I do remember installing Windows 95 from floppy on a 486 in my first proper IT job took an age!). Works really well for console ROMS, to try and save a bit of space I ended up putting the sets of ROMS for each console in a SquashFS filesystem file and mounting that (my idea was to share the ROMS from my Linux server using Samba to both Mister and a Raspberry Pi running RetroPie but struggled to get zipped ROMS working with RetroPie). I did find though that disk images and VHDs only seem to work on a writable filesystem (for example, if I've got disk images for AO486 or the Amiga core in a SquashFS filesystem then they don't seem to open okay, but if they're on not in a compressed filesystem they work great).