command_reference.md 9.6 KB
Newer Older
S
Suave Su 已提交
1 2
# Command Reference

3
There are many commands to help you manage your file system. This page provides a detailed reference for these commands.
S
Suave Su 已提交
4 5 6 7 8 9 10

## Overview

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

```
NAME:
11
   juicefs - A POSIX file system built on Redis and object storage.
S
Suave Su 已提交
12 13 14 15 16

USAGE:
   juicefs [global options] command [command options] [arguments...]

VERSION:
17
   0.14-dev (2021-06-04 d9485fb)
S
Suave Su 已提交
18 19

COMMANDS:
20 21 22 23 24 25 26 27 28 29 30 31 32 33
   format   format a volume
   mount    mount a volume
   umount   unmount a volume
   gateway  S3-compatible gateway
   sync     sync between two storage
   rmr      remove directories recursively
   info     show internal information for paths or inodes
   bench    run benchmark to read/write/stat big/small files
   gc       collect any leaked objects
   fsck     Check consistency of file system
   profile  analyze access log (Experimental)
   status   show status of JuiceFS
   warmup   build cache for target directories/files
   help, h  Shows a list of commands or help for one command
S
Suave Su 已提交
34 35

GLOBAL OPTIONS:
36 37 38
   --verbose, --debug, -v  enable debug log (default: false)
   --quiet, -q             only warning and errors (default: false)
   --trace                 enable trace log (default: false)
39
   --no-agent              Disable pprof (:6060) and gops (:6070) agent (default: false)
40 41
   --help, -h              show help (default: false)
   --version, -V           print only the version (default: false)
S
Suave Su 已提交
42 43 44 45 46

COPYRIGHT:
   AGPLv3
```

C
Changjian Gao 已提交
47
Usage: `juicefs [global options] command [command options] [arguments...]`
S
Suave Su 已提交
48 49 50 51 52 53 54 55 56 57 58

Add `-h` or `--help` after all commands, getting arguments list and help information.

***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 format

### Description

59
Format a volume. It's the first step for initializing a new file system volume.
S
Suave Su 已提交
60 61 62 63 64 65 66 67 68

### Synopsis

```
juicefs format [command options] REDIS-URL NAME
```

### Options

69
`--block-size value`\
S
Suave Su 已提交
70 71
size of block in KiB (default: 4096)

72
`--compress value`\
73
compression algorithm (lz4, zstd, none) (default: "none")
S
Suave Su 已提交
74

D
Davies Liu 已提交
75 76 77 78 79 80
`--capacity value`\
the limit for space in GiB (default: unlimited)

`--inodes value`\
the limit for number of inodes (default: unlimited)

81 82 83
`--shards value`\
store the blocks into N buckets by hash of key (default: 0)

84
`--storage value`\
S
Suave Su 已提交
85 86
Object storage type (e.g. s3, gcs, oss, cos) (default: "file")

87
`--bucket value`\
88
A bucket URL to store data (default: `"$HOME/.juicefs/local"` or `"/var/jfs"`)
S
Suave Su 已提交
89

90 91
`--access-key value`\
Access key for object storage (env `ACCESS_KEY`)
S
Suave Su 已提交
92

93 94
`--secret-key value`\
Secret key for object storage (env `SECRET_KEY`)
S
Suave Su 已提交
95

96 97 98
`--encrypt-rsa-key value`\
A path to RSA private key (PEM)

99
`--force`\
S
Suave Su 已提交
100 101
overwrite existing format (default: false)

102 103 104
`--no-update`\
don't update existing volume (default: false)

S
Suave Su 已提交
105 106 107 108
## juicefs mount

### Description

109
Mount a volume. The volume shoud be formatted first.
S
Suave Su 已提交
110 111 112 113 114 115 116 117 118

### Synopsis

```
juicefs mount [command options] REDIS-URL MOUNTPOINT
```

### Options

119 120 121 122 123 124
`--metrics value`\
address to export metrics (default: "127.0.0.1:9567")

`--no-usage-report`\
do not send usage report (default: false)

125
`-d, --background`\
S
Suave Su 已提交
126 127
run in background (default: false)

128
`--no-syslog`\
S
Suave Su 已提交
129 130
disable syslog (default: false)

131
`-o value`\
132
other FUSE options (see [this document](fuse_mount_options.md) for more information)
S
Suave Su 已提交
133

134
`--attr-cache value`\
S
Suave Su 已提交
135 136
attributes cache timeout in seconds (default: 1)

137
`--entry-cache value`\
S
Suave Su 已提交
138 139
file entry cache timeout in seconds (default: 1)

140
`--dir-entry-cache value`\
S
Suave Su 已提交
141 142
dir entry cache timeout in seconds (default: 1)

143
`--enable-xattr`\
S
Suave Su 已提交
144 145
enable extended attributes (xattr) (default: false)

D
Davies Liu 已提交
146 147 148
`--read-only`\
allow lookup/read operations only (default: false)

149
`--get-timeout value`\
S
Suave Su 已提交
150 151
the max number of seconds to download an object (default: 60)

152
`--put-timeout value`\
S
Suave Su 已提交
153 154
the max number of seconds to upload an object (default: 60)

155
`--io-retries value`\
S
Suave Su 已提交
156 157
number of retries after network failure (default: 30)

158
`--max-uploads value`\
S
Suave Su 已提交
159 160
number of connections to upload (default: 20)

161 162
`--buffer-size value`\
total read/write buffering in MiB (default: 300)
S
Suave Su 已提交
163

164
`--prefetch value`\
165
prefetch N blocks in parallel (default: 1)
S
Suave Su 已提交
166

167
`--writeback`\
C
Changjian Gao 已提交
168
upload objects in background (default: false)
S
Suave Su 已提交
169

170
`--cache-dir value`\
171
directory paths of local cache, use colon to separate multiple paths (default: `"$HOME/.juicefs/cache"` or `"/var/jfsCache"`)
S
Suave Su 已提交
172

173
`--cache-size value`\
S
Suave Su 已提交
174 175
size of cached objects in MiB (default: 1024)

176
`--free-space-ratio value`\
S
Suave Su 已提交
177 178
min free space (ratio) (default: 0.1)

179
`--cache-partial-only`\
S
Suave Su 已提交
180 181
cache only random/small read (default: false)

D
Davies Liu 已提交
182 183 184 185
## juicefs umount

### Description

186
Unmount a volume.
D
Davies Liu 已提交
187 188 189 190 191 192 193 194 195 196

### Synopsis

```
juicefs umount [options] MOUNTPOINT
```

### Options

`-f, --force`\
197
unmount a busy mount point by force (default: false)
D
Davies Liu 已提交
198

C
Changjian Gao 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
## juicefs gateway

### Description

S3-compatible gateway.

### Synopsis

```
juicefs gateway [command options] REDIS-URL ADDRESS
```

### Options

`--get-timeout value`\
the max number of seconds to download an object (default: 60)

`--put-timeout value`\
the max number of seconds to upload an object (default: 60)

`--io-retries value`\
number of retries after network failure (default: 30)

`--max-uploads value`\
number of connections to upload (default: 20)

`--buffer-size value`\
total read/write buffering in MiB (default: 300)

`--prefetch value`\
prefetch N blocks in parallel (default: 3)

`--writeback`\
upload objects in background (default: false)

`--cache-dir value`\
directory paths of local cache, use colon to separate multiple paths (default: `"$HOME/.juicefs/cache"` or `/var/jfsCache`)

`--cache-size value`\
size of cached objects in MiB (default: 1024)

`--free-space-ratio value`\
min free space (ratio) (default: 0.1)

`--cache-partial-only`\
cache only random/small read (default: false)

`--access-log value`\
path for JuiceFS access log

`--no-usage-report`\
do not send usage report (default: false)

`--no-banner`\
disable MinIO startup information (default: false)

255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
## juicefs sync

### Description

Sync between two storage.

### Synopsis

```
juicefs sync [command options] SRC DST
```

### Options

`--start KEY, -s KEY`\
the first KEY to sync

`--end KEY, -e KEY`\
the last KEY to sync

`--threads value, -p value`\
number of concurrent threads (default: 10)

`--http-port PORT`\
HTTP PORT to listen to (default: 6070)

`--update, -u`\
update existing file if the source is newer (default: false)

`--force-update, -f`\
always update existing file (default: false)

`--perms`\
preserve permissions (default: false)

`--dirs`\
Sync directories or holders (default: false)

`--dry`\
don't copy file (default: false)

`--delete-src, --deleteSrc`\
delete objects from source after synced (default: false)

`--delete-dst, --deleteDst`\
delete extraneous objects from destination (default: false)

`--exclude PATTERN`\
exclude keys containing PATTERN (POSIX regular expressions)

`--include PATTERN`\
only include keys containing PATTERN (POSIX regular expressions)

`--manager value`\
manager address

`--worker value`\
hosts (seperated by comma) to launch worker

`--bwlimit value`\
limit bandwidth in Mbps (0 means unlimited) (default: 0)

`--no-https`\
do not use HTTPS (default: false)
D
Davies Liu 已提交
319

D
Davies Liu 已提交
320 321 322 323 324 325 326 327 328 329 330 331
## juicefs rmr

### Description

Remove all files in directories recursively.

### Synopsis

```
juicefs rmr PATH ...
```

332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
## juicefs info

### Description

Show internal information for given paths or inodes.

### Synopsis

```
juicefs info [command options] PATH or INODE
```

### Options

`--inode, -i`\
347
use inode instead of path (current dir should be inside JuiceFS) (default: false)
348 349


350
## juicefs bench
S
Suave Su 已提交
351 352 353 354 355 356 357 358

### Description

Run benchmark, include read/write/stat big and small files.

### Synopsis

```
359
juicefs bench [command options] PATH
S
Suave Su 已提交
360 361 362 363
```

### Options

364
`--block-size value`\
S
Suave Su 已提交
365 366
block size in MiB (default: 1)

367
`--big-file-size value`\
S
Suave Su 已提交
368 369
size of big file in MiB (default: 1024)

370
`--small-file-size value`\
S
Suave Su 已提交
371 372
size of small file in MiB (default: 0.1)

373
`--small-file-count value`\
374
number of small files (default: 100)
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392

## juicefs gc

### Description

Collect any leaked objects.

### Synopsis

```
juicefs gc [command options] REDIS-URL
```

### Options

`--delete`\
deleted leaked objects (default: false)

D
Davies Liu 已提交
393 394 395
`--compact`\
compact all chunks with more than 1 slices (default: false).

396
`--threads value`\
D
Davies Liu 已提交
397
number threads to delete leaked objects (default: 10)
398 399 400 401 402 403 404 405 406 407 408 409

## juicefs fsck

### Description

Check consistency of file system.

### Synopsis

```
juicefs fsck [command options] REDIS-URL
```
S
Sandy Xu 已提交
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435

## juicefs profile

### Description

Analyze access log (Experimental).

### Synopsis

```
juicefs profile [command options] MOUNTPOINT/LOGFILE
```

### Options

`--uid value, -u value`\
track only specified UIDs(separated by comma ,)

`--gid value, -g value`\
track only specified GIDs(separated by comma ,)

`--pid value, -p value`\
track only specified PIDs(separated by comma ,)

`--interval value`\
flush interval in seconds (default: 2)
436 437 438 439 440 441 442 443 444 445 446 447 448

## juicefs status

### Description

show status of JuiceFS

### Synopsis

```
juicefs status [command options] REDIS-URL
```

449 450 451 452 453
### Options

`--session value, -s value`\
show detailed information (sustained inodes, locks) of the specified session (sid) (default: 0)

454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
## juicefs warmup

### Description

build cache for target directories/files

### Synopsis

```
juicefs warmup [command options] [PATH ...]
```

### Options

`--file value, -f value`\
file containing a list of paths

`--threads value, -p value`\
number of concurrent workers (default: 50)

`--background, -b`\
run in background (default: false)