Skip to content

fix: add missing boolean mount flags to fix --flag=value error#59

Open
yujunz wants to merge 1 commit intojuicedata:masterfrom
yujunz:fix-mount-flags
Open

fix: add missing boolean mount flags to fix --flag=value error#59
yujunz wants to merge 1 commit intojuicedata:masterfrom
yujunz:fix-mount-flags

Conversation

@yujunz
Copy link
Copy Markdown
Contributor

@yujunz yujunz commented Feb 26, 2026

Expand the mountFlags whitelist in both ceMount and eeMount functions to include all boolean flags from the JuiceFS mount command. This fixes the issue where boolean flags like --no-bgjob were incorrectly passed as --no-bgjob=true, causing JuiceFS to fail with "unknown option" error.

Fixes #58

@Dr-Shadow
Copy link
Copy Markdown

Is that AI code ?
It doesn't seem clean to me and that's not reflecting the latest flags on the juicefs mount command.

@yujunz
Copy link
Copy Markdown
Contributor Author

yujunz commented Feb 28, 2026

Yes, it is generated by claude given the issue as context. It seems getting the flags from document and juicefs mount --help from what I observed.

What is supposed to be the source of truth for latest flags?

@Dr-Shadow
Copy link
Copy Markdown

Dr-Shadow commented Mar 2, 2026

@yujunz, using AI to generate code for core logic like mount flags without verifying it against the actual source code is problematic.

Even if you used juicefs mount --help as a reference, you can see that some of these flags literally do not exist.

You should refrain from submitting AI-generated guesses. If you want to contribute, you must manually cross-reference the flags with the actual codebase to ensure they are handled correctly.

@yujunz
Copy link
Copy Markdown
Contributor Author

yujunz commented Mar 2, 2026

cross-reference the flags with the actual codebase

Good point. Please take another look after cross check (by AI 😊)

  • EE flag validation: The EE-specific flags (external, internal, gc, dry, flip, no-sync, allow-other, allow-root)
    were not validated against EE source code (not available). These were preserved from the original commit.
  • Linux-only flag: update-fstab only works on Linux per the source, but including it is harmless on other platforms
    (JuiceFS will ignore it).

Would you mind contributing to review the change?

@Dr-Shadow
Copy link
Copy Markdown

That's better but honestly I ditched the Docker plugin in favor of a systemd unit service for now since I had other issues.

For example if I want to reuse the same volume 4 times on different services, it mounts the volume 4 times (4 juiceFS processes with each one consuming its own RAM for caching).

I wanted to use --all-squash 1000:1000 as well and it was not supported.

I will open new issues to reflect the different problems I encountered and I would happily test it later.

The big problem with the docker volume plugin in its current state is that it won't translate the mount flags very well and the --flag=value is a very specific case (all-squash is another case).

So it would be probably better to allow another way to pass flags (for example a mountFlags attribute string which would be entirely passed to the mount command).

The problem you will have with the current method is that you will have to maintain the flags on each juiceFS release which can add flag parameters.

Before :

volumes:
  app_data:
    name: app_data
    driver: juicedata/juicefs:1.3.1
    driver_opts:
      name: "app_data"
      metaurl: "rediss://:${REDIS_PASSWORD:?}@${JUICEFS_ENDPOINT:?}:6379/1"
      storage: "minio"
      bucket: "https://${JUICEFS_ENDPOINT:?}/app_data"
      atime-mode: "noatime"
      attr-cache: "1"
      entry-cache: "1"
      dir-entry-cache: "1"
      cache-size: "1024"
      free-space-ratio: "0.1"
      buffer-size: "128"
      no-usage-report: "true"

After :

volumes:
  app_data:
    name: app_data
    driver: juicedata/juicefs:1.3.1
    driver_opts:
      name: "app_data"
      metaurl: "rediss://:${REDIS_PASSWORD:?}@${JUICEFS_ENDPOINT:?}:6379/1"
      storage: "minio"
      bucket: "https://${JUICEFS_ENDPOINT:?}/app_data"
      mountFlags: "--atime-mode noatime --no-bgjob --attr-cache 1 --entry-cache 1 --dir-entry-cache 1 --cache-size 1024 --free-space-ratio 0.1 --buffer-size 128 --no-usage-report"

Add formatFlags, authFlags, and mountFlags options to pass raw flags
directly to JuiceFS commands without plugin-level parsing. This allows:

- Using any JuiceFS flag (e.g., --all-squash 1000:1000)
- Avoiding maintenance burden of tracking JuiceFS flag changes
- Full flexibility for advanced users

Example:
  -o mountFlags="--all-squash 1000:1000 --cache-size 10G"

Also includes unit tests for flag building logic.

Co-Authored-By: Claude (aws/anthropic/claude-opus-4-5) <noreply@anthropic.com>
@yujunz yujunz force-pushed the fix-mount-flags branch from 49ca88f to 48c24de Compare March 3, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support all mount flags if applicable from the "Command Reference"

2 participants