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.
Option | Description |
url | The endpoint that you want to use to access the bucket. Format: Example:
|
passwd_file | The file that stores the AccessKey pair used to access a bucket. Default value: /etc/passwd-ossfs. The permission of the file must be correctly configured. If the file is /etc/passwd-ossfs, the permission can be set to 640. If the file is not /etc/passwd-ossfs, the permission must be set to 600. The content of the file is in the Example:
|
max_stat_cache_size | The maximum number of files whose metadata can be stored in metadata caches. By default, the metadata of up to 100,000 objects can be cached. If a directory contains a large number of objects, you can modify this option to improve the object listing performance of the Is command. To disable metadata caching, you can set this option to 0.
|
allow_other | Specifies that other users are authorized 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. You do not need to specify a value for the option. To authorize other users, add the -oallow_other option.
|
dbglevel | 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, in CentOS, logs are written to /var/log/messages.
|
-f | Specifies that ossfs is run 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 | Specifies that logging is enabled. This option is also used in FUSE. In ossfs, this option is equivalent to the -odbglevel=info setting.
|
Options
Unless otherwise stated, all options are in the -ooption_name=option_value
or -o option_name=option_value
format.
The following table describes the options that are supported by ossfs 1.91.2 and later. A different ossfs version may not support specific options or has different default values for the options. You can use the -h option to check the options that are supported by the ossfs version that you use. To check the ossfs version that you use, run the ./ossfs --version command in the directory in which ossfs is located. The default directory is /usr/local/bin/. The directory varies based on the actual installation environment.
ossfs options
Option
Description
retries
The number of retries when a request fails. Default value: 2.
storage_class
The storage class of the object that you want 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
The file that stores the AccessKey pair used to access a bucket. Default value: /etc/passwd-ossfs.
connect_timeout
The timeout period in seconds for connections. Default value: 300.
readwrite_timeout
The timeout period in seconds for reading or writing a request. Default value: 120.
max_stat_cache_size
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.
stat_cache_expire
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. You do not need to specify a value for the option. To disable certificate validation, add the -ono_check_certificate option.
multireq_max
The maximum number of concurrent requests to access object metadata during object listing. Default value: 20.
parallel_count
The number of parts that can be concurrently uploaded when multipart upload is used to upload a large object. Default value: 5.
multipart_size
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 change the value of this option to upload a larger object.
url
The endpoint that you want to use to access the bucket.
umask
The permission mask of files/folders on the mount point.
For example, you can use -oumask=007 to set the permissions of files/folders on the mount point to 770, or use -oumask=007 to set the permissions of files/folders 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, specify the -oenable_content_md5 option.
ram_role
Specifies that a RAM role is used 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
The method used to list objects. When versioning is enabled for the bucket, we recommend that you use the -olistobjectsv2 option to list objects.
notsup_compat_dir
The supported directory types. By default, ossfs recognizes
dir/
,dir
, anddir_$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
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 store 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
Enables the direct read mode. 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 instead of the local disk. This option is disabled by default. You can use -odirect_read to enable the direct read mode.
NoteA 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
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
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
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
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
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 obtain libcurl logs, specify the -ocurldbg option.
Data cache options
NoteOption
Description
use_cache
Enables ossfs data cache and specifies the path of data cache. By default, ossfs data cache is disabled.
For example, if you specify
-ouse_cache=path
, ossfs data cache is enabled and the path of the data cache is set to path. You can specify the path based on your business requirements. Example: /tmp/your_foldername.ensure_diskfree
The size of disk capacity reserved to prevent the disk capacity from being fully occupied and affecting other applications to write data. By default, the disk capacity is not reserved. Unit: MB.
For example, if you want to set the ossfs reserved disk capacity to 1024 MB, you can specify
-oensure_diskfree=1024
.del_cache
Specifies whether to delete the local cache. By default, the local cache is not deleted.
For example, if you specify
-odel_cache
, ossfs deletes the cached files in the directory specified by theuse_cache
option.max_dirty_data
Specifies the size threshold to upload a file. If the size of the file is larger than the value, the file is uploaded even when the file is not closed. Unit: MB.
For example, if you want to specify that a file greater than 2,000 MB in size is uploaded even when the file is not closed, you can specify
-omax_dirty_data=2000
.tmpdir
By default, data is cached in the /tmp directory in the system disk. This option cannot be used together with -use_cache.
For example, if you specify -otmpdir=path, the default path of temporary data cache is set to path. You can specify the path based on actual requirements. Example: /data/your_foldername.
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. You do not need to specify a value for the option. To allow access by all users, add the -oallow_other option.
uid
The UID of the owner of a directory.
gid
The GID of the owner of a directory.