smb://root:security@192.168.1.207/home/smb
ftp://ftpuser:security@192.168.1.207/home/ftp
sftp://root:security@192.168.1.207/home/sftp
nfs://:@192.168.1.207/home/nfs
24.3. Samba协议目录挂载(smb://)
挂载命令:
mount //172.168.1.145/home /mnt/samba
如果挂载出错,根据提示,有可能是因为版本原因的,可以指定版本,如
mount //172.168.1.145/home /mnt/samba -o vers=2.0
需在命令中指定用户名密码挂载的
mount //172.168.1.145/home /mnt/samba -o username=user,password=pwd
mount //192.168.1.207/home/smb /home/gyy -o username=root,password=security
卸载命令:
umount /mnt/samba
24.4. FTP协议目录挂载(ftp://)
Centos下需要安装curlftpfs包,依赖EPEL源:
yum -y install epel-release
yum install curlftpfs
挂载命令:
curlftpfs -o rw,allow_other ftp://ftpuser:security@192.168.1.207//home/ftp /home/mountDir
curlftpfs -o rw,allow_other codepage=utf8 ftp://username:password@192.168.1.168 /mnt/ftp
卸载命令:
umount /mnt/ftp
24.5. SFTP协议目录挂载(sftp://)
凡是开启ssh服务的,都可以挂载。
Centos下需要安装fuse-sshfs包,依赖EPEL源:
yum install fuse-sshfs
挂载命令:
echo security | sshfs root@192.168.1.207:/home/sftp /home/gyy -o password_stdin
echo security | sshfs root@192.168.1.207:/home/sftp /home/IPEARL2.0/java_bin/sfm/data -o password_stdin
sshfs remoteuser@remote.example.com:/home/remoteuser /mnt/ssh
卸载命令:
umount /mnt/ssh
24.6. NFS协议目录挂载(nfs://)
挂载命令:
mount -t nfs 192.168.1.145:/home/nfs /mnt/nfs
卸载命令:
umount /mnt/nfs
服务端安装:
yum install -y nfs-utils rpcbind
mkdir -p /data/nfs-share
cat /etc/exports
vi /etc/exports
新增
/home/nfs *(rw,sync,no_root_squash)
启动
service rpcbind start
service nfs start
测试:
mkdir -p /kubernetes
mount -t nfs 192.168.1.207:/data/nfs-share /home/gyy
umount /home/gyy