Enable a Windows fileserver to support Linux filenames with invalid characters.

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.

clip_image002[1]

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”.

clip_image004[1]

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.

clip_image006[1]

Click the “Share this folder” check box and enter a “Share Name”. Now click the “Permissions” button.

clip_image008[1]

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.

clip_image010[1]

Your NFS Share is indicated with two green icons.

clip_image012[1]

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

clip_image014[1]

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

clip_image016[1]

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.

clip_image018[1]

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

clip_image020[1]

Connecting to the NFS Share

To view all available shares on a server issue the following command:

showmount -e servername

clip_image022[1]

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 servername:/sharename /localfoldername

clip_image024[1]

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.

clip_image026[1]

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.

clip_image028[1]

Advertisements

About jasontarby

Enterprise Architect / Network Engineer at SRA International, Inc.
This entry was posted in Computers and Internet and tagged , , , . Bookmark the permalink.

2 Responses to Enable a Windows fileserver to support Linux filenames with invalid characters.

  1. Jason says:

    To show the mounted drives on the desktop, create and mount the folders under /media.

  2. Rick Chatham says:

    I really, really, REALLY appreciate this article. I’ve been looking for this fix for a couple months. Thanks so much for the info.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s