What's new

Setting mount options for USB drive filesystem

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!


Very Senior Member
I would like to set mount options for USB drive filesystems.
I tried setting "usb_ext_opt" to "data=journal,discard" according to the snippet of rc/usb.c below but it did not take effect and the nvram variable is now empty.
Does anyone know the sprintf syntax below? Perhaps I have it wrong.
        if (strcmp(type, "swap") == 0 || strcmp(type, "mbr") == 0) {
            /* not a mountable partition */
            flags = 0;
        else if (!strcmp(type, "unknown")) {
            /* Usually should be EFI, and not a mountable partition */
            flags = 0;
        else if(!strncmp(type, "ext", 3)){
            sprintf(options, "user_xattr");

            if (nvram_invmatch("usb_ext_opt", ""))
                sprintf(options + strlen(options), "%s%s", options[0] ? "," : "", nvram_safe_get("usb_ext_opt"));
        else if (strcmp(type, "vfat") == 0) {
            sprintf(options, "umask=0000");

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!