How does ossfs upload a local file?
If you are confused about how ossfs uploads a local file, you can refer to this topic to be familiar with the mechanism and process of ossfs file upload in details.
Workflow
-
Create or open a local file: Create a local file by calling the POSIX create operation or open an existing file by calling the POSIX open operation. In this case, ossfs creates a cache file on the local disk.
-
Write data to the cache file: Continuously write data to the cache file on the local disk by calling the POSIX write operation.
-
Upload the cache file to OSS: Close the cache file by calling the POSIX close operation and upload the cache file to the bucket by calling an OSS API operation.
The following table describes the differences between creating and closing the cache file in the default mode and cache mode
|
Operation |
Default mode |
Cache mode |
|
Create a local file |
Create a temporary local file invisible to the user in the temporary directory as a cache file. The default temporary directory is |
Specify the |
|
Close a local file |
The temporary local file in the temporary directory is deleted. |
By default, the cache file in the cache directory is not deleted. If the local cache space is insufficient, the cache file is deleted. |
How ossfs works
References
-
If you write data to the local file after the file is created, you cannot view the data in the bucket.
Files are uploaded in a centralized manner only when the files are closed. You cannot view the files when you write data to the files.
-
Method to resolve the error that the system disk has no available space:
By default, data is written to the
/tmpdirectory in the system disk. You can specify another directory by specifying the-otmpdirparameter. For more information, see Data cache.