All Products
Search
Document Center

Object Storage Service:View options

Last Updated:Apr 16, 2025

You can view options supported by ossfs by using the -h option.

Syntaxes of commands

./ossfs -h

You need to run this command in the directory where ossfs is located. The default directory is /usr/local/bin/. The directory may vary based on your actual installation environment.

Common options

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. The options can be in one of the following formats:

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

For example, you can use the following option to specify the uid and gid parameters when you mount a bucket:

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

The following section describes common ossfs options:

Option name

Description

url

Specifies the endpoint of the bucket to access, in the format of url=endpoint. The default request protocol is HTTP.

Examples:

-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 of the bucket. Default value: /etc/passwd-ossfs. You must set the correct permissions for the file. When the AccessKey pair file is /etc/passwd-ossfs, you can set the permission to 640. When the AccessKey pair file is not /etc/passwd-ossfs, you must set the permission to 600. The content of the AccessKey pair file is in the format of ${bucket}:${access-key-id}:{access-key-secret}.

Examples:

# Write the AccessKey pair to the /etc/passwd-ossfs file and set the file permission to 640.
echo bucket-test:yourAccessKeyID:yourAccessKeySecret > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs

# Write the AccessKey pair to the /passwd-path/passwd-ossfs file and set the file permission to 600.
echo bucket-test:yourAccessKeyID:yourAccessKeySecret > /passwd-path/passwd-ossfs
chmod 600 /passwd-path/passwd-ossfs

# Set the opasswd_file variable to /passwd-path/passwd-ossfs.
-opasswd_file=/passwd-path/passwd-ossfs

max_stat_cache_size

Specifies the maximum number of files whose metadata can be stored in metadata caches. Default value: 100,000. If a directory contains many objects, you can adjust this option to improve the object listing performance of the Is command. To disable metadata caching, you can set this option to 0.

ossfs bucket_name mount_point -omax_stat_cache_size=0

allow_other

Modifies the permissions of the mount point to allow all users to access the mount directory, but not the files in the directory. You must separately set the permissions for the files in the directory. To modify the permissions of individual files, use the chmod command. To modify all files to have the same permissions, configure the umask option. By default, only the root user can set the -oallow_other option, and this option has no value. When you use this option, directly add the -oallow_other option.

ossfs bucket_name mount_point -ourl=endpoint -oallow_other

dbglevel

Specify the log level. Valid values: critical, error, warn, info, and debug. Default value: critical. For example, to enable info-level logging, add the -odbglevel=info option. Log information is written to the system log. For example, in CentOS, log information is written to /var/log/messages.

ossfs bucket_name mount_point -odbglevel=info

f

Specifies that ossfs is run as a foreground program instead of a daemon. In this case, logs are displayed on the terminal. This parameter is typically used in debugging.

ossfs bucket_name mount_point -f

d

Specifies that logging is enabled. This option is also used in FUSE. In ossfs, this option is equivalent to -odbglevel=info.

ossfs bucket_name mount_point -d

Option list

In most cases, an option is in the format of -ooption_name=option_value or -o option_name=option_value.

Note

The following option descriptions apply to ossfs 1.91.2 and later. Some options may not be supported or the default parameters may change in other versions. You can use the -h option to check the supported options. 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/. The directory may vary based on your actual installation environment.

  • ossfs options

    Option name

    Description

    retries

    Specifies the number of retry attempts that you want the system to perform when a request fails. Default value: 2.

    storage_class

    Specifies the storage class of the object that you want to upload to OSS. Valid values:

    • Standard (default): Standard

    • IA: Infrequent Access

    • Archive: Archive Storage

    For more information about storage classes, see Storage classes.

    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): Anonymous access is not used.

    • 1: Anonymous access is used.

    passwd_file

    Specifies the file that stores the AccessKey pair of the 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 space is required to cache the metadata of 100,000 objects.

    readdir_optimize

    Specifies whether to use cache optimization. By default, ossfs data cache is disabled.

    After you add this mount option, ossfs does not send HeadObject requests to obtain file metadata such as gid and uid when you run the ls command. HeadObject requests are sent only when you access files whose size is 0. However, a specific number of HeadObject requests may still be sent due to reasons such as permission checks. Specify the parameter based on the application characteristics. To enable this option, add -oreaddir_optimize when you mount a bucket.

    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 has no value. When you use this option, directly add 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 large objects. Default value: 5.

    multipart_size

    Specifies the part size in MB when multipart upload is used to upload data. Default value: 10. This parameter 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 that you want to use to access a bucket.

    umask

    Specifies the permission mask of files or folders in the directory to which the bucket is mounted.

    For example, to set the permissions of files or folders in the mount directory to 770, add -oumask=007. To set the permissions of files or folders in the mount directory to 700, add -oumask=077.

    Note
    • Version 1.91.*: The default permission of files is 0640, and the default permission of folders is 0750.

    • Version 1.80.*: The default permission of files and folders is 0777.

    enable_content_md5

    Specifies whether to set CONTENT_MD5 for upload operations. By default, Content-MD5 is not set. If you want to set Content-MD5, 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

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

    notsup_compat_dir

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

    If you want to restrict ossfs to identify only dir/ as a directory to reduce the interaction requests between ossfs and the server, you need to use 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 disk space that you want to reserve. Unit: MB. For example, to set ossfs to reserve 1,024 MB of available disk space, use -oensure_diskfree=1024.

    direct_read

    By default, ossfs uses the disk storage capacity to store temporary data uploaded or downloaded. You can specify this option to directly read data from OSS instead of the local disk. By default, this option is not set. You can use -odirect_read to enable the direct read mode.

    Note

    Direct reads are interrupted when a write, rename, or truncate operation is performed on the object being read. In this case, the object exits the direct read mode and must be reopened.

    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 direct read mode is enabled, which means that the -odirect_read option is used.

    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 direct read mode is enabled, which means that the -odirect_read option is used.

    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 direct read mode is enabled, which means that the -odirect_read option is used.

    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 direct read mode is enabled, which means that the -odirect_read option is used.

    dbglevel

    Specify the log level. Valid values:

    • critical (default)

    • error

    • warn

    • info

    • debug

    curldbg

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

  • Data cache options

    Note

    For more information about the data cache principle, see Data cache.

    Option name

    Description

    use_cache

    Enables ossfs data cache and specifies the path of data cache. By default, ossfs data cache is disabled. You can specify this option to configure the cache path.

    For example, you can add -ouse_cache=path when you mount a bucket to use data cache and specify the data cache path as path. You can specify the path based on your business requirements. Example: /tmp/your_foldername.

    ensure_diskfree

    The size of the reserved disk capacity, which is used to prevent the disk capacity from being fully occupied and affecting other applications to write data. By default, the disk capacity is not reserved. You can use this option to configure the available disk space that you want to reserve. Unit: MB.

    For example, to set ossfs to reserve 1,024 MB of available disk space, add -oensure_diskfree=1024 when you mount a bucket.

    del_cache

    Specifies whether to delete the local cache. By default, the local cache is not deleted. You can specify this option to configure ossfs to clean up the local data cache.

    For example, you can add the -odel_cache option when you mount a bucket. In this case, ossfs cleans up the cache files in the folder specified by use_cache when you mount or unmount the bucket.

    max_dirty_data

    When the size of a file to write exceeds this value, the intermediate temporary file is uploaded in advance without closing the file. Default value: 5120 MB.

    For example, to set the system to upload a file in advance when the size of the file to write exceeds 2,000 MB, add -omax_dirty_data=2000 when you mount a bucket. If you enable versioning for OSS, multiple versions of intermediate files may be generated when you write large files. We recommend that you set this option to a large value.

    tmpdir

    By default, data is temporarily cached in the /tmp directory of the system disk. You can specify this option to configure the default temporary cache path. This option cannot be used together with the use_cache option.

    For example, you can add -otmpdir=path when you mount a bucket to configure the default temporary data cache path as path. You can specify the path based on your business requirements. Example: /data/your_foldername.

    free_space_ratio

    The minimum remaining disk space ratio that you want to reserve.

    For example, when the disk space is 50 GB, if you configure -ofree_space_ratio=20, 50 GB × 20% = 10 GB of space is reserved.

  • fuse options

    Option name

    Description

    allow_other

    Modifies the permissions of the mount point to allow all users to access the mount directory, but not the files in the directory. You must separately set the permissions for the files in the directory. To modify the permissions of individual files, use the chmod command. To modify all files to have the same permissions, configure the umask option. By default, only the root user can set the -oallow_other option, and this option has no value. When you use this option, directly add the -oallow_other option.

    uid

    Specifies the user ID (UID) of the owner of a directory.

    gid

    Specifies the group ID (GID) of the owner of a directory.