Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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
Situation Awareness
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
On this page

Creating and Mounting a File System

Updated on 2022-09-07 GMT+08:00

Scenarios

After the logical volume is created, you need to create a file system on the logical volume and mount the file system on the corresponding directory. This section shows how to create an ext4 file system on a logical volume and mount the file system on /Data1.

Procedure

  1. Log in to the ECS as user root.
  2. Run the following command to create a file system:

    mkfs.File system format Logical volume path

    In this example, run the following command:

    mkfs.ext4 /dev/vgdata/lvdata1

    Information similar to the following is displayed:

    [root@ecs-lvmtest ~]# mkfs.ext4 /dev/vgdata/lvdata1
    mke2fs 1.42.9 (28-Dec-2013)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    983040 inodes, 3932160 blocks
    196608 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=2151677952
    120 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    

  3. Run the following command to create a mounting directory:

    mkdir Mounting directory

    In this example, run the following command:

    mkdir /Data1

  4. Run the following command to mount the file system on the directory:

    mount Logical volume path Mounting directory

    In this example, run the following command:

    mount /dev/vgdata/lvdata1 /Data1

  5. Run the following command to query the file system mounting information:

    mount | grep Mounting directory

    In this example, run the following command:

    mount | grep /Data1

    Information similar to the following is displayed:

    [root@ecs-lvmtest ~]# mount | grep /Data1
    /dev/mapper/vgdata-lvdata1 on /Data1 type ext4 (rw,relatime,data=ordered)

    In the command output, dev/mapper/vgdata-lvdata1 indicates the file system path. Take note of this path, which will be used in 6.

  6. Perform the following operations to enable automatic mounting of the file system at the system start:

    If this is not configured, you need to manually mount the file system every time the ECS is restarted.
    1. Run the following command to query the file system UUID:

      blkid File system path

      In this example, run the following command to query the UUID of dev/mapper/vgdata-lvdata1:

      blkid /dev/mapper/vgdata-lvdata1

      Information similar to the following is displayed:

      [root@ecs-lvmtest ~]# blkid /dev/mapper/vgdata-lvdata1
      /dev/mapper/vgdata-lvdata1: UUID="c6a243ce-5150-41ac-8816-39db54d1a4b8" TYPE="ext4"

      In the command output, the UUID is c6a243ce-5150-41ac-8816-39db54d1a4b8.

    2. Run the following command to open the /etc/fstab file:

      vi /etc/fstab

      Information similar to the following is displayed:
      [root@ecs-lvmtest ~]# vi /etc/fstab
      
      #
      # /etc/fstab
      # Created by anaconda on Tue Nov  7 14:28:26 2017
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk'
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
      #
      UUID=27f9be47-838b-4155-b20b-e4c5e013cdf3 /                       ext4    defaults        1 1
      UUID=2b2000b1-f926-4b6b-ade8-695ee244a901 /boot                   ext4    defaults        1 2
    3. Press i to enter editing mode.
    4. Move the cursor to the end of the file and press Enter. Then add the following information:
      UUID=c6a243ce-5150-41ac-8816-39db54d1a4b8 /Data1                  ext4    defaults        0 0

      The file content is described as follows:

      • Column 1: indicates the UUID. Enter the UUID queried in 1.
      • Column 2: indicates the file system's mounting directory. Enter mounting directory /Data1 created in 3.
      • Column 3: indicates the file system format. Enter file system format ext4 configured in 2.
      • Column 4: indicates the mounting option. In this example, defaults is used.
      • Column 5: indicates the backup option. Enter either 1 (the system automatically backs up the file system) or 0 (does not back up the file system). In this example, 0 is used.
      • Column 6: indicates the scanning option. Enter either 1 (the system automatically scans the file system at system start) or 0 (does not scan the file system). In this example, 0 is used.
    5. Press Esc, enter :wq!, and press Enter.

      The system saves the modifications and exits the vi editor.

  7. Perform the following operations to verify automatic mounting:

    1. Run the following command to unmount a file system:

      umount Logical volume path

      In this example, run the following command:

      umount /dev/vgdata/lvdata1

    2. Run the following command to reload all the content in the /etc/fstab file:

      mount -a

    3. Run the following command to query the file system mounting information:

      mount | grep Mounting directory

      In this example, run the following command:

      mount | grep /Data1

      If information similar to the following is displayed, the automatic mounting function takes effect:

      [root@ecs-lvmtest ~]# mount | grep /Data1
      /dev/mapper/vgdata-lvdata1 on /Data1 type ext4 (rw,relatime,data=ordered)

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback