All Products
Search
Document Center

Object Storage Service:Common options

Last Updated:Jun 03, 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. By default, the metadata of up to 100,000 objects can be cached. If a directory contains a large number of objects, you can adjust this option to improve object listing performance of the Is command. 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.

Note

The following table describes options that are available in ossfs 1.91.2. A different ossfs version may not support some of the options or has different default values for the options. You can use the -h option to check options that are available in the ossfs version that you use. To check the ossfs version that you use, run the ./ossfs --version command in the directory where ossfs is located. The default directory is /usr/local/bin/.

  • 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. Valid values:

    • Standard (default)

    • IA

    • Archive

    For more information about storage classes, see Overview.

    public_bucket

    Specifies whether to anonymously access the bucket. This option applies only to a bucket whose access control list (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: 120.

    max_stat_cache_size

    Specifies the maximum number of objects whose metadata can be cached. Default value: 100,000. Approximately 40 MB of storage is required to cache the metadata of 100,000 objects.

    stat_cache_expire

    Specifies the validity period of the object metadata cache. Unit: seconds. Default value: 900.

    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 this 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

    Restricts compatible directory types to dir/. 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.

    direct_read

    Specifies direct reads. By default, ossfs uses disk storage capacity to store temporary data uploaded or downloaded. You can specify this option to directly read data from OSS rather than from the local disk.

    Note

    A write, rename, or truncate operation on an object that is being directly read interrupts the direct read, until the object is opened again.

    direct_read_chunk_size

    Specifies the amount of data that can be directly read from OSS in a single read request. Unit: MB. Default value: 4. Valid values: 1 to 32.

    This option takes effect only when the -odirect_read option is specified.

    direct_read_prefetch_thread

    Specifies the maximum number of threads for pre-fetching data at the same time. In direct read mode, ossfs asynchronously pre-reads data in the background. Default value: 64.

    This option takes effect only when the -odirect_read option is specified.

    direct_read_prefetch_chunks

    Specifies the number of chunks that can be prefetched to the memory. This option can be used to optimize sequential read performance. Default value: 32.

    This option takes effect only when the -odirect_read option is specified.

    direct_read_prefetch_limit

    Specifies the total amount of data that can be prefetched. In direct read mode, ossfs caches pre-read data in the memory. Unit: MB. Default value: 1024.

    This option takes effect only when the -odirect_read option is specified.

    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.