You can use the -h option to view the parameters that ossfs supports.
Command format
./ossfs -hRun this command from the directory where the ossfs program is located. The default directory is /usr/local/bin/. The actual directory depends on your installation environment.
Common options
ossfs is based on the Filesystem in Userspace (FUSE). Therefore, ossfs supports FUSE options in addition to its own options. When you mount a bucket, you can set different startup options as needed. The option format is as follows:
-o option_name[=option_value] or -ooption_name[=option_value]For example, to specify the uid and gid parameters during mounting:
ossfs bucket_name mount_point -ourl=endpoint -ouid=uid -ogid=gidThe common ossfs options are as follows:
Option | Description |
url | Specifies the endpoint of the bucket. The format is Examples: |
passwd_file | Specifies the file that stores the AccessKey pair for the bucket. The default file is /etc/passwd-ossfs. You must set the file permissions correctly. If the key file is /etc/passwd-ossfs, set the permissions to 640. If the key file is not /etc/passwd-ossfs, set the permissions to 600. The format of the key file is Examples: |
max_stat_cache_size | Specifies the number of file metadata entries that can be cached. The default value is 100,000. If a directory contains many files, you can increase this value to speed up the ls command. To disable metadata caching, set this option to 0. |
allow_other | Modifies the permissions of the mount target to allow all users to access the mount directory. This does not include the files in the directory. You must set the permissions for files in the directory separately. To modify the permissions of a specific file, use the |
dbglevel | Sets the log level. Supported levels are critical, error, warn, info, and debug. The default value is critical. For example, to enable the info log level, add the -odbglevel=info option. Log information is written to the system log. For example, on a CentOS system, logs are written to /var/log/messages. |
f | Runs ossfs in the foreground instead of as a daemon process. In foreground mode, logs are output to the terminal screen. This parameter is typically used for debugging. |
d | Enables logging. This option is also passed to FUSE. In ossfs, this option is equivalent to -odbglevel=info. |
List of options
In most cases, the option format is -ooption_name=option_value or -o option_name=option_value.
The following option descriptions apply to ossfs 1.91.2 and later. Some options may not be supported or may have different default values in other versions. To view the ossfs version, go to the directory where the ossfs program is located and run the ./ossfs --version command. The default directory for the ossfs program is /usr/local/bin/. The actual directory depends on your installation environment.
ossfs options
Option
Description
retries
Specifies the number of retries after a request fails. The default value is 2.
storage_class
Specifies the storage class for files written to OSS. The valid values are:
Standard (default): Standard
IA: Infrequent Access
Archive: Archive Storage
For more information about storage classes, see Storage classes.
public_bucket
Specifies whether to access the bucket anonymously. This option is valid only for buckets whose access control list (ACL) is public-read-write. The valid values are:
0 (default): Do not access the bucket anonymously.
1: Access the bucket anonymously.
passwd_file
Specifies the file that stores the AccessKey pair for the bucket. The default file is /etc/passwd-ossfs.
connect_timeout
Specifies the connection timeout period in seconds. The default value is 300 seconds.
readwrite_timeout
Specifies the timeout period for read or write requests in seconds. The default value is 120 seconds.
max_stat_cache_size
Specifies the number of file metadata entries to cache. The default value is 100,000, which consumes about 40 MB of extra space.
readdir_optimize
Controls whether to use cache optimization. By default, this feature is disabled.
If you add this mount option, ossfs does not send HeadObject requests to obtain file metadata such as
gidanduidwhen you run the ls command. A HeadObject request is sent only when the size of the accessed file is 0. However, a number of HeadObject requests may still be generated due to permission checks and other reasons. Select this parameter based on your application attributes. To enable this feature, add-oreaddir_optimizewhen you mount the bucket.stat_cache_expire
Specifies the expiration time for the file metadata cache in seconds. The default value is 900 seconds.
no_check_certificate
Disables server-side certificate verification. This option is valid only when you use the HTTPS protocol. By default, certificate verification is enabled. This option has no value. To use it, simply add the -ono_check_certificate option.
multireq_max
Specifies the maximum number of concurrent requests to access file metadata when you list files. The default value is 20.
parallel_count
Specifies the number of concurrent parts when you upload a large file in multipart upload mode. The default value is 5.
multipart_size
Specifies the size of each part in MB for multipart uploads. The default value is 10. This parameter affects the maximum supported file size. The maximum number of parts for a multipart upload is 10,000. With the default value, the maximum supported file size is 100 GB. To support larger files, adjust this value as needed.
url
Specifies the endpoint of the bucket.
umask
Sets the permission mask for files and folders in the mount target.
For example, to set the permissions for files and folders in the mount target to 770, add -oumask=007. To set the permissions to 700, add -oumask=077.
NoteVersion 1.91.*: The default permission for files is 0640, and the default permission for folders is 0750.
Version 1.80.*: The default permission for both files and folders is 0777.
enable_content_md5
Specifies whether to set CONTENT_MD5 during an upload operation. By default, this is not set. To set Content-MD5, add the -oenable_content_md5 option.
ram_role
Uses a RAM role to access OSS. When you use this method to access OSS, the AccessKey ID and AccessKey secret in the key file are ignored.
listobjectsv2
If versioning is enabled for the bucket, use the -olistobjectsv2 option to list files.
notsup_compat_dir
Restricts incompatible directory types. By default, ossfs recognizes
dir/,dir, anddir_$folder$as directories.If you want to restrict ossfs to recognize only
dir/as a directory to reduce interactions between ossfs and the server, use the -onotsup_compat_dir option.direct_read
By default, ossfs uses disk space to save temporary data for uploads or downloads. You can set this option to read data directly from OSS without using local disk space. This option is not set by default. You can use -odirect_read to enable direct read mode.
NoteIf a write, rename, or truncate operation is detected on a file during a direct read, the file exits direct read mode until it is reopened.
direct_read_chunk_size
In direct read mode, specifies the amount of data to read from OSS in a single read request. The unit is MB. The default value is 4. The value ranges from 1 to 32.
This option takes effect only when direct read mode is enabled using the -odirect_read option.
direct_read_prefetch_thread
In direct read mode, ossfs performs pre-reads as background asynchronous tasks. This option specifies the maximum number of threads for prefetch requests at the same time. The default value is 64.
This option takes effect only when direct read mode is enabled using the -odirect_read option.
direct_read_prefetch_chunks
In direct read mode, specifies the number of chunks to prefetch into memory. This improves the performance of ossfs in sequential read scenarios. The default value is 32.
This option takes effect only when direct read mode is enabled using the -odirect_read option.
direct_read_prefetch_limit
In direct read mode, ossfs uses memory to cache data prefetched from OSS. This option limits the total amount of data that ossfs can prefetch. The unit is MB. The default value is 1024.
This option takes effect only when direct read mode is enabled using the -odirect_read option.
dbglevel
Sets the log level. The supported log levels are as follows:
critical (default)
error
warn
info
debug
curldbg
Enables libcurl logging. By default, this is disabled. To output libcurl logs, add the -ocurldbg option.
Data cache options
NoteFor more information about data caching principles, see Data caching.
Option
Description
use_cache
Enables data caching and specifies the data cache path. By default, this feature is disabled. Specify this option to configure the cache path.
For example, add
-ouse_cache=pathduring mounting to enable data caching and set the data cache path to path. Set path to the actual path, such as /tmp/your_foldername.ensure_diskfree
Controls the amount of reserved disk space. By default, no space is reserved. Use this option to set the amount of free disk space to reserve in MB. This prevents the disk from becoming full and affecting other applications.
For example, to ensure that at least 1024 MB of free disk space is available, add
-oensure_diskfree=1024during mounting.del_cache
Controls the deletion of the local cache. By default, the cache is not deleted. Set this option to configure ossfs to clear the local data cache.
For example, if you add the
-odel_cacheoption, ossfs clears the cache files in the folder specified byuse_cacheduring mount and umount operations.max_dirty_data
When the size of a file being written exceeds this value, the intermediate temporary file is uploaded before the file is closed. The default value is 5120 MB.
For example, to upload a file when its size exceeds 2000 MB, add
-omax_dirty_data=2000during mounting. If you enable versioning for OSS, writing a large file may generate intermediate files for multiple versions. Set this option to a large value.tmpdir
By default, data is temporarily cached in the /tmp directory on the system disk. You can specify this option to configure the default temporary cache path. This option cannot be used with the use_cache option.
For example, you can add -otmpdir=path during mounting to set the default temporary data cache path to path. Set path to the actual path, such as /data/your_foldername.
free_space_ratio
Controls the minimum percentage of free disk space to maintain after caching.
For example, if the disk space is 50 GB and you set this option to -ofree_space_ratio=20, 10 GB of space (50 GB × 20%) is reserved.
disable_noobj_cache
This option is added in ossfs 1.91.6. It disables or enables noobj metadata caching. If enabled, information is cached even if the file does not exist. The default value is false (enabled).
For example, you can add
-o disable_noobj_cacheduring mounting to disable noobj metadata caching. In ossfs 1.91.6 and later, noobj caching is used by default. To disable it, add this option.FUSE options
Option
Description
allow_other
Modifies the permissions of the mount target to allow all users to access the mount directory. This does not include the files in the directory. You must set the permissions for files in the directory separately. To modify the permissions of a specific file, use the
chmodcommand. To set the same permissions for all files, configure theumaskoption. By default, only the root user can set the-oallow_otheroption. The option has no value. To use it, simply add the-oallow_otheroption.uid
Specifies the user ID (UID) of the user who owns the folder.
gid
Specifies the group ID (GID) of the user who owns the folder.