Wed, 04 Oct 2006

mount.cifs

うちのファイルサーバ(LANDISK/Debian)ではSamba(Samba3)とNFSを両方稼働させて、 Windows/Linux両方からデータのやりとりができるようにしています。ただ、 NFSでマウントしたときには、ファイルのパーミッションが思うようにいかず ちょっと不便。IRCではmasayukoさんから「SambaとNFSの両方からデータをいじるのは 気持ち悪い」という至極もっともな御意見をいただいたのでLinux側もsmbfsに移行。

始めは

smbmount //fileserver/public /mnt/public/ \\
-o username=xxx,workgroup=hoge,password=yyy, \\
fmask=665,dmask=755,uid=2000,iocharset="utf8",codepage="utf8"

をベースにiocharsetやcodepageをいじったり、Kernelのsmbfsのサポートをい じったりしてイロイロやってみたのですが、日本語 が:x8c:xc0:x92:xe8:x94:xd5な感じに化けて失敗。ちなみに、smb.confは

 [global]
    dos charset = CP932
    unix charset = UTF8
    display charset = UTF8

としています。結局、CIFSにすれば文字化けは無くなるかも、という情報をみ つけたので、

mount -t cifs //fileserver/public /mnt/public \\
-o username=xxx,domain=hoge,password=yyy,iocharset="utf8"

として、文字化けは解決。SambaサーバのほうでUnix extensionなるものがデフォ ルトで有効のようなので、UIDやGIDはそのままでmountされるみたいです。(つ まり、NFSと同じように各マシンでuid/gidを揃える必要がありそう。smbfs の uid, gid 指定は無視される)今回はたまたまNFS共有をかけていたのでサーバ とクライアントでUIDをあわせていましたが、知らないとちょっとはまりそう。 なんかうまい方法あるのかな。

さて、cifsはいろんなところで一押しのプロトコルらしい。kernel2.6の付属文書 (filesystems/cifs.txt)には

Since both Samba server and this filesystem client support the CIFS Unix extensions, the combination can provide a reasonable alternative to NFSv4 for fileserving in some Linux to Linux environments, not just in Linux to Windows environments.

と書かれています。そうなのかwindowsだけではないのか、うむー。勉強不足。

posted at: Wed, 04 Oct 2006 01:47 [linux] permanent link/comments(0)

Comments

お名前:


Secret Number Image

(スパムコメントよけです。上の数字を入力してからコメントしてください。)

コメント:


Profile

Calendar

< October 2006 >
SuMoTuWeThFrSa
1 2 3 4 5 6 7
8 91011121314
15161718192021
22232425262728
293031    

Twitter

Photo

www.flickr.com

Awasete

Recent Track

Web Feed

This blog is...

pyblosxom.log