綾小路龍之介の素人思考

[Debian] windows の共有ディレクトリを samba (cifs) でマウント

結局必要なパッケージは cifs-utils で、ファイルシステムタイプは cifs にすればよい。マウントするときに導入するパッケージとその方法が変わったような気がするので、一応メモ。

以下のエントリを/etc/fstabに含め、/path/to/mount/dirに//192.168.12.3/share をマウントすることを考える。これではおそらくパッケージ不足でマウントに失敗。

# grep smbfs /etc/fstab
//192.168.12.3/share /path/to/mount/dir smbfs username=hoge,gid=1000,uid=1000,iocharset=utf8,rw,defaults,noauto 0 0
# mount /path/to/mount/dir
mount: unknown filesystem type 'smbfs'

必要なパッケージ (smbclient) をインストールしたつもり。これでもsmbfsファイルシステムが見つからないといわれる。

# apt-get install smbclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  cifs-utils
The following NEW packages will be installed:
  smbclient
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 5,568 kB of archives.
After this operation, 43.1 MB of additional disk space will be used.
Get:1 http://ftp.jp.debian.org/debian/ wheezy/main smbclient i386 2:3.6.6-6 [5,568 kB]
Fetched 5,568 kB in 4s (1,322 kB/s)
(Reading database ... 72914 files and directories currently installed.)
Unpacking smbclient (from .../smbclient_2%3a3.6.6-6_i386.deb) ...
Processing triggers for man-db ...
Setting up smbclient (2:3.6.6-6) ...
# mount /path/to/mount/dir
mount: unknown filesystem type 'smbfs'

/etc/fstabのsmbfs部分をcifsで書き換え。マウントすると今度はメッセージが変わる。読み込み専用でマウントしようとしたけどだめだったらしい。

# sed -i -e 's/smbfs/cifs/' /etc/fstab
# grep cifs /etc/fstab
//192.168.12.3/share /path/to/mount/dir cifs username=hoge,gid=1000,uid=1000,iocharset=utf8,rw,defaults,noauto 0 0
# mount /path/to/mount/dir
mount: block device //192.168.12.3/share is write-protected, mounting read-only
mount: cannot mount block device //192.168.12.3/share read-only

cifs-utilsをインストール。これは smbclient の suggests に載っている。再度マウント。マウントに成功。

# apt-get install cifs-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  keyutils
The following NEW packages will be installed:
  cifs-utils keyutils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/109 kB of archives.
After this operation, 339 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Selecting previously unselected package cifs-utils.
(Reading database ... 72940 files and directories currently installed.)
Unpacking cifs-utils (from .../cifs-utils_2%3a5.5-1_i386.deb) ...
Selecting previously unselected package keyutils.
Unpacking keyutils (from .../keyutils_1.5.5-3_i386.deb) ...
Processing triggers for man-db ...
Setting up cifs-utils (2:5.5-1) ...
Setting up keyutils (1.5.5-3) ...
# mount /path/to/mount/dir
Password:
# df | grep /path/to/mount/dir
//192.168.12.3/share                                    488384508  243017176  245367332  50% /path/to/mount/dir

smbclient は不要かもしれないので purge して再度マウントテスト。マウントに成功するので、smbclientは削除しておく。

# umount /path/to/mount/dir
# apt-get purge smbclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  smbclient*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 43.1 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 72973 files and directories currently installed.)
Removing smbclient ...
Processing triggers for man-db ...
# mount /path/to/mount/dir
Password:
# !df
df  | grep /path/to/mount/dir
//192.168.12.3/share                                    488384508  243017176  245367332  50% /path/to/mount/dir

リファレンス

  1. unknown filesystem type 'smbfs' - Google 検索
  2. cifsさっき知りました(mount.cifsでWindows共有フォルダをマウントする) | Vamp Records

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2010-07-19T10:42:03+09:00
  2. Modified: 2010-07-19T10:42:03+09:00
  3. Generated: 2017-04-30T23:09:17+09:00