-
Notifications
You must be signed in to change notification settings - Fork 152
FAQ EN
- Q: What kind of apps is OSSFS suitable for?
- The OSSFS can mount OSS buckets to a local location. If your app does not support OSS but you want to automatically synchronize data to the OSS, OSSFS is a good choice.
- Q: What are the restrictions of OSSFS?
- Data is synchronized to the cloud via the network. The OSSFS, however, may have a gap with local file systems in terms of performance and functionality. Think twice if you want to run apps with high IO requirements such as databases on an OSSFS-mounted disk. Specific differences with local files systems:
- Random or appending writes to files may lead to rewriting the entire file.
- Metadata operations, such as list directory perform poorly because of the remote access to the OSS server.
- Rename operations on files/folders are not atomic.
- When multiple clients are mounted to the same OSS bucket, you have to coordinate the actions of various clients on your own. For example, keep multiple clients from writing data to the same file.
- Hard link is not supported.
- Q: Is OSSFS applicable to Alibaba Cloud servers only?
- The OSSFS is not exclusive to Alibaba Cloud intranet. It is also applicable to servers on the internet.
- Q: Can I use OSSFS to mount multiple OSS buckets at the same time?
- Yes, you can. Just write the configuration information of multiple OSS buckets in the passwd-ossfs file. Mounting OSS buckets from different accounts is supported.
- Q: When I use yum/apt-get to install the OSSFS, an error 'conflicts with file from package fuse' appears. What is the problem?
- An old version of fuse exists in your system. Please first uninstall it using a related package manager and then re-install OSSFS.
- Q: The OSSFS is not working normally. How can I debug it?
- You can add the '-d -o f2' parameters during mounting and the OSSFS will write to the system logs, the CentOS system, and the /var/log/messages directory.
- You can also use the '-f -d -o f2' parameters during mounting and the OSSFS will output the logs to the screen.
- Q: An error message saying "ossfs: unable to access MOUNTPOINT /tmp/ossfs: Transport endpoint is not connected" is displayed during mounting. Why is that?
- First, unmount the corresponding directory.
- Please check whether the entered URL parameter is correct for OSSFS mounting, and whether it matches the bucket/access key ID/access key secret.
- Special note: The URL does not contain the bucket name. For example, if the bucket domain information you see in the OSS console is like this: 'ossfs-test-1.oss-cn-hangzhou.aliyuncs.com', the entered URL should be: 'http://oss-cn-hangzhou.aliyuncs.com'.
- Q: The OSSFS prompts "ossfs: unable to access MOUNTPOINT /tmp/odat: No such file or directory". Why is this?
- This is because you haven't created the directory. You must create the corresponding directory before the mounting operation.
- Q: After I mount the bucket to a local directory and use "ls" to list the directory, an error message saying "operation not permitted" appears. Why is that?
- Check whether your bucket contains an OSS object key with invisible characters. The file system has stricter limitations on the file/directory name, hence the above error. After you use other tools to rename these objects, the ls will be able to display the content correctly.
- Q: One of my directories contains many files and performing "ls" on this directory is very slow. Why?
- If a directory contains n files, the "ls" operation on this directory will need at least n OSS HTTP requests. When there are too many files, this may cause serious performance issues.
- You can optimize performance using the two methods below:
- Increase the stat cache size through the '-omax_stat_cache_size=xxx' parameter. In this case, the first "ls" operation will be slow, but subsequent "ls" operations will be fast, because the metadata of files is all stored in the local cache. This value is by default 1,000, consuming around 4 MB of memory. You can adjust the value based on your memory size.
- Use the 'ls -f' command instead. This command will clear n HTTP requests with the OSS.
- For details, see Issue 13.
- Q: How should I set the permission for OSSFS mounting?
- If you want to allow other users to access and mount the folder, you can specify the 'allow_other' parameter when running the OSSFS:
- 'ossfs your_bucket your_mount_point -ourl=your_endpoint -o allow_other'
- Why does access to files fail even when the "allow_other" parameter is used?
- Note: The "allow_other" parameter grants other users with permission to access the mounted directory, instead of to access the files in the directory. If you want to change files in the folder, use the "chmod" command.
- The "allow_other" parameter grants 777 permissions to the mounted directory by default. I want to change the permissions to 770. What should I do?
- You can configure the settings through "umask". See here.
- Q: How can I make the mounted folder (/tmp/ossfs) belong to a user?
- First, get the uid/gid of the specified user through the "id" command. For example, the uid and gid of User www are: 'id www'.
- Then specify the "uid/gid" parameters during mounting: 'ossfs your_bucket your_mountpoint -ourl=your_url -ouid=your_uid -ogid=your_gid'.
- Note: Both the uid and gid are numbers.
- Q: I am not a root user. How can I unmount an OSSFS-mounted directory?
-
fusermount -u your_mountpoint
.
- Q: How can I enable automatic OSSFS mounting at startup?
- Step 1: First refer to the usage instructions to write the bucket name, access key ID/secret and other information into "/etc/passwd-ossfs" and change the file permission to 640.
-
echo your_bucket_name:your_access_key_id:your_access_key_secret > /etc/passwd-ossfs
. -
chmod 640 /etc/passwd-ossfs
.
-
- Step 2: The following settings vary across different system versions.
- Step 2A: Automatic mount through fstab (applicable to Ubuntu14.04 and CentOS6.5).
- Add the following command to "/etc/fstab".
-
ossfs#your_bucket_name your_mount_point fuse _netdev,url=your_url,allow_other 0 0
.. - The "your_xxx" information in the above command should be filled in based on your bucket name and other information.
- Save the "/etc/fstab" file. Run the 'mount -a' command. If no error is reported, it indicates the setting was successful.
- Automatic mounting has now been enabled in Ubuntu14.04. For CentOS6.5, another command is required:
- 'chkconfig netfs on'.
- Step 2B: Mount through automatic startup script (applicable to CentOS7.0 or above).
- Create the file ossfs under the "/etc/init.d/" directory and copy the content in the Template File to this new file. Replace the "your_xxx" content with your own information.
- Run the command: 'chmod a+x /etc/init.d/ossfs'.
- The above command grants executable permission to the newly-created ossfs script. You can run this script. If the content in the script file is correct, the bucket in the OSS should be mounted to your specified directory.
- Run the command: 'chkconfig ossfs on'.
- The above command makes the OSSFS startup script a service to be run automatically at startup.
- Step 2A: Automatic mount through fstab (applicable to Ubuntu14.04 and CentOS6.5).
- Okay. Now automatic OSSFS mounting at startup has been enabled. In summary, if your system is Ubuntu14.04 or CentOS6.5, you need to go through Step 1 + Step 2A. If your system is CentOS7.0, you need to go through Step 1 + Step 2B.
- Step 1: First refer to the usage instructions to write the bucket name, access key ID/secret and other information into "/etc/passwd-ossfs" and change the file permission to 640.
- Q: What should I do if I encounter an error in 'fusermount: failed to open current directory: Permission denied' appears?
- This is a fuse bug. It requires the current user to have read permission to the current directory (non-mounted directory). The solution is to run the cd command to change to a directory that you have read permission for and run the ossfs command again.
Q: How can I avoid charges from file scanning by background programs when I use an ECS instance for OSSFS mounting?
The scans on OSSFS-mounted directories by programs will be converted to requests to the OSS. If there are too many requests, charges will be incurred (1 cent/10,000 requests). If you use updatedb, you can modify '/etc/updatedb.conf' to skip the process. The specific practices are as follows:
1. Add 'fuse.ossfs' after 'PRUNEFS = '.
2. Add the mounted directory after 'PRUNEPATHS = '.
- How can I identify which process scanned my directory?
- First install auditd: 'sudo apt-get install auditd'.
- Start auditd: 'sudo service auditd start'.
- Set the mounted directory for auditing: 'auditctl -w /mnt/ossfs'.
- View which processes accessed this directory in the auditlog: 'ausearch -i | grep /mnt/ossfs'.
-
Q: The Content-Type of all the files uploaded to the OSS through OSSFS is "application/octet-stream". Why is that?
-
The OSSFS queries the content in '/etc/mime.types' to determine the Content-Type of files. Please check whether this file exists. If it does not exist, you need to add it:
- For Ubuntu systems, you can add it through 'sudo apt-get install mime-support'.
- For CentOS systems, you can add it through 'sudo yum install mailcap'.
- You can also add it manually. Each format is in one line, and each line is in a format of: 'application/javascript js'.
Q: How can I use the Supervisor to start OSSFS?
-
Install the Supervisor and execute 'sudo apt-get install supervisor' in Ubuntu.
-
Create a directory and edit the OSSFS startup script:
mkdir /root/ossfs_scripts vi /root/ossfs_scripts/start_ossfs.sh # contents of start_ossfs.sh fusermount -u /mnt/ossfs exec ossfs ... -f
-
Edit '/etc/supervisor/supervisord.conf' and add the following content at the end:
[program:ossfs] command=bash /root/ossfs_scripts/start_ossfs.sh logfile=/var/log/ossfs.log log_stdout=true log_stderr=true logfile_maxbytes=1MB logfile_backups=10
-
Run the Supervisor:
supervisord
-
Confirm everything runs normally:
ps aux | grep supervisor # You should be able to see the supervisor process. ps aux | grep ossfs # You should be able to see the OSSFS process. killall ossfs # Kill the OSSFS process, Supervisor is expected to restart it. ps aux | grep ossfs # You should be able to see the OSSFS process.
If an error occurs, check '/var/log/supervisor/supervisord.log' and '/var/log/ossfs.log'.
Q: What should I do when the "fuse: warning: library too old, some operations may not work" error is prompted?
The cause is that the version of libfuse used for OSSFS compilation is higher than the version linked in the runtime.** This is usually because the user installed libfuse on his/her own.** Use the RPM package we provide to install OSSFS, with no need to install libfuse separately.
In CentOS-5.x and CentOS-6.x systems, the RPM packages we provide contain libfuse-2.8.4. If libfuse-2.8.3 is in the running environment, and OSSFS is linked to the old version of fuse, the above warning will appear.
- How can I identify the fuse version linked during OSSFS runtime?
- Run 'ldd $(which ossfs) | grep fuse'.
- For example, if the result is "/lib64/libfuse.so.2", you can see the fuse version through 'ls -l /lib64/libfuse*'.
- How to link the OSSFS to the correction version of fuse?
- First, find the libfuse directory through 'rpm -ql ossfs | grep fuse'.
- For example, if the result is "/usr/lib/libfuse.so.2", you can run the OSSFS through 'LD_LIBRARY_PATH=/usr/lib ossfs...'.
- Can I ignore this warning?
- Not recommended. See this bug.
Q: Why is the file information (such as size) shown by OSSFS different from that shown by other tools?
Because the OSSFS caches the metadata of files by default (including the size/permission) so that it does not need to initiate requests to the OSS for every 'ls' operation, speeding up the processing. If users modified the file using other programs (such as the SDK/official console/osscmd), the file information shown by OSSFS may not be updated in time.
If you want to disable the OSSFS cache, you can add the following parameter during mounting:
'-omax_stat_cache_size=0'