How to deploy JuiceFS

JuiceFS is quite easy to deploy with the following steps:

  1. Create a file system in juicefs web console
  2. Download juicefs command line tool
  3. Mount juicefs file system

You may do it manually following the Getting Started guide.

Alternatively, you may automate it with DevOps tools such as Ansible, Salt and etc.


Use the following command to download and mount JuiceFS.

curl -L -o juicefs && chmod +x juicefs
sudo ./juicefs auth --token $JFS_TOKEN --accesskey $ACCESSKEY --secretkey $SECRETKEY $JFS_NAME
sudo ./juicefs mount $JFS_NAME $JFS_MOUNTPONT

Add a line to /etc/fstab so that it will be mounted automatically after booting. For example:

JFS_NAME  /jfs     juicefs    _netdev   0 0


By default, CentOS 6 will NOT mount network filesystem after boot, run sudo chkconfig --add netfs to enable it.

Using Shell Script

cd /tmp
curl -L -o juicefs && chmod +x juicefs
sudo ./juicefs auth "$1" --token "$2" --accesskey "$3" --secretkey "$4"
sudo ./juicefs mount "$1" "$5"

Save the above content as a shell script and mount JuiceFS with one-line command:



For environment that does not require accesskey or secretkey, e.g. using AWS IAM role for authentication, put a placeholder '' for the corresponding arguments.

Using Salt

Example state snippets to deploy JuiceFS with Salt.

        - source:
        - mode:  0755
        - skip_verify: True

juicefs auth:
        - name: /root/juicefs auth {{jfs_name}} --token {{jfs_token}} --accesskey={{accesskey}} --secretkey={{secretkey}}
        - creates: /root/.juicefs/{{jfs_name}}.conf
        - file: /root/juicefs

        - device: {{jfs_name}}
        - fstype: juicefs
        - mkmnt: True
        - opts: _netdev
        - device_name_regex:
            - JuiceFS:{{jfs_name}}
        - cmd: juicefs auth


juicefs command line tool will automatically add prefix JuiceFS: to the device name. Therefore, you need to apply a regex match for it.

Using Ansible

Example for mounting JuiceFS on localhost using Ansible playbook

- hosts: localhost
    - set_fact:
        jfs_bin: /usr/local/bin/juicefs

    - get_url:
        mode: 0755
        dest: "{{jfs_bin}}

    - command: {{jfs_bin}} auth {{jfs_name}} --token {{jfs_token}} --accesskey={{accesskey}} --secretkey={{secretkey}}
        creates: /root/.juicefs/{{jfs_name}}.conf

    - mount:
        path: "{{jfs_path}}"
        src: "{{jfs_name}}"
        fstype: juicefs
        opts: _netdev
        state: mounted