You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
FSX best practices
Automatically remounting a bucket
Copy page
Download PDF
Automatically remounting a bucket
After a cloud server is shut down or restarted, the mount point becomes unmounted. In this case, you will need to use FSX to remount the bucket. You can create an auto-start script that will cause FSX to start and remount the bucket automatically when the cloud server starts up. This topic describes the prerequisites and steps for enabling automatic remounting.​
Prerequisites​
You have installed FSX and mounted the bucket via FSX. For instructions, see Configuration and mounting.​
Steps​
  1. Run this command to create the script.sh file in the root directory.​
  • ​
    touch /root/script.sh​
    ​
  1. Open the script.sh file, write the following content, and save it.​
  • ​
    echo "start to mount fsx"​
    # Wait 5s for fusemonitor lazy loading to complete​
    sleep 5 ​
    echo sleep done​
    # Modify the mount parameters according to your needs​
    mount -t fsx /tos/<bucket name>:/<bucket directory> <mount point> -o region="<your region>",endpoint="<your endpoint>",credential_filepath="<absolute path of credentials file>",no_writeback_cache,num_prefetch_threads=180 ​
    ​
    echo "end to mount $?"​
    ​
  • Modify the parameters region, endpoint, and credential_filepath in the script.sh file according to your environment. The descriptions are as follows:​
  • ​
    Parameter​
    Description​
    region​
    The region of the bucket that you want to mount.​
    endpoint​
    The endpoint that follows the TOS protocol. Endpoints that follow the S3 protocol are not supported. Unless otherwise specified, HTTPS is used by default in the format https://{host}:{port}.​
    credential_filepath​
    The absolute path of the credentials file used to load the required access credentials. You need to create the credentials file yourself. The file must have a json extension and contain the following content:​
    ​
    {​
    "VOLC_ACCESSKEY": "<ak_string>",​
    "VOLC_SECRETKEY": "<sk_string>",​
    "VOLC_SECURITY_TOKEN": "<sts_string>"​
    }​
    ​
    ​
  1. Run this command to modify the access permissions of the /root/script.sh file. This will give the owner read, write, and execute permissions, and give others read and execute permissions.​
  • ​
    chmod 755 /root/script.sh​
    ​
  1. Run this command to create the fuse-fsx.service file in the /etc/systemd/system/ directory.​
  • ​
    touch /etc/systemd/system/fuse-fsx.service​
    ​
  1. Open the fuse-fsx.service file, write the following content, and save it.​
  • ​
    [Unit]​
    Description=Mount FUSE filesystem​
    # Must depend on fusemonitor.service​
    After=multi-user.target fusemonitor.service ​
    Wants=multi-user.target​
    [Service]​
    Type=oneshot​
    ExecStart=/bin/bash /root/script.sh​
    RemainAfterExit=yes​
    [Install]​
    WantedBy=multi-user.target​
    ​
  1. Run this command to load the fuse-fsx.service file.​
  • ​
    systemctl daemon-reload​
    ​
  1. Run this command to set the fuse-fsx.service service to start on boot.​
  • ​
    systemctl enable fuse-fsx.service​
    ​
  • Once you have finished configuring, reboot the ECS instance. After rebooting, the system will automatically mount the bucket.​
​
Last updated: 2026.01.16 18:20:46