天天看點

centos6.4 *64 Linux挂載windows下共享檔案夾

centos6.4 *64 Linux挂載windows下共享檔案夾

mount //192.168.1.21 /mnt/pub

結果無法正常挂載,提示以下錯誤,開始以為是因為windows下共享檔案夾是ntfs格式的問題,下了一個ntfs-3g,依舊無效,後來發現是少了元件包cifs-utils

[root@localhost ~]# mount //192.168.1.25/pub /mnt/pub

mount: wrong fs type, bad option, bad superblock on //192.168.1.25/pub,

       missing codepage or helper program, or other error

       (for several filesystems (e.g. nfs, cifs) you might

       need a /sbin/mount.<type> helper program)

       In some cases useful info is found in syslog - try

       dmesg | tail  or so

安裝完cifs-utils後直接挂載根目錄會顯示以下錯誤

[root@localhost mnt]# mount -t cifs //192.168.1.25 /mnt/pub

Password: 

Retrying with upper case share name

mount error(6): No such device or address

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

#經多次嘗試後發現不能挂載根目錄,隻能挂載共享檔案名,

經過多次搜尋及嘗試後發現幾個問題

1.少了一個元件包cifs-utils

2.linux無法直接挂載根目錄,如://192.168.1.21,隻能挂載檔案//192.168.1.21/pub

解決方案

1.缺少了一個cifs-utils包,安裝即可 yum -y install cifs-utils

2.linux無法直接挂載根目錄,如://192.168.1.21,隻能挂載共享檔案夾 //192.168.1.21/pub

3.如果共享檔案沒有設定密碼Password:直接回車即可;mount //192.168.1.25/pub /mnt/pub

4.如果共享檔案設定了密碼mount -o username=username,passwd=passwd //192.168.1.21/pub /mnt/pub

#按照以上指令挂載即可,注意username及passwd之間必須加"," 且間隔不能有空格.

5.我這裡嘗試 mount 後面加不加參數 -t cifs 都可以挂載

最後解除挂載的問題:

[root@localhost pub]# umount /mnt/pub

umount: /mnt/pub: device is busy.

        (In some cases useful info about processes that use

         the device is found by lsof(8) or fuser(1)).

#解除安裝挂載檔案時使用者不能操作已挂在的檔案,否則會出現以上錯誤,如果進入了/mnt/pub目錄,此時退出/mnt/pub目錄後可以正常解除安裝挂載檔案

繼續閱讀