Skip to content

安装

对于基于 Debian 的系统(如 Ubuntu):

shell
sudo apt-get update
sudo apt-get install build-essential libfuse-dev fuse

对于基于 Red Hat 的系统(如 CentOS):

shell
sudo yum install gcc make fuse fuse-devel

基于源码安装

shell
wget http://sourceforge.net/projects/fuse/files/fuse-2.x/2.9.4/fuse-2.9.4.tar.gz/download
tar -xzvf fuse-2.9.4.tar.gz
cd fuse-2.9.4
make
sudo make install

使用

加载 FUSE 内核模块

shell
sudo modprobe fuse

验证安装

shell
lsmod | grep fuse

基本用法

下面是fuse命令的一些常用选项和用法:

  1. 创建fuse文件系统:
shell
# 创建一个挂载点
mkdir /mnt/fuse
# 将ext2文件系统挂载到/mnt/fuse下。
fuse-ext2 /dev/sda1 /mnt/fuse
  1. 查看已加载的fuse文件系统:
shell
mount | grep fuse
  1. fuse文件系统的支持:

– 可以使用各种编程语言和框架实现自定义的fuse文件系统,如C、Python、Go等语言。

  • 可采用 rclone 支持更多SFTP、FTP、OSS 等文件系统。

卸载文件系统

卸载 FUSE 文件系统

shell
sudo umount /mnt/hellofs
sudo fusermount -u /mnt/hellofs

作为Linux系统服务

创建 Linux 系统服务:vim /etc/systemd/system/rclone.service

ini
[Unit]
Description=Rclone NFS Service
After=syslog.target network-online.target

[Service]
# Type: simple 启动后作为主进程,forking 启动后拉起子进程
Type=forking
WorkingDirectory=/home/jxft/software/minio
PIDFile=/home/jxft/software/minio/start.d/rclone.pid
# Environment="你的环境变量名=变量值", 支持多行
# ExecStartPre=
ExecStart=/home/jxft/software/minio/rclone.sh start
# ExecStartPost=
ExecStop=/home/jxft/software/minio/rclone.sh stop
# Restart: 重启策略 always,中断退出 on-abort
Restart=on-abort
TimeoutStartSec=30
User=root
Group=root

[Install]
WantedBy=default.target

QA

  1. failed to mount FUSE fs: fusermount: exec: "fusermount3"
log
CRITICAL: Fatal error: failed to mount FUSE fs: fusermount: exec: "fusermount3": executable file not found in $PATH

解决:安装 fuse,可能并不是 fuse3,因为 apt,yum 官方源本身就比较旧。可以通过创建软连接的方式解决。

shell
which fusermount
# 输出的路径创建软连接
sudo ln -s /usr/bin/fusermount /usr/bin/fusermount3

然后重新 rclone 挂载。

参考