ThomasHall
Dabbler
- Joined
- Jun 5, 2019
- Messages
- 14
I'm having some trouble with mounting SMB shares in FreeNAS and would appreciate some help. The problem is actually two-fold, so I'll start with the background and context.
What I've got is:
As it is, the NAS has 2 shares set up, "Desktop-Backup" and "Server-Backup". I discovered that there were some problems with file names where the NAS itself would display names either with missing characters (WebGUI) or with a ? in place of the character (ls in terminal). In the W10 file explorer, these files would just show up with no name or extension, unable to be read. The characters in question were anything not strict ASCII, for example things like ´ é ü å ä ö etc. It made things complicated when trying to manage them too, and my only option was basically to SSH to the NAS, go root, and then do something like "rm abc*" and hope no other files matched.
After a lot of fiddling, I discovered that adding/changing
in the NAS' smb.conf file made it so that files I copied to the NAS showed up correctly on both the NAS and the W10 mount. With the exception of the fact that this file resets whenever I reboot the NAS, that seems to do the trick, though I'm not really sure what it does to be honest other than adjusting the expected character encoding for different devices I assume.
Anyway, then came the time to mount these shares to FreeNAS. First problem is, how do I do that properly? Using the following command on FreeNAS worked, technically, but I'm not sure if that's what I should be using:
However, I've also read that I should be using "mount -t cifs ..." instead, but I can't seem to get the format correct, or some settings are wrong.
Either way, working with the assumption that the mount_smbfs command is okay, I run into another issue, which is again the file names. If I create files at one of the devices, I get different results. "a.txt" shows up correctly on both W10, NAS and FreeNAS. If I create "ä.txt" and "ö.txt" on the desktop or the NAS respectively, it shows up correctly on itself and the other, but not on FreeNAS which will display them as "?.txt". If I create "å.txt" on FreeNAS, it'll display correctly on FreeNAS, but show up as "Ã¥.txt" on the other devices. I'm suspecting this is once again some issue with the character encoding, but I have no clue what I'm supposed to do about it.
Here's the output of smbstatus and the smb.conf file on the NAS:
192.168.1.201 is my FreeNAS server, 250 is my desktop, and 200 is the NAS326 itself. As you might be able to tell, I currently have both shares mounted on the desktop and only "Desktop-Backup" mounted on FreeNAS for experimenting.
Again, this file is reset on reboots, so I can't make permanent changes to it unless I figure out some way around that. As it's just a backup host though, I can just make changes manually and restart the service whenever I plug it in for running a backup.
Originally the dos charset was "ASCII" and the display charset wasn't there at all (smbstatus seems to indicate this is ignored anyway). The unix charset was "UTF8", but I don't know if that makes a difference and examples I looked at used "UTF-8", so I don't know.
So I guess the questions are basically:
What I've got is:
- 1x Windows 10 desktop
- 1x MicroServer Gen10 FreeNAS 11.2-U5 (2x4TB pool + 1xSSD pool, 2 shares total)
- 1x Zyxel NAS326 (1x8TB disk, 2 shares total)
As it is, the NAS has 2 shares set up, "Desktop-Backup" and "Server-Backup". I discovered that there were some problems with file names where the NAS itself would display names either with missing characters (WebGUI) or with a ? in place of the character (ls in terminal). In the W10 file explorer, these files would just show up with no name or extension, unable to be read. The characters in question were anything not strict ASCII, for example things like ´ é ü å ä ö etc. It made things complicated when trying to manage them too, and my only option was basically to SSH to the NAS, go root, and then do something like "rm abc*" and hope no other files matched.
After a lot of fiddling, I discovered that adding/changing
unix charset = UTF-8
dos charset = ISO8859-1
display charset = ISO8859-1
in the NAS' smb.conf file made it so that files I copied to the NAS showed up correctly on both the NAS and the W10 mount. With the exception of the fact that this file resets whenever I reboot the NAS, that seems to do the trick, though I'm not really sure what it does to be honest other than adjusting the expected character encoding for different devices I assume.
Anyway, then came the time to mount these shares to FreeNAS. First problem is, how do I do that properly? Using the following command on FreeNAS worked, technically, but I'm not sure if that's what I should be using:
mount_smbfs -W WORKGROUP -I 192.168.1.200 //admin@NAS326/Desktop-Backup /mnt/Zyxel
However, I've also read that I should be using "mount -t cifs ..." instead, but I can't seem to get the format correct, or some settings are wrong.
Either way, working with the assumption that the mount_smbfs command is okay, I run into another issue, which is again the file names. If I create files at one of the devices, I get different results. "a.txt" shows up correctly on both W10, NAS and FreeNAS. If I create "ä.txt" and "ö.txt" on the desktop or the NAS respectively, it shows up correctly on itself and the other, but not on FreeNAS which will display them as "?.txt". If I create "å.txt" on FreeNAS, it'll display correctly on FreeNAS, but show up as "Ã¥.txt" on the other devices. I'm suspecting this is once again some issue with the character encoding, but I have no clue what I'm supposed to do about it.
Here's the output of smbstatus and the smb.conf file on the NAS:
Code:
~ # smbstatus Ignoring unknown parameter "display charset" Ignoring unknown parameter "display charset" Samba version 4.1.7 PID Username Group Machine ------------------------------------------------------------------- 5239|admin|everyone|freenas|ipv4:192.168.1.201:62758 30857|admin|everyone|192.168.1.250|ipv4:192.168.1.250:52095 Service pid machine Connected at ------------------------------------------------------- Server-Backup|30857|192.168.1.250|2019-08-20 09:50:28 Desktop-Backup|30857|192.168.1.250|2019-08-20 09:50:28 Desktop-Backup|5239|freenas|2019-08-20 03:27:59 Locked files: Pid Uid DenyMode Access R/W Oplock SharePath Name Time -------------------------------------------------------------------------------------------------- 30857 501 DENY_ALL 0x100080 RDONLY NONE /i-data/32856d84/Server-Backup . Tue Aug 20 10:14:32 2019 30857 501 DENY_NONE 0x100081 RDONLY NONE /i-data/32856d84/Desktop-Backup . Tue Aug 20 10:22:44 2019 30857 501 DENY_NONE 0x100081 RDONLY NONE /i-data/32856d84/Desktop-Backup . Tue Aug 20 10:22:48 2019
192.168.1.201 is my FreeNAS server, 250 is my desktop, and 200 is the NAS326 itself. As you might be able to tell, I currently have both shares mounted on the desktop and only "Desktop-Backup" mounted on FreeNAS for experimenting.
Code:
~ # cat /etc/samba/smb.conf [global] workgroup = WORKGROUP server string = "" netbios name = NAS326 unix charset = UTF-8 dos charset = ISO8859-1 display charset = ISO8859-1 security = user encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd guest account = pc-guest encrypt passwords = yes map to guest = Bad User write ok = yes force create mode = 777 force directory mode = 777 auth methods = guest sam_ignoredomain max log size = 50 host msdfs = yes lanman auth = yes kernel oplocks = no socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=2048000 SO_RCVBUF=2048000 max xmit = 131072 level2 oplocks = no max smbd processes = 128 printing = cups printcap = /etc/printcap load printers = yes use sendfile = yes passdb backend = smbpasswd unix extensions = no wide links = yes veto files = /.grive*/.dropbox*/.THIS_IS_RECYCLE_BIN/.RBM/ min receivefile size = 8192 store dos attributes = yes [printers] path = /i-data/.media/samba public = yes guest ok = yes browseable = yes writable = no printable = yes use client driver = yes [Server-Backup] path = /i-data/32856d84/Server-Backup follow symlinks = yes strict allocate = yes allocation roundup size = 0 aio write size = 4096 comment = "" browseable = yes valid users = "admin" [Desktop-Backup] path = /i-data/32856d84/Desktop-Backup follow symlinks = yes strict allocate = yes allocation roundup size = 0 aio write size = 4096 comment = "" browseable = yes valid users = "admin"
Again, this file is reset on reboots, so I can't make permanent changes to it unless I figure out some way around that. As it's just a backup host though, I can just make changes manually and restart the service whenever I plug it in for running a backup.
Originally the dos charset was "ASCII" and the display charset wasn't there at all (smbstatus seems to indicate this is ignored anyway). The unix charset was "UTF8", but I don't know if that makes a difference and examples I looked at used "UTF-8", so I don't know.
So I guess the questions are basically:
- What's the proper way to mount an SMB share in FreeNAS/Ubuntu (bonus points for persistent mounting too, e.g. fstab entry)?
- How do I ensure proper character encoding across multiple platforms while doing it?