Last updated: 2019-06-14 19:18:34PDF
FAQs About Features
How do I mount a bucket with a temporary key?
You can mount a bucket using a temporary key (STS) by following the steps below:
Step 1: Create a temporary key configuration file, such as /tmp/passwd-sts, for the COSFS command option -opasswd-file=[path] to specify the key configuration file. For more information about temporary keys, see Temporary Key Generation and Usage Guide. The following is an example of temporary key configuration file:
COSAccessKeyId=AKIDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX #The following are the Id, Key, and Token fields of the temporary key. COSSecretKey=GYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY COSAccessToken=109dbb14ca0c30ef4b7e2fc9612f26788cadbfac3 COSAccessTokenExpire=2017-08-29T20:30:00 #The temporary token's expiration time is the GMT time in a format as shown in the example.
COSFS will determine whether it needs to reload the configuration from the key file based on the time configured in COSAccessTokenExpire.
To prevent key leakage, you should set the permission of the key file to 600 in COSFS by running the following command:
chmod 600 /tmp/passwd-sts
Step 2: Run the COSFS command. Specify the role as sts using the command option -ocam_role=[role], and specify the key file's path using -opasswd_file=[path], as shown below:
cosfs example-1253972369 /mnt/cosfs -ourl=http://cos.ap-guangzhou.myqcloud.com -odbglevel=info -oallow_other -ocam_role=sts -opasswd_file=/tmp/passwd-sts
How do I check the mount parameter options and version number provided by COSFS?
You can check the parameter options provided by COSFS using the
cosfs --help command, and check the COSFS version number using
How do I view the logs generated by COSFS?
In CentOS, COSFS-generated logs are stored in /var/log/messages; in Ubuntu, these logs are stored in /var/log/syslog. If you have any problems during operation, send us the log for the corresponding time period.
How do I mount a directory under a bucket?
When running the mount command, you can specify a directory under the bucket. The command is as follows:
cosfs example-1253972369:/my-dir /mnt/cosfs -ourl=http://cos.ap-guangzhou.myqcloud.com -odbglevel=info
my-dir should begin with
For versions earlier than v1.0.5, the mount command is:
cosfs 1253972369:example:/my-dir /mnt/cosfs -ourl=http://cos.ap-guangzhou.myqcloud.com -odbglevel=info
How does a non-root user mount COSFS?
If you're a non-root user, it is recommended to create a .passwd-cosfs file in the personal Home directory, set the permission to 600, and then mount it using the mount command. In addition, you can specify the key file's path using the -opasswd_file=path option and set the permission to 600.
Does COSFS support HTTPS for mounting?
Yes. The parameter -ourl varies between HTTP and HTTPS as shown below:
For the system where the NSS library that libcurl depends on is 3.12.3 or above (check the NSS version using
curl -V command), you need to run the following command before you can mount the bucket based on HTTPS protocol:
echo "export NSS_STRICT_NOFORK=DISABLED" >> ~/.bashrc source ~/.bashrc
How do I set "auto mount upon startup" for COSFS?
Add the following content to the /etc/fstab file. The _netdev option specifies that only after the network is ready can the command be executed:
example-1253972369 /mnt/cosfs fuse _netdev,allow_other,url=http://cos.ap-guangzhou.myqcloud.com,dbglevel=info
How do I mount multiple buckets?
If you need to mount multiple buckets, write a text line for each bucket to be mounted in the /etc/passwd-cosfs configuration file, with the content of each line being same as that for a single bucket.
echo example-123456789:AKIDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:GYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY >> /etc/passwd-cosfs echo log-123456789:AKIDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:GYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY >> /etc/passwd-cosfs
How do I make the mounted directory accessible to other accounts on the server?
To make the mounted directory accessible to other accounts, specify
-oallow_other during mounting.
Are there any restrictions on the names of files created in a COSFS mounted directory?
In a COSFS mounted directory, you can create files with a name not containing
/ character. On a Unix-like system, the
/ character is the directory separator, so you cannot create a file with a name containing
/ in a COSFS mounted directory. In addition, when creating a file with a name containing special characters, be sure to prevent the special characters from being used by shell, because this can cause the failure of creation.
FAQs About Troubleshooting
During my use of COSFS, the message "unable to access MOUNTPOINT /path/to/mountpoint: Transport endpoint is not connected" pops up and COSFS becomes unavailable.
You can check whether the COSFS process exists using the command
ps ax|grep cosfs. If the COSFS process is down due to misoperation, run the following command to remount it:
umount -l /path/to/mnt_dir cosfs example-1253972369:/my-dir /mnt/cosfs -ourl=http://cos.ap-guangzhou.myqcloud.com -odbglevel=info
If the COSFS process error is not caused by misoperation, you can check whether the fuse version on the server is lower than 2.9.4. The libfuse earlier than 2.9.4 can cause the exception of COSFS process. In this case, it is recommended to update the fuse version or install the latest version of COSFS as described in Compiling and Installing COSFS in this document.
What should I do if the Content-Type of a file uploaded via COSFS is changed to "application/octet-stream"?
COSFS automatically sets the Content-Type of a file uploaded to the COS by comparing the file's suffix against /etc/mime.types. When a Content-Type problem occurs, check whether the configuration file exists on the system. For Ubuntu, you can add it using "sudo apt-get install mime-support". For CentOS, you can add it using "sudo yum install mailcap". You can also create this file manually, where one line is added for each file format, as shown below:
image/jpeg jpg jpeg image/jpm jpm jpgm image/jpx jpx jpf
What should I do when "Bucket not exist" is displayed during the mounting?
Check the parameter -ourl to ensure that the Bucket part is not included in the URL. The correct format is:
Why can I write files before, but not now?
Due to the policy adjustments of COS authentication product, using a COSFS tool earlier than V1.0.0 will cause the failure of policy verification. You can install the latest COSFS tool and mount it again.
How do I deal with such errors as "Input/Output ERROR" during my use of COSFS tool?
Make a check by following the steps below to identify the cause of problem.
- Check whether the server can access the COS domain name normally.
- Check whether the account is configured correctly.
After confirming that the above configurations are correct, open the
/var/log/messages log file on the server and locate the s3fs-related log, which can help you identify the cause of the problem. If the problem persists, contact Tencent Cloud technical support by submitting a ticket.
I've set "auto amount upon startup" for COSFS using /etc/fstab, but the error "wrong fs type, bad option, bad superblock on cosfs" occurs when I run "mount -a".
This error is usually caused by the lack of the fuse library on your server. It is recommended to install the fuse library by running the following commands:
sudo yum install fuse
sudo apt-get install fuse