命令参考
在终端输入 juicefs 并执行,就能看到所有可用的命令。在每个子命令后面添加 -h/--help 并运行,就能获得该命令的详细帮助信息,例如 juicefs format -h。
NAME:
juicefs - A POSIX file system built on Redis and object storage.
USAGE:
juicefs [global options] command [command options] [arguments...]
VERSION:
1.3.1
COMMANDS:
ADMIN:
format Format a volume
config Change configuration of a volume
quota Manage directory quotas
destroy Destroy an existing volume
gc Garbage collector of objects in data storage
fsck Check consistency of a volume
restore restore files from trash
dump Dump metadata into a file
load Load metadata from a previously dumped file
version Show version
INSPECTOR:
status Show status of a volume
stats Show real time performance statistics of JuiceFS
profile Show profiling of operations completed in JuiceFS
info Show internal information of a path or inode
debug Collect and display system static and runtime information
summary Show tree summary of a directory
SERVICE:
mount Mount a volume
umount Unmount a volume
gateway Start an S3-compatible gateway
webdav Start a WebDAV server
TOOL:
bench Run benchmarks on a path
objbench Run benchmarks on an object storage
warmup Build cache for target directories/files
rmr Remove directories recursively
sync Sync between two storages
clone clone a file or directory without copying the underlying data
compact Trigger compaction of chunks
GLOBAL OPTIONS:
--verbose, --debug, -v enable debug log (default: false)
--quiet, -q show warning and errors only (default: false)
--trace enable trace log (default: false)
--log-id value append the given log id in log, use "random" to use random uuid
--no-agent disable pprof (:6060) agent (default: false)
--pyroscope value pyroscope address
--no-color disable colors (default: false)
--help, -h show help (default: false)
--version, -V print version only (default: false)
COPYRIGHT:
Apache License 2.0
自动补全
通过加载 hack/autocomplete 目录下的对应脚本可以启用命令的自动补全,例如:
- Bash
- Zsh
source hack/autocomplete/bash_autocomplete
source hack/autocomplete/zsh_autocomplete
请注意自动补全功能仅对当前会话有效。如果你希望对所有新会话都启用此功能,请将 source 命令添加到 .bashrc 或 .zshrc 中:
- Bash
- Zsh
echo "source path/to/bash_autocomplete" >> ~/.bashrc
echo "source path/to/zsh_autocomplete" >> ~/.zshrc
另外,如果你是在 Linux 系统上使用 bash,也可以直接将脚本拷贝到 /etc/bash_completion.d 目录并将其重命名为 juicefs:
cp hack/autocomplete/bash_autocomplete /etc/bash_completion.d/juicefs
source /etc/bash_completion.d/juicefs
全局选项
| 项 | 说明 |
|---|---|
-q --quiet | 仅显示警告及错误日志。 |
-v --verbose --debug | 开启调试日志。 |
--trace | 开启比 --debug 选项更详细的调试日志。 |
--no-agent | 关闭 pprof 代理。 |
--pyroscope | 配置 Pyroscope 地址,如 http://localhost:4040。 |
--no-color | 关闭日志的颜色。 |
管理
juicefs format
创建并格式化文件系统,如果 META-URL 中已经存在一个文件系统,不会再次进行格式化。如果文件系统创建后需要调整配置,请使用 juicefs config。
概览
juicefs format [command options] META-URL NAME
# 创建一个简单的测试卷(数据将存储在本地目录中)
juicefs format sqlite3://myjfs.db myjfs
# 使用 Redis 和 S3 创建卷
juicefs format redis://localhost myjfs --storage=s3 --bucket=https://mybucket.s3.us-east-2.amazonaws.com
# 使用带有密码的 MySQL 创建卷
juicefs format mysql://jfs:mypassword@(127.0.0.1:3306)/juicefs myjfs
# 更安全的方法
META_PASSWORD=mypassword juicefs format mysql://jfs:@(127.0.0.1:3306)/juicefs myjfs
# 创建一个开启配额设置的卷
juicefs format sqlite3://myjfs.db myjfs --inodes=1000000 --capacity=102400
# 创建一个关闭了回收站的卷
juicefs format sqlite3://myjfs.db myjfs --trash-days=0
参数
| 项 | 说明 |
|---|---|
META-URL | 用于元数据存储的数据库 URL,详情查看「JuiceFS 支持的元数据引擎」。 |
NAME | 文件系统名称。 |
--force | 强制覆盖当前的格式化配置,默认为 false。 |
--no-update | 不要修改已有的格式化配置,默认为 false。 |