Loading

使用fstab自动挂载网络存储

警告

谨慎使用该方法,网络挂载超时可能导致启动失败!!!
谨慎使用该方法,网络挂载超时可能导致启动失败!!!
谨慎使用该方法,网络挂载超时可能导致启动失败!!!

介绍

使用外置网络存储对小容量终端进行扩容
很容易搜索到NFS的挂载方式
这里介绍一些不常见的方法
通过写如/etc/fstab实现开机自动mount

ssh

类似于sftp的挂载方式,但需要额外安装sshfs并为root配置免密

sudo -i
ssh-copy-id ubuntu@192.168.1.100

对应fstab语法

# mount sshfs
sshfs#ubuntu@192.168.1.100:/home/ubuntu/xxx/share /var/sftp/xxx     fuse      defaults,_netdev,reconnect,uid=1003,gid=1003,idmap=user,allow_other  0   0

ftp

需要额外安装curlftpfs并建立认证文件/root/.netrc内容

machine 192.168.1.100
login user_here
password password_here

对应fstab语法

# mount ftp
curlftpfs#192.168.1.100:/path/to/share /var/sftp/ooo fuse allow_other,uid=1003,gid=1003,umask=0022 0 0

参考

mount - How to convert sshfs command to fstab entry? - Ask Ubuntu
Mount remote ftp directory host locally into linux filesystem - Linux Tutorials - Learn Linux Configuration

posted @ 2022-11-22 11:42  azureology  阅读(511)  评论(0)    收藏  举报