Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ FunctionGraph/ Best Practices/ Deploying AI Drawing Stable-Diffusion in the Application Center/ Advanced Use/ Using ECS as an NFS Server to Isolate Resources of Multiple Users

Using ECS as an NFS Server to Isolate Resources of Multiple Users

Updated on 2025-02-28 GMT+08:00

Using ECS as an NFS Server to Isolate Resources of Multiple Users

In addition to SFS file systems, NFS shared paths on ECS can also be mounted to FunctionGraph functions. Using ECS makes it easier to manage resources for multiple tenants.

  1. Buy an ECS. Pay attention to the following aspects:

    • Select CN East-Shanghai1 for Region. You can select the ECS specification and image version based on service requirements. EulerOS 2.5 64bit(40 GiB) is used as an example. Some Linux commands vary depending on the image version.
      Figure 1 Basic information
    • The size of many model files ranges from 1 GB to more than 10 GB. It is advised to select a system disk or mount a data disk as required. Click Next: Configure Network.
      Figure 2 Configuring a system disk
    • Select the VPC and subnet created in the previous step.
      Figure 3 Configuring the VPC and subnet
    • For details about how to configure a security group, see the following figure. For inbound rules, enable ports 111, 2049, 2051, 2052, and 20048 for the IP address segment in the subnet for the NFS service. Configure other ports, such as port 22 for SSH and SFTP and port 21 for FTP.
      Figure 4 Configuring a security group
    • Purchase an EIP based on service requirements.
      Figure 5 Purchasing an EIP

  2. Configure NFS sharing.

    After purchasing an ECS, you can configure NFS sharing. The following uses user1 and user2 as an example.
    1. Add users user1 and user2 and create the home directory.
      useradd -m user1 && useradd -m user1
    2. Change the password.
      passwd user1
      passwd user2
    3. Create a shared directory for users and change the operation permission on the shared directory to 777.
      mkdir /home/user1/share && chmod 777 /home/user1/share
      mkdir /home/user2/share && chmod 777 /home/user2/share
      NOTE:

      The shared directory is a subdirectory of the home directory and inaccessible to other users. This ensures that the function has the operation permission after mounting the directory. Therefore, permission 777 will not cause unauthorized operations.

    4. Install the NFS service.
      yum install rpcbind nfs-utils // Run the corresponding command for images that use apt or other package management tools.
    5. Add the following content to the /etc/exports file:
      /home/user1/share xx.xx.xx.xx/xx(rw) // Fill xx.xx.xx.xx/xx with the network segment of the created subnet.
      /home/user2/share xx.xx.xx.xx/xx(rw) // Fill xx.xx.xx.xx/xx with the network segment of the created subnet.
    6. Start the NFS service.
      systemctl start rpcbind nfs
    7. Enable the NFS service to automatically start upon system startup.
      echo "xx.xx.xx.xx:/home/user1/share /nfs nfs4 defaults 0 0" >> /etc/fstab // Enter the IP address of the ECS in the subnet.
      echo "xx.xx.xx.xx:/home/user2/share /nfs nfs4 defaults 0 0" >> /etc/fstab // Enter the IP address of the ECS in the subnet.
      mount -av
    8. Check the sharing information. If the following is displayed, the NFS sharing is successfully configured.
      showmount -e xx.xx.xx.xx (IP address of the server)
      Figure 6 Checking sharing information

Mounting an Application

In the FunctionGraph application center, create a Stable-Diffusion application for user1 and user2, respectively. The following uses user1 as an example. The procedure for user2 is the same.

  1. Go to the Summary page of user1 application, find the function whose logical name is stable_diffusion or custom_models_tool in Resources, and click the link to go to the function details page. The operations of the two functions are the same. The stable_diffusion function is used as an example.

    Figure 7 Functions of user1

  2. On the function details page, choose Configuration > Network, enable VPC Access, configure the VPC and subnet, select the same VPC and subnet as those of ECS, and click Save.

    Figure 8 Configuring network

  3. In the navigation pane, choose Disk Mounting > Mount File System.

    • File System Type: Select ECS.
    • ECS: Select the ECS used to configure the NFS sharing.
    • Shared Directory: Enter /home/user1/share (e/home/user2/share for user2).
    • Access Path: Enter /mnt/auto.
    Figure 9 Mounting a file system

  4. After the configuration is complete, click OK.

Accessing the WebUI Program to Create Directories and Files

  1. Go to the Summary page of user1, click Access Application in the upper right corner, and wait until the function is started. The function automatically creates a directory required by the application in the mounting directory.
  2. Go back to the Summary page of user1 application and click Upload Model to open the file management tool.

    Figure 10 File management tool

  3. Save your model and plug-in files to the corresponding directories. The following is an introduction of some main directories.

    • sd/models/Stable-diffusion: Path for storing Stable-Diffusion Checkpoint model files.
    • sd/models/VAE: Path for storing VAE files.
    • sd/models/Lora: Path for storing LoRA models.
    • sd/extensions: Path for storing plug-ins.

  4. Reload the WebUI. The newly imported models are displayed.

    Figure 11 Checkpoint models
    Figure 12 LoRA models

  5. Click Generate in the upper right corner. The image is automatically saved to the /home/user1/share/sd/outputs/txt2img/202x-xx-xx directory.

    Figure 13 Directory for saving images

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback