How to mount an NTFS drive as utf8 over NFS
Solution 1
Solution
mount 192.168.1.1:/SHARE share -o nolock,nfsvers=4.1
My Windows Server allows all NFS protocols, CentOS did not pick 4.1. NFS 4.1 do not have anymore problems with umlauts as it seems.
Solution 2
Mounting the NTFS filesystem using NFS version 4.1, in @Lucas' answer, may seem like magic so here's why doing that solved this particular problem. If you look through the IETF RFC titled: Network File System (NFS) Version 4 Minor Version 1 Protocol, specifically section 14.4, UTF-8 Capabilities:
excerpt
14.4. UTF-8 Capabilities
const FSCHARSET_CAP4_CONTAINS_NON_UTF8 = 0x1;
const FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 = 0x2;
typedef uint32_t fs_charset_cap4;
Because some operating environments and file systems do not enforce
character set encodings, NFSv4.1 supports the fs_charset_cap
attribute (Section 5.8.2.11) that indicates to the client a file
system's UTF-8 capabilities. The attribute is an integer containing
a pair of flags. The first flag is FSCHARSET_CAP4_CONTAINS_NON_UTF8,
which, if set to one, tells the client that the file system contains
non-UTF-8 characters, and the server will not convert non-UTF
characters to UTF-8 if the client reads a symlink or directory,
neither will operations with component names or pathnames in the
arguments convert the strings to UTF-8. The second flag is
FSCHARSET_CAP4_ALLOWS_ONLY_UTF8, which, if set to one, indicates that
the server will accept (and generate) only UTF-8 characters on the
file system. If FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 is set to one,
FSCHARSET_CAP4_CONTAINS_NON_UTF8 MUST be set to zero.
FSCHARSET_CAP4_ALLOWS_ONLY_UTF8 SHOULD always be set to one.
This was added in 4.1, and hadn't existed prior. At least according to my researching this issue.
For those that are managing NFS servers and use 4.0 it looks like you're encouraged to use 4.1 assuming you want to:
NFS version 4 minor version 1 has no dependencies on NFS version 4 minor version 0, and it is considered a separate protocol. Thus, this document neither updates nor obsoletes RFC 3530. NFS minor version 1 is deemed superior to NFS minor version 0 with no loss of functionality, and its use is preferred over version 0. Both NFS minor versions 0 and 1 can be used simultaneously on the same network, between the same client and server.
Related videos on Youtube
Comments
-
Lucas over 1 year
Question
How to mount a nfs share (NTFS formatted fileystem) as
utf8
inCentOS 6.5
?What I tried
mount -o iocharset=utf8 mount -o nfs=utf8 mount -o utf8=1 mount -o utf8
Problem:
When I create a file on my unix drive containing umlauts(äöü) and export that file to my NFS share I see broken characters in Windows (e.g.
A¼
) The broken characters are only in the filename - not in the content.Is it possible that the locale settings are wrong?
LC_* = "en_US.UTF-8"
Tried alsode_DE.UTF-8
When I create a file on windows in the share with umlauts, it is displayed as
?
in unix. I guess there is a problem with the locale settings.Default LC Settings
LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
locale -a | grep de_DE
de_DE de_DE@euro de_DE.iso88591 de_DE.iso885915@euro de_DE.utf8
Tried all - no improvement.
-
Admin over 10 yearsWhat filesystem is formatted on it?
-
Admin over 10 yearsis this an NFS mount?
-
Admin over 10 yearsNFS on a NTFS formatted filesystem - could the problem be the locale settings? Currently en_US.UTF-8. Updated question
-