Command Reference

JuiceFS provides many commands to help you manage your filesystem. This page provides a detailed reference for these commands.

Overview

If you run juicefs by itself, it will print all the available subcommands. In addition, you can add -h/--help flag after each subcommand to get help information of that subcommand.

juicefs COMMAND [options]

COMMAND could be:
  auth      authorize a filesystem
  mount     mount a filesystem
  umount    umount a filesystem
  info      show information of file or directory
  import    import files from existing object storage
  rmr       remove all files/directories recursively
  snapshot  create or remove snapshots
  grep      parallelized file pattern searcher
  version   show the version

Note: If juicefs is not placed in your $PATH, you should run the script with the path to the script. For example, if juicefs is placed in current directory, you should use ./juicefs. It is recommended to place juicefs in your $PATH for the convenience.

The documentation below gives you detailed information about each subcommand.

juicefs auth

Description

Set up the authentication information of your filesystem.

Synopsis

juicefs auth <name> --token=<token> [--accesskey=<access_key>] [--secretkey=<secret_key>]
               [--accesskey2=<access_key_2>] [--secretkey2=<secret_key_2>]

Options

<name>
The name of your filesystem.
--token=<token>
The JuiceFS token of your filesystem, you can find this token in the web console.
--accesskey=<access_key>
The access key of your bucket, you can read our guide on how to get access key and secret from your service provider.
--secretkey=<secret_key>
The secret key of your bucket, you can read our guide on how to get access key and secret from your service provider.
--accesskey2=<access_key_2>
The access key of your secondary bucket.
--secretkey2=<secret_key_2>
The secret key of your secondary bucket.

Notes

  1. You will be prompted to enter the access key and secret if you didn’t provide it through the --accesskey and --secretkey options.
  2. If your object storage provider allows accessing without key pairs, you can leave blank when you are asked for access and secret keys, or you can simply pass an empty string to the --accesskey and --secretkey options.
  3. Enable the JuiceFS replication in the setting panel of the Web Console, and mount with the --accesskey2 and --secretkey2 options.
  4. The authentication information is stored in $HOME/.juicefs/<name>.conf.

juicefs mount

Description

Mount a filesystem.

Synopsis

juicefs mount <name> <mountpoint> [-f] [-b] [-v]
                [--log=<log_path>] [--http=ADDR]
                [--external | --internal] [--max-uploads=<max_uploads>]
                [--cache-dir=<cache_dir>] [--cache-size=<cache_size>] [--cache-group=<cache_group>]
                [--writeback] [--metacache]
                [--allow-other] [--allow-root] [--enable-xattr]

Options

<name>
The name of your filesystem.
<mountpoint>
The mountpoint of your filesystem.
-f
Run in the foreground mode.
-b
Run in the background mode.
-v
Run verbosely.
--log=<log_path>
(default: /var/log/juicefs.log) The path of the log file.
--http=ADDR
The bind address to serve files using HTTP, for example, localhost:8080.
Object Storage Options
--external
Prefer to use the external entrypoint of the object storage service. This means the traffic of JuiceFS will go through the public network instead of the internal network.
--internal
Prefer to use the internal entrypoint of the object storage service. This means the traffic of JuiceFS will go through the internal network instead of the public network.
--max-uploads=<max_uploads>
(default: 50) The maximum number of concurrent uploading connections.
--upload-limit=<upload_limit>
(default: unlimited) The maximum bandwidth for upload (Mbps).
Cache Options
--cache-dir=<cache_dir>
(default: /var/jfsCache/) The path of the cache.
--cache-size=<cache_size>
(default: 1G) The maximum size of the cache. The default unit is MiB.
--cache-group=<cache_group>
The group of the cache.
--writeback
Small files (files less than 4MiB) will be written to disk first, and uploaded to object storage asynchronously in the background.
--batch N
Number of seconds to wait to combine small files into larger object (up to about 2MB) before uploading.
--metacache
Enable metadata caching in local memory.
FUSE Options
--allow-other
Allow accesses from other users. This option is enabled by default when you are running as root user. You need to enable this feature explicitly otherwise.
--allow-root
Allow access from the root. This option only works if you are mounting the filesytem as a user other than the root.
--enable-xattr
Enable xattr support.

See how to mount a filesystem in the document Getting Started.

juicefs umount

Description

Umount a JuiceFS file system.

Synopsis

juicefs umount <mountpoint> [options]

Options

-f --force
Umount it forcibly.

juicefs info

Description

Show information about the file or directory stored in JuiceFS.

Synopsis

juicefs info <path> [-n | --plain]

Options

<path>
The path to the file you are querying.
-n --plain
Show sizes in bytes.

Examples

Show information of a directory.

# juicefs info /jfs/logs
/jfs/logs:
 inodes:              4      # inode total
  directories:        2      # directory total
  files:              2      # file total
 chunks:              44     # chunk total of all files
 length:              2.91G  # real size of all files
 size:                2.91G  # billable size, every file and directory is aligned to 256KB as minimum billable size

Show information of a file.

# juicefs info --plain /jfs/daily-log.tar
/jfs/daily-log.tar:
 inode:       2955        # inode ID of the file
 length:      3128903680  # real size of the file
 size:        3128950784    # billable size, minimum is 256KB
 chunks:      47          # chunk total and detail, maximum 64MB for each chunk
   0: 58597 67108864 0 67108864 # location in the file, chunk ID, length of chunk, real start location, length
   1: 58598 67108864 0 67108864
   ...
   45: 58661 67108864 0 67108864
   46: 58662 41895936 0 41895936

juicefs import

Description

Import files already existing in the object storage without reuploading.

Synopsis

juicefs import <uri> <dst> [-v] [--name=<name>] [--mode=<mode>]

Options

<uri>
The URI of the file you are importing. It should be in the format of <bucket_name>[.<domain>][/<prefix>].
<dst>
The destination of the imported file.
--name=<name>
The name of the filesystem. This is required in systems other than Linux.
--mode=<mode>
Mode (Unix permissions) of imported files.
-v
Run verbosely.

Notes

  1. The imported file will be read-only. However, you can still modify other attributes – e.g. filename, permissions – of the files and directories.
  2. If you delete the imported file in JuiceFS, the data stored in your object storage will NOT be deleted.

juicefs rmr

Description

Remove all the files and subdirectories, similar to rm -rf, but much faster.

It will try to remove them using current uid/gid, ignore those that can’t be removed, return the number of removed files/directories, the number of left ones. If trash is enabled, the removed files are removed into trash.

Synopsis

juicefs rmr <dir> [-h]

juicefs snapshot

Description

Manage JuiceFS snapshots. Snapshots are snapshots of your data at a certain time. It is a common technology used in data backup. JuiceFS will not create a copy of your data when you create a snapshot. It will only create a copy when there are some changes made to the original data (i.e. copy-on-write).

Synopsis

juicefs snapshot <src> <dst> [-f | --force] [-c | --copy]  # create a snapshot
juicefs snapshot -d <dst> [-f | --force]  # delete a snapshot

Options

<src>
The path to the file you are creating the snapshot from.
<dst>
The locate where you want to store your snapshot.
-d --delete
Remove the snapshot.
-f --force
Overwrite existing snapshot, or remove the snapshot arbitrarily.
-c --copy
Use current user’s uid, gid and umask to create the snapshot. Otherwise it will use permission information of the file you are creating snapshot.

juicefs grep

Description

Parallelized file pattern searcher.

Synopsis

juicefs grep [PATTERN] PATH ... [options]

Options

[PATTERN]
Support simple pattern and basic regular expression.
PATH
Search path and files.
-j JOBS --jobs=JOBS
Number of parallel jobs (default is).
-e PATTERNS --regexp PATTERNS
This option is most useful when multiple -e options are used to specify multiple patterns, or when a pattern begins with a dash (-).
-E extended-regexp
Interpret pattern as an extended regular expression.
-H
Always print filename headers with output lines.
-n --line-number
Each output line is preceded by its relative line number in the file, starting at line 1.
-i --ignore-case
Perform case insensitive matching. By default, it is case sensitive.
-v --invert-match
Selected lines are those not matching any of the specified patterns.

juicefs version

Description

Show the JuiceFS version information.

Synopsis

juicefs version [options]

Options

-u --upgrade
Upgrade the juicefs client to latest version.