All Products
Search
Document Center

Object Storage Service:Mount an OSS bucket with Cloud Storage Gateway

Last Updated:Jun 02, 2026

Cloud Storage Gateway (CSG) mounts an OSS bucket as a shared file system, enabling multiple users to access the data from different locations and devices. After mounting, you can manage OSS objects like local files and folders.

Prerequisites

Usage notes

  • Do not write Archive, Cold Archive, or Deep Cold Archive objects directly to a CSG-mounted bucket.

    CSG calls CopyObject to update object metadata (such as the last modified time) on each write. For Archive-tier objects, CopyObject triggers a restore, which degrades upload performance and may cause failures. Write files as Standard or IA first, then transition them with lifecycle rules. Lifecycle rules based on last modified time.

  • Using CSG incurs charges for the gateway edition, cache type, public bandwidth, and OSS usage (storage and requests). Cloud Storage Gateway billing.

Step 1: Configure a file gateway

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find and click the desired bucket.

  3. In the left-side navigation pane, choose Object Management > Attach OSS Bucket to ECS, and then click Configure Gateway.

  4. On the Basic Information pane, configure the following parameters and click Next.

    Parameter

    Description

    Edition

    Select an edition based on bucket capacity and bandwidth requirements. File gateways.

    VPC

    Select the VPC where the ECS instance resides.

    vSwitch

    Select the vSwitch in the VPC where the ECS instance resides.

  5. On the Config Protocol pane, configure the following parameters and click Next.

    Parameter

    Description

    Name

    Enter a name for the file gateway.

    Maximum 60 characters. Must start with a letter or Chinese character. Allowed: letters, Chinese characters, digits, underscores (_), hyphens (-), and periods (.).

    Subdirectory

    To mount a bucket subdirectory, select the Subdirectory option next to Bucket Name and enter the subdirectory name.

    Protocol

    Select the file gateway protocol.

    • NFS: For Linux clients.

    • SMB: For Windows clients.

    Share name

    Set the network share name for the mounted bucket.

    Maximum 32 characters. Must start with a letter. Allowed: letters, digits, ._-.

    User mapping

    Specify the user identity for NFS client access. Available only when Protocol Type to NFS.

    • none: NFS clients retain their original identities.

    • root_squash: Maps the root user to nobody on the server.

    • all_squash: Maps all users to nobody on the server.

    • all_anonymous: Maps all users to anonymous on the server.

    Note

    By default, CSG grants all users read, write, and execute permissions on mounted files. Configure user mapping as follows:

    • To manage permissions, set user mapping to none and use root to configure access. Set file access permissions.

    • If you do not need to manage permissions, select any other mapping option.

    Reverse sync

    Synchronizes metadata from the OSS bucket to the gateway cache to keep them consistent.

    Set the Reverse Sync Interval. Valid values: 15 to 36,000 seconds. Recommended: greater than 3,600 seconds.

    Important

    Reverse Sync scans all objects in the bucket and may incur API request fees. Request fees.

    Cache disk type

    Ultra Disk, Standard SSD, and ESSD. Availability varies by region. Select a type based on your business requirements.

    Cache Capacity

    Data cache capacity. Unit: GB. Valid values: 100 to 32,768.

    CSG caches hot data on the ECS instance to improve access performance and reduce latency.

  6. On the Billing Information pane, read and select Cloud Storage Gateway Service Agreement, and then click Finish.

    Note

    The gateway uses pay-as-you-go billing by default. Switch to subscription for lower cost. Convert a pay-as-you-go gateway to a subscription gateway.

Step 2: Mount and access the bucket

After creating the file gateway, mount the bucket on your ECS instance. These steps cover NFS. For SMB, use Access an SMB share instead.

  1. On the bucket details page, choose Object Management > Attach OSS Bucket to ECS in the left-side navigation pane.

  2. In the list of file gateways, find the Server Mount Target of your gateway.

  3. Log on to your Linux ECS instance in the bucket's region. Connect to an instance by using VNC.

  4. Run the NFS mount command to mount the target bucket.

    For example, if the mount target is 172.16.0.2:/test and the local directory is /mnt/nfs/:

    mount.nfs 172.16.0.2:/test /mnt/nfs/
  5. Access the target bucket.

    Example commands to access the bucket through the mount point:

    • List the files in the root directory of the bucket.

      ls /mnt/nfs/
    • Copy the example.txt file from the bucket's root directory to your local system.

      cp /mnt/nfs/example.txt example.txt

(Optional) Step 3: Set file access permissions

  1. Log on to the NFS client as the root user.

  2. Set file access permissions.

    The following example grants the nfsnobody group (UID/GID: 429496****) read-only access to example.txt:

    1. Change the owner group of example.txt to nfsnobody.

      chgrp -R 429496**** example.txt
    2. Grant the nfsnobody group read-only permission on example.txt.

      chmod 444 example.txt
    Note

    After configuring permissions, change user mapping to root_squash, all_squash, or all_anonymous to restrict root access.

  3. Optional: Modify the user mapping setting.

    1. Log on to the .

    2. In the left-side navigation pane, click Gateways. Then, click the name of the target gateway.

    3. Click Share, and then on the Shares page, click Settings in the Actions column.

    4. In the NFS Share Settings dialog box, modify the user mapping setting as needed.

    5. Click OK.

FAQ

CSG vs. ossfs

CSG provides better performance than ossfs. ossfs is suitable only for small-file management and does not support high-concurrency or uploading and downloading large files.

Does deleting a bucket release the gateway?

No. If you no longer need the file gateway, you must manually delete it in the CSG console to avoid ongoing charges.