前幾天公司有個(gè)項(xiàng)目,是需要在服務(wù)器上運(yùn)行一段程序,需要讀一個(gè)資源庫。但是資源庫這么大,總不能全部傳到服務(wù)器上去吧,好占地方,于是就想掛載下目錄,中間遇到了一些小波折,把自己遇到的問題記錄下,也希望能夠幫助到其他人
公司的服務(wù)器是Ubuntu的,Centos其實(shí)類似就不例舉啦。廢話不多說,下邊一一記錄
- 掛載windows共享目錄命令
mount -t cifs -o username=windows用戶名,password=windows密碼 //windows的ip + 共享文件路徑 linux掛載路徑
舉個(gè)栗子:
mount -t cifs -o username=xiaobai,password=123456 //1.1.1.1 /testdir /usr/picresource
劃重點(diǎn) windows 和 linux 路徑之間是有空格的!
如果上邊的命令輸入后,石沉大海,什么都沒有,那么恭喜你,掛載成功了!要是有問題的話…看下我下邊遇到的有沒有你的情況
- 掛載遇到的問題
- 提示 mount error(121):remote error I/O error
解決方法:
去網(wǎng)上找了找,是說 NFS(Network File System)即網(wǎng)絡(luò)文件系統(tǒng)服務(wù)器有多個(gè)版本導(dǎo)致的,在掛載的時(shí)候指定下nfs的版本就可以,就像這樣:
mount -t cifs -o username=xiaobai,password=123456,ver=2.1 //1.1.1.1 /testdir /usr/picresource
- 提示錯(cuò)誤 block device //xxx is write-protected, mounting read-only
sudo mount -t cifs -o username=user,rw //xxxxxxx /mnt/xxx/
mount: block device //xxx is write-protected, mounting read-only
mount: cannot mount block device //xxx read-only
解決方法:
ubuntu
sudo apt-get install cifs-utils
centos
yum install cifs-utils
- 提示錯(cuò)誤 mount error(13): Permission denied
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
解決方法:
這個(gè)就是windows的用戶名、密碼、或者是ip寫錯(cuò)啦(或者windows共享的目錄沒有開讀寫的權(quán)限哦)仔細(xì)檢查下
以上就是我遇到掛載目錄時(shí)候遇到的問題了,希望能夠幫助到遇到同樣問題的小伙伴~