Enable a Windows fileserver to support Linux filenames with invalid characters.
Background
We have a Windows Server 2008 R2 fileserver that has the “c:\data” folder shared as “data”. We use this share as a repository for files from both Windows and Linux operation systems. We noticed that some network file copy operations would fail and discovered that the files that were failing all had colons in their filename. The colon is an invalid character for Windows filenames and renaming was not an option.
Issue
Windows and Linux have a different set of invalid characters for filenames. A Window filename cannot contain any of the following characters:
\ / : * ? ” < > |
Solution
On the Windows server, turn on NFS sharing and enable character translation. Access the NFS share instead of the Windows share from the Linux operating system.
Instructions (Windows Server)
On the Windows Server we need to install support for NFS shares, create an NFS share for our Linux users, and enable character translation.
Add “Services for Network File System” under the “File Services” – “Add Role Services”.
To create a new NFS share, right-click on the folder to share then click the “NFS Sharing” tab. Click the “Manage NFS Sharing” button.
Click the “Share this folder” check box and enter a “Share Name”. Now click the “Permissions” button.
Select the “Type of access” and press the “OK” button. When you are returned to the “NFS Advanced Sharing” window press the “OK” button, then press the “Close” button.
Your NFS Share is indicated with two green icons.
The next step is to enable and setup character translation. Create a text file and add the following text:
0x3a : 0x2d ; replace client : with – on server
Save the text file. In this particular case the file is saved as “C:\trans.txt”, but you can use any name or location.
Open the “Registry Editor” (Start – Run – regedit) and add the path to the text file you created to the “CharacterTranslation” string at the following Key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
Character translation is now enabled for your NFS shares.
Instructions (Linux)
On the Linux operating systems we need to enable the NFS client and mount the NFS share hosted on the Windows Server.
Launch the “Synaptic Package Manager” and install the “nfs-common” package.
We need to create a folder to serve as a mount point to the NFS share on the Windows Server. You can use any folder name you want. Open a terminal window and issue the following commands:
sudo su
mkdir /nfs
Connecting to the NFS Share
To view all available shares on a server issue the following command:
showmount -e servername
Replace servername with the name or IP address of your server. This will return a list of NFS shares. On the server at 192.168.75.129 there is a single NFS share called “data”. To mount this NFS share to the /nfs folder, issue the following command:
mount -o soft,intr,rsize=8192,wsize=8192 servernamesharename /localfoldername
Replace servername with the name or IP address of your server; sharename with the name of your NFS share; localfoldername with the name of the local folder you want to use as your mount point.
You can now access the share and copy files; even if the filenames contains charters that are invalid for Windows.
On the Windows Server, the invalid characters have been translated (as per the character translation file). Notice that the files still retain their filename on the Linux side.
To show the mounted drives on the desktop, create and mount the folders under /media.
I really, really, REALLY appreciate this article. I’ve been looking for this fix for a couple months. Thanks so much for the info.
I tried this but still getting input output error when I try to create file from linux eg test:b . Do we need to restart windows after adding translation file ? I tried umount and mount from linux but still doesnt work.