All Products
Search
Document Center

Object Storage Service:Common options

Last Updated:May 15, 2024

You can use the -h option to check options that are available in ossfs.

Command syntax

./ossfs -h

You must use this command in the directory where ossfs is located. The default directory is /usr/local/bin/.

Option formats and examples

ossfs is implemented based on Filesystem in Userspace (FUSE) and also supports FUSE options. When you mount a bucket, you can specify different startup options. You must specify an option in the following format:

-o option_name[=option_value]  or  -ooption_name[=option_value]

The following sample command provides an example on how to specify the user ID (UID) and group ID (GID) in a bucket mount command:

ossfs bucket_name mount_point -ourl=endpoint -ouid=uid -ogid=gid

This part describes common ossfs options.

  • url: specifies the endpoint used to access a bucket. The option follows the url=endpoint format. The default request protocol is HTTP.

    Example:

    -ourl=oss-cn-hangzhou.aliyuncs.com
    -ourl=http://oss-cn-hangzhou.aliyuncs.com
    -ourl=https://oss-cn-hangzhou.aliyuncs.com
  • passwd_file: specifies the file that stores the AccessKey pair used to access a bucket. Default value: /etc/passwd-ossfs. Make sure that the permissions on the file are correctly configured. If the file is /etc/passwd-ossfs, you can set the permissions to 640. If the file is not /etc/passwd-ossfs, you must set the permissions to 600. The content of the AccessKey pair file follows the ${bucket}:${access-key-id}:{access-key-secret} format.

    Example:

    echo bucket-test:LTAIbZcdVCmQ****:MOk8x0y9hxQ31coh7A5e2MZEUz**** > /etc/passwd-ossfs
    chmod 640 /etc/passwd-ossfs
    
    echo bucket-test:LTAIbZcdVCmQ****:MOk8x0y9hxQ31coh7A5e2MZEUz**** > /passwd-path/passwd-ossfs
    chmod 600 /passwd-path/passwd-ossfs
    
    -opasswd_file=/passwd-path/passwd-ossfs
  • max_stat_cache_size: specifies the maximum number of objects whose metadata can be cached. Default value: 1000. When a directory contains a large number of objects, you can adjust this option to accelerate object listing when you run the ls command to list objects. To disable metadata caching, you can set this option to 0.

  • allow_other: authorizes other users to access the directory to which the bucket is mounted, but not the objects in the directory. You can run the chmod command to modify the permissions on the objects in the directory. The option does not require a value. To grant the permissions to other users, specify the -oallow_other option.

  • dbglevel: specifies the log level. Valid values: critical, error, warn, info, and debug. Default value: critical. For example, if you want to collect info logs, use the -odbglevel=info option. Logs are written to system logs. For example, logs are written to /var/log/messages in CentOS.

  • -f: runs ossfs as a foreground program instead of a daemon. In this case, logs are displayed on the terminal. In most cases, this option is used for debugging.

  • -d: enables logging. This option is also used in fuse. In ossfs, this option is equivalent to -odbglevel=info.

Options

Unless otherwise stated, all options are in the -ooption_name=option_value or -o option_name=option_value format.

  • ossfs options

    Option

    Description

    retries

    Specifies the number of retry attempts upon a request failure. Default value: 2.

    storage_class

    Specifies the storage class of the object to upload to OSS. Default value: Standard. Valid values:

    • Standard

    • IA

    • Archive

    For more information about storage classes, see Overview.

    public_bucket

    Specifies whether to anonymously access the bucket. This option applies only to buckets whose ACL is public-read-write. Valid values:

    • 0 (default): accesses the bucket in authenticated mode.

    • 1: accesses the bucket in anonymous mode.

    passwd_file

    Specifies the file that stores the AccessKey pair used to access a bucket. Default value: /etc/passwd-ossfs.

    connect_timeout

    Specifies the timeout period in seconds for connections. Default value: 300.

    readwrite_timeout

    Specifies the timeout period in seconds for read or write requests. Default value: 60.

    max_stat_cache_size

    Specifies the maximum number of objects whose metadata can be cached. Default value: 1000. The metadata of 1,000 objects consumes approximately 4 MB of storage.

    stat_cache_expire

    Specifies the expiration time in seconds for the object metadata cache. By default, the metadata cache does not expire.

    no_check_certificate

    Specifies that the server certificates are not validated. This option takes effect only when the request protocol is HTTPS. By default, certificate validation is enabled. This option does not require a value. To disable certificate validation, specify the -ono_check_certificate option.

    multireq_max

    Specifies the maximum number of concurrent requests to access object metadata during object listing. Default value: 20.

    parallel_count

    Specifies the number of parts that can be concurrently uploaded when multipart upload is used to upload a large object. Default value: 5.

    multipart_size

    Specifies the part size in MB when multipart upload is used to upload data. Default value: 10. This option limits the maximum size of the object that you can upload. When multipart upload is used, the maximum number of parts that an object can be split into is 10,000. By default, the maximum size of the object that can be uploaded is 100 GB. You can adjust the value of this option to upload a larger object.

    url

    Specifies the endpoint of the bucket to access.

    mp_umask

    Specifies the permission mask of the mount point. This option takes effect only when the allow_other option is specified. Default value: 000. You use the option in the same way you use the umask command. For example, you can configure -oallow_other -omp_umask=007 to set the permissions on the mount point to 770, and configure -oallow_other -omp_umask=077 to set the permissions on the mount point to 700.

    enable_content_md5

    Specifies whether to configure the CONTENT_MD5 header for the object upload. By default, this header is not configured. If you want to configure the Content-MD5 header, add the -oenable_content_md5 option.

    ram_role

    Uses the RAM role to access OSS. When you access OSS by using the RAM role, the AccessKey ID and AccessKey secret in the AccessKey pair file are ignored.

    listobjectsv2

    Lists objects. When versioning is enabled for the bucket, we recommend that you use the -olistobjectsv2 option to list objects.

    notsup_compat_dir

    Disables support for other directory types. By default, ossfs recognizes dir/, dir, and dir_$folder$ as directories.

    If you want ossfs to recognize only dir/ as directories to reduce the number of request interactions with the server, specify the -onotsup_compat_dir option.

    ensure_diskfree

    Specifies the available storage capacity of a disk that can be reserved by ossfs. To improve performance, ossfs uses the storage capacity of a disk to save temporary data uploaded or downloaded by default. You can use this option to configure the available storage capacity of a disk that can be reserved by ossfs. Unit: MB. For example, if you want ossfs to reserve 1,024 MB of storage capacity of a disk, specify the -oensure_diskfree=1024 option.

    dbglevel

    Specifies the log level. Default value: critical. Valid values:

    • critical

    • error

    • warn

    • info

    • debug

    curldbg

    Specifies whether to enable libcurl logging. By default, libcurl logging is disabled. To obtain libcurl logs, use the -ocurldbg option.

  • FUSE options

    Option

    Description

    allow_other

    Modifies the permissions on the mount point to allow access by all users. By default, only the root user can configure this option. This option does not require a value. To allow access by all users, specify the -oallow_other option.

    uid

    Specifies the UID of the owner of a directory.

    gid

    Specifies the GID of the owner of a directory.