Command Reference
Running juicefs by itself and it will print all available commands. In addition, you can add -h/--help flag after each command to get more information, e.g., 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
Auto completion
To enable commands completion, simply source the script provided within hack/autocomplete directory. For example:
- Bash
- Zsh
source hack/autocomplete/bash_autocomplete
source hack/autocomplete/zsh_autocomplete
Please note the auto-completion is only enabled for the current session. If you want to apply it for all new sessions, add the source command to .bashrc or .zshrc:
- Bash
- Zsh
echo "source path/to/bash_autocomplete" >> ~/.bashrc
echo "source path/to/zsh_autocomplete" >> ~/.zshrc
Alternatively, if you are using bash on a Linux system, you may just copy the script to /etc/bash_completion.d and rename it to juicefs:
cp hack/autocomplete/bash_autocomplete /etc/bash_completion.d/juicefs
source /etc/bash_completion.d/juicefs
Global options
| Items | Description |
|---|---|
-v --verbose --debug | Enable debug logs. |
-q --quiet | Show only warning and error logs. |
--trace | Enable more detailed debug logs than the --debug option. |
--no-agent | Disable pprof agent. |
--pyroscope | Config Pyroscope address, e.g. http://localhost:4040. |
--no-color | Disable log color. |
Admin
juicefs format
Create and format a file system, if a volume already exists with the same META-URL, this command will skip the format step. To adjust configurations for existing volumes, use juicefs config.
Synopsis
juicefs format [command options] META-URL NAME
# Create a simple test volume (data will be stored in a local directory)
juicefs format sqlite3://myjfs.db myjfs
# Create a volume with Redis and S3
juicefs format redis://localhost myjfs --storage=s3 --bucket=https://mybucket.s3.us-east-2.amazonaws.com
# Create a volume with password protected MySQL
juicefs format mysql://jfs:mypassword@(127.0.0.1:3306)/juicefs myjfs
# A safer alternative
META_PASSWORD=mypassword juicefs format mysql://jfs:@(127.0.0.1:3306)/juicefs myjfs
# Provide password from file
META_PASSWORD_FILE=/secret/mypassword.txt juicefs format mysql://jfs:@(127.0.0.1:3306)/juicefs myjfs
# Create a volume with quota enabled
juicefs format sqlite3://myjfs.db myjfs --inodes=1000000 --capacity=102400
# Create a volume with trash disabled
juicefs format sqlite3://myjfs.db myjfs --trash-days=0
Options
| Items | Description |
|---|---|
META-URL | Database URL of the metadata engine. See JuiceFS supported metadata engines for details. |
NAME | Name of the file system |
--force | overwrite existing format (default: false) |
--no-update | don't update existing volume (default: false) |
Data storage options
| Items | Description |
|---|---|
--storage=file | Object storage type (e.g. s3, gs, oss, cos) (default: file, refer to documentation for all supported object storage types) |
--bucket=/var/jfs | A bucket URL to store data (default: $HOME/.juicefs/local or /var/jfs) |
--access-key=value | Access Key for object storage (can also be set via the environment variable ACCESS_KEY), see How to Set Up Object Storage for more. |
--secret-key value | Secret Key for object storage (can also be set via the environment variable SECRET_KEY), see How to Set Up Object Storage for more. |
--session-token=value | session token for object storage, see How to Set Up Object Storage for more. |
--storage-class value Added in v1.1 | the default storage class |
Data format options
| Items | Description |
|---|---|
--block-size=4M | size of block in KiB (default: 4M). 4M is usually a better default value because many object storage services use 4M as their internal block size, thus using the same block size in JuiceFS usually yields better performance. |
--compress=none | compression algorithm, choose from lz4, zstd, none (default). Enabling compression will inevitably affect performance. Among the two supported algorithms, lz4 offers a better performance, while zstd comes with a higher compression ratio, Google for their detailed comparison. |
--encrypt-rsa-key=value | A path to RSA private key (PEM) |
--encrypt-algo=aes256gcm-rsa | encrypt algorithm (aes256gcm-rsa, chacha20-rsa) (default: "aes256gcm-rsa") |
--hash-prefix | For most object storages, if object storage blocks are sequentially named, they will also be closely stored in the underlying physical regions. When loaded with intensive concurrent consecutive reads, this can cause hotspots and hinder object storage performance. Enabling --hash-prefix will add a hash prefix to name of the blocks (slice ID mod 256, see internal implementation), this distributes data blocks evenly across actual object storage regions, offering more consistent performance. Obviously, this option dictates object naming pattern and should be specified when a file system is created, and cannot be changed on-the-fly.Currently, AWS S3 had already made improvements and no longer require application side optimization, but for other types of object storages, this option still recommended for large scale scenarios. |
--shards=0 | If your object storage limit speed in a bucket level (or you're using a self-hosted object storage with limited performance), you can store the blocks into N buckets by hash of key (default: 0), when N is greater than 0, bucket should to be in the form of %d, e.g. --bucket "juicefs-%d". --shards cannot be changed afterwards and must be planned carefully ahead. |
Management options
| Items | Description |
|---|---|
--capacity=0 | storage space limit in GiB, default to 0 which means no limit. Capacity will include trash files, if trash is enabled. |
--inodes=0 | Limit the number of inodes, default to 0 which means no limit. |
--trash-days=1 | By default, delete files are put into trash, this option controls the number of days before trash files are expired, default to 1, set to 0 to disable trash. |
--enable-acl=true Added in v1.2 | enable POSIX ACL,it is irreversible. |
juicefs config
Change config of a volume. Note that after updating some settings, the client may not take effect immediately, and it needs to wait for a certain period of time. The specific waiting time can be controlled by the --heartbeat option.
Synopsis
juicefs config [command options] META-URL
# Show the current configurations
juicefs config redis://localhost
# Change volume "quota"
juicefs config redis://localhost --inodes 10000000 --capacity 1048576
# Change maximum days before files in trash are deleted
juicefs config redis://localhost --trash-days 7
# Limit client version that is allowed to connect
juicefs config redis://localhost --min-client-version 1.0.0 --max-client-version 1.1.0
Options
| Items | Description |
|---|---|
--yes, -y | automatically answer 'yes' to all prompts and run non-interactively (default: false) |
--force | skip sanity check and force update the configurations (default: false) |
Data storage options
| Items | Description |
|---|---|
--storage=file Added in v1.1 | Object storage type (e.g. s3, gs, oss, cos) (default: "file", refer to documentation for all supported object storage types). |
--bucket=/var/jfs | A bucket URL to store data (default: $HOME/.juicefs/local or /var/jfs) |
--access-key=value | Access Key for object storage (can also be set via the environment variable ACCESS_KEY), see How to Set Up Object Storage for more. |
--secret-key value | Secret Key for object storage (can also be set via the environment variable SECRET_KEY), see How to Set Up Object Storage for more. |
--session-token=value | session token for object storage, see How to Set Up Object Storage for more. |
--storage-class value Added in v1.1 | the default storage class |
--tier-id=value Added in v1.4 | Storage tier ID (1–3), used together with --tier-sc to configure the storage class for a specific tier. ID 0 is reserved for the default tier and cannot be set via this option. |
--tier-sc=value Added in v1.4 | Storage class for the given tier (for example, STANDARD_IA, INTELLIGENT_TIERING, and GLACIER_IR). Must be used together with --tier-id. |
--upload-limit=0 | bandwidth limit for upload in Mbps (default: 0) |
--download-limit=0 | bandwidth limit for download in Mbps (default: 0) |
--max-uploads=20 | maximum number of concurrent uploads (default: 20) |
--max-downloads=200 Added in v1.4 | maximum number of concurrent downloads (default: 200) |
Management options
| Items | Description |
|---|---|
--capacity value | limit for space in GiB |
--inodes value | limit for number of inodes |
--trash-days value | number of days after which removed files will be permanently deleted |
--enable-acl Added in v1.2 | enable POSIX ACL (irreversible), at the same time, the minimum client version allowed to connect will be upgraded to v1.2 |
--encrypt-secret | encrypt the secret key if it was previously stored in plain format (default: false) |
--min-client-version value Added in v1.1 | minimum client version allowed to connect |
--max-client-version value Added in v1.1 | maximum client version allowed to connect |
--dir-stats Added in v1.1 | enable dir stats, which is necessary for fast summary and dir quota (default: false) |
--changelog Added in v1.4 | enable metadata changelog (default: false) |
--changelog-max-age Added in v1.4 | maximum retention time for changelog entries, such as 2h or 30m; 0 disables time-based cleanup |
--changelog-max-lines Added in v1.4 | maximum number of changelog entries to keep; 0 means unlimited |
juicefs quota Added in v1.1
juicefs quota manages storage quotas for directories, users, and groups.
Synopsis
juicefs quota command [command options] META-URL
# Set quota to a directory
juicefs quota set redis://localhost --path /dir1 --capacity 1 --inodes 100
# Set quota for a user
juicefs quota set redis://localhost --uid 1000 --capacity 2 --inodes 200
# Set quota for a group
juicefs quota set redis://localhost --gid 100 --capacity 5 --inodes 500
# Get quota of a directory
juicefs quota get redis://localhost --path /dir1
# Get quota of a user/group
juicefs quota get redis://localhost --uid 1000
juicefs quota get redis://localhost --gid 100
# List all quotas
juicefs quota list redis://localhost
# Delete quota of a directory
juicefs quota delete redis://localhost --path /dir1
# Check quota consistency of a directory
juicefs quota check redis://localhost --path /dir1
# Check quota consistency of users/groups
juicefs quota check redis://localhost
Options
| Items | Description |
|---|---|
META-URL | Database URL of the metadata engine. See JuiceFS supported metadata engines for details. |
--path value | Full path of the directory within the volume (for directory quota) |
--uid value | User ID (for user quota) |
--gid value | Group ID (for group quota) |
--create | Creates the directory automatically if it does not exist (directory quota only). |
--capacity value | Hard space quota in GiB (default: 0) |
--inodes value | Hard inode quota (default: 0) |
--repair | repair inconsistent quota (default: false) |
--strict | calculate total usage of directory in strict mode (NOTE: may be slow for huge directory) (default: false) |
juicefs destroy
Destroy an existing volume, will delete relevant data in metadata engine and object storage. See How to destroy a file system.
Synopsis
juicefs destroy [command options] META-URL UUID
juicefs destroy redis://localhost e94d66a8-2339-4abd-b8d8-6812df737892
Options
| Items | Description |
|---|---|
--yes, -y Added in v1.1 | automatically answer 'yes' to all prompts and run non-interactively (default: false) |
--force | skip sanity check and force destroy the volume (default: false) |
juicefs gc
If for some reason, a object storage block escape JuiceFS management completely, i.e. the metadata is gone, but the block still persists in the object storage, and cannot be released, this is called an "object leak". If this happens without any special file system manipulation, it could well indicate a bug within JuiceFS, file a GitHub Issue to let us know.
Meanwhile, you can run this command to deal with leaked objects. It also deletes stale slices produced by file overwrites. See Status Check & Maintenance.
Synopsis
juicefs gc [command options] META-URL
# Check only, no writable change
juicefs gc redis://localhost
# Trigger compaction of all slices
juicefs gc redis://localhost --compact
# Delete leaked objects
juicefs gc redis://localhost --delete
Options
| Items | Description |
|---|---|
--compact | compact all chunks with more than 1 slices (default: false). |
--delete | delete leaked objects (default: false) |
--threads=10 | number of threads to delete leaked objects (default: 10) |
juicefs fsck
Check consistency of file system.
Synopsis
juicefs fsck [command options] META-URL
juicefs fsck redis://localhost
Options
| Items | Description |
|---|---|
--path value Added in v1.1 | absolute path within JuiceFS to check |
--repair Added in v1.1 | repair specified path if it's broken (default: false) |
--recursive, -r Added in v1.1 | recursively check or repair (default: false) |
--sync-dir-stat Added in v1.1 | sync stat of all directories, even if they are existed and not broken (NOTE: it may take a long time for huge trees) (default: false) |
--repair-dir-mode value Added in v1.4 | permission mode for repaired directories in octal format (default: "0755") |
juicefs restore Added in v1.1
Rebuild the tree structure for trash files, and put them back to original directories.
